Package csw.framework.javadsl
Class JDefaultComponentHandlers
java.lang.Object
csw.framework.scaladsl.ComponentHandlers
csw.framework.javadsl.JComponentHandlers
csw.framework.javadsl.JDefaultComponentHandlers
-
Constructor Summary
ConstructorDescriptionJDefaultComponentHandlers
(akka.actor.typed.javadsl.ActorContext<TopLevelActorMessage> ctx, JCswContext cswCtx) -
Method Summary
Modifier and TypeMethodDescriptionvoid
The initialize handler is invoked when the component is created.void
onDiagnosticMode
(UTCTime startTime, String hint) On receiving a diagnostic data command, the component goes into a diagnostic data mode based on hint at the specified startTime.void
A component can be notified to run in offline mode in case it is not in use.void
A component can be notified to run in online mode again in case it was put to run in offline mode.void
onLocationTrackingEvent
(TrackingEvent trackingEvent) The onLocationTrackingEvent handler can be used to take action on the TrackingEvent for a particular connection.void
onOneway
(Id runId, ControlCommand controlCommand) On receiving a command as Oneway, the onOneway handler is invoked for a component only if the validateCommand handler returns Accepted.void
On receiving a operations mode command, the current diagnostic data mode is halted.void
The onShutdown handler can be used for carrying out the tasks which will allow the component to shutdown gracefullyonSubmit
(Id runId, ControlCommand controlCommand) On receiving a command as Submit, the onSubmit handler is invoked for a component only if the validateCommand handler returns Accepted.validateCommand
(Id runId, ControlCommand controlCommand) The validateCommand is invoked when a command is received by this component.Methods inherited from class csw.framework.scaladsl.ComponentHandlers
isOnline, isOnline_$eq, trackConnection
-
Constructor Details
-
JDefaultComponentHandlers
public JDefaultComponentHandlers(akka.actor.typed.javadsl.ActorContext<TopLevelActorMessage> ctx, JCswContext cswCtx)
-
-
Method Details
-
initialize
public void initialize()The initialize handler is invoked when the component is created. The component can initialize state such as configuration to be fetched from configuration service, location of components or services to be fetched from location service etc. These vary from component to component.- Specified by:
initialize
in classcsw.framework.scaladsl.ComponentHandlers
-
onDiagnosticMode
On receiving a diagnostic data command, the component goes into a diagnostic data mode based on hint at the specified startTime. Validation of supported hints need to be handled by the component writer.- Specified by:
onDiagnosticMode
in classcsw.framework.scaladsl.ComponentHandlers
- Parameters:
startTime
- represents the time at which the diagnostic mode actions will take effecthint
- represents supported diagnostic data mode for a component
-
onGoOffline
public void onGoOffline()A component can be notified to run in offline mode in case it is not in use. The component can change its behavior if needed as a part of this handler.- Specified by:
onGoOffline
in classcsw.framework.scaladsl.ComponentHandlers
-
onGoOnline
public void onGoOnline()A component can be notified to run in online mode again in case it was put to run in offline mode. The component can change its behavior if needed as a part of this handler.- Specified by:
onGoOnline
in classcsw.framework.scaladsl.ComponentHandlers
-
onLocationTrackingEvent
The onLocationTrackingEvent handler can be used to take action on the TrackingEvent for a particular connection. This event could be for the connections in ComponentInfo tracked automatically or for the connections tracked explicitly using trackConnection method.- Specified by:
onLocationTrackingEvent
in classcsw.framework.scaladsl.ComponentHandlers
- Parameters:
trackingEvent
- represents a LocationUpdated or LocationRemoved event received for a tracked connection
-
onOneway
On receiving a command as Oneway, the onOneway handler is invoked for a component only if the validateCommand handler returns Accepted. In case a command is received as a oneway, command response should not be provided to the sender.- Specified by:
onOneway
in classcsw.framework.scaladsl.ComponentHandlers
- Parameters:
runId
- Run ID for command trackingcontrolCommand
- represents a command received e.g. Setup, Observe or wait
-
onOperationsMode
public void onOperationsMode()On receiving a operations mode command, the current diagnostic data mode is halted.- Specified by:
onOperationsMode
in classcsw.framework.scaladsl.ComponentHandlers
-
onShutdown
public void onShutdown()The onShutdown handler can be used for carrying out the tasks which will allow the component to shutdown gracefully- Specified by:
onShutdown
in classcsw.framework.scaladsl.ComponentHandlers
-
onSubmit
On receiving a command as Submit, the onSubmit handler is invoked for a component only if the validateCommand handler returns Accepted. In case a command is received as a submit, command response should be updated in the CommandResponseManager. CommandResponseManager is an actor whose reference commandResponseManager is available in the ComponentHandlers.- Specified by:
onSubmit
in classcsw.framework.scaladsl.ComponentHandlers
- Parameters:
runId
- Run ID for command trackingcontrolCommand
- represents a command received e.g. Setup, Observe or wait- Returns:
- response for command submission
-
validateCommand
public CommandResponse.ValidateCommandResponse validateCommand(Id runId, ControlCommand controlCommand) The validateCommand is invoked when a command is received by this component. The component is required to validate the ControlCommand received and return a validation result as Accepted or Invalid.- Specified by:
validateCommand
in classcsw.framework.scaladsl.ComponentHandlers
- Parameters:
runId
- Run ID for command trackingcontrolCommand
- represents a command received e.g. Setup, Observe or wait- Returns:
- a CommandResponse after validation
-