Package net.solarnetwork.node.service
Interface PlatformService
- All Known Implementing Classes:
DefaultPlatformService
public interface PlatformService
API for SolarNode platform-wide support.
- Since:
- 1.56
- Version:
- 1.0
- Author:
- matt
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumAn enumeration of possible platform states.static interfaceA platform task.static interfaceInformation about a task.static interfaceStatus information about a task.static interfaceA callback handler for dealing with real-time status updates. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAnEventtopic for when a the platform state has changed.static final StringA message topic for task info updates.static final StringAEventproperty name for aPlatformService.PlatformStatestring value that represents an "old" state.static final StringAEventproperty name for aPlatformService.PlatformStatestring value that represents the "active" state. -
Method Summary
Modifier and TypeMethodDescriptionGet the current active platform state.activePlatformTaskInfo(Locale locale) Get the current active platform task status, localized into task info.Get the current active platform task status.<T> Future<T>Perform a platform state-altering task.voidRegister a subscription to the active platform task's status updates for a specific locale.
-
Field Details
-
EVENT_TOPIC_PLATFORM_STATE_CHANGED
AnEventtopic for when a the platform state has changed.- See Also:
-
PLATFORM_STATE_PROPERTY
AEventproperty name for aPlatformService.PlatformStatestring value that represents the "active" state.- See Also:
-
OLD_PLATFORM_STATE_PROPERTY
AEventproperty name for aPlatformService.PlatformStatestring value that represents an "old" state.- See Also:
-
MSG_TOPIC_PLATFORM_TASK_INFO
A message topic for task info updates.The message body will contain a
new.solarnetwork.domain.ResultwithPlatformService.PlatformTaskInfocontent.- See Also:
-
-
Method Details
-
activePlatformState
PlatformService.PlatformState activePlatformState()Get the current active platform state.- Returns:
- the active platform state
-
activePlatformTaskStatus
PlatformService.PlatformTaskStatus activePlatformTaskStatus()Get the current active platform task status.- Returns:
- the task info, or null if no task is active
-
activePlatformTaskInfo
Get the current active platform task status, localized into task info.- Parameters:
locale- the desired locale of the info, or null for the system default- Returns:
- the localized platform task info
-
subscribeToActivePlatformTaskInfo
Register a subscription to the active platform task's status updates for a specific locale.Once registered, this service will post messages to the
MSG_TOPIC_PLATFORM_TASK_INFOtopic.- Parameters:
locale- the locale to register for updates
-
performTaskWithState
<T> Future<T> performTaskWithState(PlatformService.PlatformState state, PlatformService.PlatformTask<T> task) Perform a platform state-altering task.This method will schedule a task such that while that task is running the provided state is applied to the platform. While
taskis executing theactivePlatformState()method will return the givenstate.- Type Parameters:
T- the task result type- Parameters:
state- the state the task must run withtask- the task to execute- Returns:
- a future with the task results
-