Packages

  • package root
    Definition Classes
    root
  • package csw
    Definition Classes
    root
  • package framework

    This project contains the framework for creating components, such as HCDs and Assemblies.

    Framework

    This project contains the framework for creating components, such as HCDs and Assemblies.

    A component is implemented by extending the csw.framework.scaladsl.ComponentHandlers base class. These handlers are executed under an Supervisor Actor: csw.framework.internal.supervisor.SupervisorBehavior and TLA Actor (Top Level Actor): csw.framework.internal.component.ComponentBehavior defined in the framework which handles the lifecycle and supervision of this component.

    Components are controlled by a csw.framework.internal.supervisor.SupervisorBehavior actor that intercepts common messages (ex. Shutdown, Restart) or lifecycle messages (ex. GoOffline or GoOnline) sent from external entities to determine the state of the component.

    Components that are not in the csw.messages.framework.SupervisorLifecycleState.Running state, do not receive csw.messages.CommandMessage.

    When Component is created using this framework, it guarantees that component (HCD/Assembly) is registered with LocationService only when Component moves to csw.messages.framework.SupervisorLifecycleState.Running state. That means, one component can resolve other component only when its in Running state and ready to accept messages.CommandMessage

    Important Actors in Framework

    - csw.framework.internal.supervisor.SupervisorBehavior : Each component created by this framework is supervised by this actor.

    Default strategy of supervisor is to stop child actor but depending on nature of the failure, the supervisor has a choice of the following two options:

    Supervisor changes its csw.messages.framework.SupervisorLifecycleState based on the messages it receives. Decision to handle external messages or not is taken by the supervisor based on its current csw.messages.framework.SupervisorLifecycleState. For complete list of supported messages per csw.messages.framework.SupervisorLifecycleState, see csw-messages project.

    - csw.framework.internal.component.ComponentBehavior : Like Supervisor, evey component is associate with this actor which is known as TLA (Top Level Actor) And it also maintains its own state csw.framework.internal.component.ComponentLifecycleState based on messages it receives.

    Main purpose of this actor is to invoke component specific code written in their corresponding handlers. This is where framework code meets Component specific code.

    - csw.framework.internal.pubsub.PubSubBehavior : This actor is created by framework which is wrapped into csw.framework.CurrentStatePublisher for easy interaction with this actor and then passed to component handlers so that component can publish their csw.messages.params.states.CurrentState.

    If one component (ex. Assembly) is interested in csw.messages.params.states.CurrentState published by other component (ex. HCD) then Assembly can subscribe to HCD's current state.

    PubSub actor maintains the list of subscribers and keeps publishing csw.messages.params.states.CurrentState to all subscribers.

    - csw.framework.internal.container.ContainerBehavior : When multiple components needs to be started in container, then this actor is created. Job of this actor is just to logically group multiple components and support csw.messages.SupervisorContainerCommonMessages. It receives csw.messages.SupervisorContainerCommonMessages.Shutdown or csw.messages.SupervisorContainerCommonMessages.Restart message and forwards it to all the components residing in this container.

    deploy package

    - csw.framework.deploy.containercmd.ContainerCmd : ContainerCmd is a helper utility provided by framework to start multiple components in container mode or single component in Standalone mode.

    Example of Container Config File

    Here is an example of a config file for creating a container with the name IRIS_Container that contains one assembly (named Filter) and depends on the services of two HCDs (Instrument_Filter and Disperser). Factory class for assembly is csw.common.components.framework.SampleComponentBehaviorFactory. A Supervisor actor will be created to manage the assembly, which includes registering it with the location service, using the given name and prefix. The prefix can be used to distribute parts of the configurations to different HCDs. HCDs register themselves with the Location Service and specify a unique prefix that can be used for this purpose.

    name = "IRIS_Container"
    components: [
      {
        name = "Filter"
        componentType = assembly
        behaviorFactoryClassName = csw.common.components.framework.SampleComponentBehaviorFactory
        prefix = tcs.mobie.blue.filter
        locationServiceUsage = RegisterOnly
        connections = [
          {
            name: Instrument_Filter
            componentType: hcd
            connectionType: akka
          },
          {
            name: Disperser
            componentType: hcd
            connectionType: akka
          }
        ]
      },
      {
        name = "Instrument_Filter"
        componentType = hcd
        behaviorFactoryClassName = csw.common.components.framework.SampleComponentBehaviorFactory
        prefix = tcs.mobie.blue.filter
        locationServiceUsage = RegisterOnly
      },
      {
        name = "Disperser"
        componentType: hcd
        behaviorFactoryClassName: csw.common.components.framework.SampleComponentBehaviorFactory
        prefix: tcs.mobie.blue.disperser
        locationServiceUsage = RegisterOnly
      }
    ]
    Example of Standalone Config File
    name = "IFS_Detector"
    componentType = hcd
    behaviorFactoryClassName = csw.common.components.framework.SampleComponentBehaviorFactory
    prefix = iris.ifs
    locationServiceUsage = RegisterOnly
    connections = []

    - csw.framework.deploy.hostconfig.HostConfig : This is just a helper to create host configuration application. This support starting multiple containers on a given host machine and each container will have single/multiple components.

    Example of Host Config file
    # This is a host configuration file which contains list of containers to be spawned by host configuration app
    containers: [
        {
          # mode can be one of Container or Standalone
          mode: "Container"
          # path of individual container configuration file
          configFilePath: "/resources/assemblyContainer.conf"
          # provide 'Remote' if file needs to fetched from config service else
          # provide 'Local' to fetch file from local machine
          configFileLocation: "Local"
        },
        {
          mode: "Standalone"
          configFilePath: "/resources/hcdStandalone.conf"
          configFileLocation: "Local"
        }
    ]
    Definition Classes
    csw
  • package scaladsl
    Definition Classes
    framework
  • ComponentBehaviorFactory
  • ComponentHandlers
c

csw.framework.scaladsl

ComponentHandlers

abstract class ComponentHandlers extends AnyRef

Base class for component handlers which will be used by the component actor

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ComponentHandlers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ComponentHandlers(ctx: ActorContext[TopLevelActorMessage], componentInfo: ComponentInfo, commandResponseManager: CommandResponseManager, currentStatePublisher: CurrentStatePublisher, locationService: LocationService, eventService: EventService, alarmService: AlarmService, loggerFactory: LoggerFactory)

    ctx

    the akka.actor.typed.scaladsl.ActorContext under which the actor instance of the component, which use these handlers, is created

    componentInfo

    component related information as described in the configuration file

    commandResponseManager

    to manage state of a received Submit command

    currentStatePublisher

    the pub sub actor to publish state represented by csw.messages.params.states.CurrentState for this component

    locationService

    the single instance of Location service created for a running application

    eventService

    the single instance of event service with default publishers and subcribers as well as the capability to create new ones

    loggerFactory

    factory to create suitable logger instance

Abstract Value Members

  1. abstract def initialize(): Future[Unit]

    The initialize handler is invoked when the component is created.

    The initialize handler is invoked when the component is created. This is different than constructor initialization to allow non-blocking asynchronous operations. 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.

    returns

    a future which completes when the initialization of component completes

  2. abstract def onGoOffline(): Unit

    A component can be notified to run in offline mode in case it is not in use.

    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.

  3. abstract def onGoOnline(): Unit

    A component can be notified to run in online mode again in case it was put to run in offline mode.

    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.

  4. abstract def onLocationTrackingEvent(trackingEvent: TrackingEvent): Unit

    The onLocationTrackingEvent handler can be used to take action on the TrackingEvent for a particular connection.

    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.

    trackingEvent

    represents a LocationUpdated or LocationRemoved event received for a tracked connection

  5. abstract def onOneway(controlCommand: ControlCommand): Unit

    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.

    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.

    controlCommand

    represents a command received e.g. Setup, Observe or wait

  6. abstract def onShutdown(): Future[Unit]

    The onShutdown handler can be used for carrying out the tasks which will allow the component to shutdown gracefully

    The onShutdown handler can be used for carrying out the tasks which will allow the component to shutdown gracefully

    returns

    a future which completes when the shutdown completes for component

  7. abstract def onSubmit(controlCommand: ControlCommand): Unit

    On receiving a command as Submit, the onSubmit handler is invoked for a component only if the validateCommand handler returns Accepted.

    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.

    controlCommand

    represents a command received e.g. Setup, Observe or wait

  8. abstract def validateCommand(controlCommand: ControlCommand): CommandResponse

    The validateCommand is invoked when a command is received by this component.

    The validateCommand is invoked when a command is received by this component. If a command can be completed immediately, a CommandResponse indicating the final response for the command can be returned. If a command requires time for processing, the component is required to validate the ControlCommand received and return a validation result as Accepted or Invalid.

    controlCommand

    represents a command received e.g. Setup, Observe or wait

    returns

    a CommandResponse after validation

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. var isOnline: Boolean

    A component can access this flag, which can be used to determine if the component is in the online or offline state.

  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. def trackConnection(connection: Connection): Unit

    Track any connection.

    Track any connection. The handlers for received events are defined in onLocationTrackingEvent() method

    connection

    to be tracked for location updates

  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped