Class JDefaultComponentHandlers

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void initialize()
      The initialize handler is invoked when the component is created.
      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.
      void onGoOffline()
      A component can be notified to run in offline mode in case it is not in use.
      void onGoOnline()
      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 onOperationsMode()
      On receiving a operations mode command, the current diagnostic data mode is halted.
      void onShutdown()
      The onShutdown handler can be used for carrying out the tasks which will allow the component to shutdown gracefully
      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.
      CommandResponse.ValidateCommandResponse 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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:
        initialize in class csw.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:
        onDiagnosticMode in class csw.framework.scaladsl.ComponentHandlers
        Parameters:
        startTime - represents the time at which the diagnostic mode actions will take effect
        hint - 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 class csw.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 class csw.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:
        onLocationTrackingEvent in class csw.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:
        onOneway in class csw.framework.scaladsl.ComponentHandlers
        Parameters:
        runId - Run ID for command tracking
        controlCommand - 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 class csw.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 class csw.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:
        onSubmit in class csw.framework.scaladsl.ComponentHandlers
        Parameters:
        runId - Run ID for command tracking
        controlCommand - 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 class csw.framework.scaladsl.ComponentHandlers
        Parameters:
        runId - Run ID for command tracking
        controlCommand - represents a command received e.g. Setup, Observe or wait
        Returns:
        a CommandResponse after validation