Package csw.framework.javadsl
Class JDefaultComponentHandlers
- java.lang.Object
-
- csw.framework.scaladsl.ComponentHandlers
-
- csw.framework.javadsl.JComponentHandlers
-
- csw.framework.javadsl.JDefaultComponentHandlers
-
public class JDefaultComponentHandlers extends JComponentHandlers
-
-
Constructor Summary
Constructors Constructor Description JDefaultComponentHandlers(akka.actor.typed.javadsl.ActorContext<TopLevelActorMessage> ctx, JCswContext cswCtx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize()The initialize handler is invoked when the component is created.voidonDiagnosticMode(UTCTime startTime, java.lang.String hint)On receiving a diagnostic data command, the component goes into a diagnostic data mode based on hint at the specified startTime.voidonGoOffline()A component can be notified to run in offline mode in case it is not in use.voidonGoOnline()A component can be notified to run in online mode again in case it was put to run in offline mode.voidonLocationTrackingEvent(TrackingEvent trackingEvent)The onLocationTrackingEvent handler can be used to take action on the TrackingEvent for a particular connection.voidonOneway(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.voidonOperationsMode()On receiving a operations mode command, the current diagnostic data mode is halted.voidonShutdown()The onShutdown handler can be used for carrying out the tasks which will allow the component to shutdown gracefullyCommandResponse.SubmitResponseonSubmit(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.CommandResponse.ValidateCommandResponsevalidateCommand(Id runId, ControlCommand controlCommand)The validateCommand is invoked when a command is received by this component.
-
-
-
Constructor Detail
-
JDefaultComponentHandlers
public JDefaultComponentHandlers(akka.actor.typed.javadsl.ActorContext<TopLevelActorMessage> ctx, JCswContext cswCtx)
-
-
Method Detail
-
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:
initializein classcsw.framework.scaladsl.ComponentHandlers
-
onDiagnosticMode
public void onDiagnosticMode(UTCTime startTime, java.lang.String hint)
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:
onDiagnosticModein 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:
onGoOfflinein 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:
onGoOnlinein classcsw.framework.scaladsl.ComponentHandlers
-
onLocationTrackingEvent
public void onLocationTrackingEvent(TrackingEvent trackingEvent)
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:
onLocationTrackingEventin classcsw.framework.scaladsl.ComponentHandlers- Parameters:
trackingEvent- represents a LocationUpdated or LocationRemoved event received for a tracked connection
-
onOneway
public 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. In case a command is received as a oneway, command response should not be provided to the sender.- Specified by:
onOnewayin 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:
onOperationsModein 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:
onShutdownin classcsw.framework.scaladsl.ComponentHandlers
-
onSubmit
public CommandResponse.SubmitResponse onSubmit(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. 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:
onSubmitin 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:
validateCommandin 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
-
-