Packages

  • package root
    Definition Classes
    root
  • package csw
    Definition Classes
    root
  • package aas
  • package alarm
  • package command
  • package config
  • package database

    This module provides the client implementation of data access stored in postgres server.

    Database Service

    This module provides the client implementation of data access stored in postgres server. To access the database service, it is expected that developers create an instance of DatabaseServiceFactory.

    Example: DatabaseServiceFactory
    val system = ActorSystem(Behaviors.empty, "test") // in component handlers the ActorSystem should be provided from ActorContext e.g. ctx.system
    val dbFactory = new DatabaseServiceFactory(system)
    val dsl: DSLContext = dbFactory.makeDsl(locationService, "postgres") // postgres is a dbName here

    There are overloads of makeDsl() available. Once the DSLContext is created, it can be used to access data from postgres.

    Complete guide of different flavours of makeDsl() and how to use DSLContext to access data is available at: https://tmtsoftware.github.io/csw/services/database.html

  • package event
  • 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: SupervisorBehavior and TLA Actor (Top Level Actor): ComponentBehaviour defined in the framework which handles the lifecycle and supervision of this component.

    Components are controlled by a 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 Running state, do not receive CommandMessage.

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

    Important Actors in Framework

    - 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.command.client.models.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.command.client.models.framework.SupervisorLifecycleState. For complete list of supported messages per csw.command.client.models.framework.SupervisorLifecycleState, see csw-messages project.

    - ComponentBehaviour : Like Supervisor, evey component is associate with this actor which is known as TLA (Top Level Actor) And it also maintains its own state 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.

    - 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.params.core.states.CurrentState.

    If one component (ex. Assembly) is interested in csw.params.core.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.params.core.states.CurrentState to all subscribers.

    - 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.command.client.messages.SupervisorContainerCommonMessages. It receives csw.command.client.messages.SupervisorContainerCommonMessages.Shutdown or csw.command.client.messages.SupervisorContainerCommonMessages.Restart message and forwards it to all the components residing in this container.

    deploy package

    - 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). Handler class for assembly is csw.common.components.framework.SampleComponentHandlers. 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
        componentHandlerClassName = csw.common.components.framework.SampleComponentHandlers
        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
        componentHandlerClassName = csw.common.components.framework.SampleComponentHandlers
        prefix = tcs.mobie.blue.filter
        locationServiceUsage = RegisterOnly
      },
      {
        name = "Disperser"
        componentType: hcd
        componentHandlerClassName: csw.common.components.framework.SampleComponentHandlers
        prefix: tcs.mobie.blue.disperser
        locationServiceUsage = RegisterOnly
      }
    ]
    Example of Standalone Config File
    name = "IFS_Detector"
    componentType = hcd
    componentHandlerClassName = csw.common.components.framework.SampleComponentHandlers
    prefix = iris.ifs
    locationServiceUsage = RegisterOnly
    connections = []

    - 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: [
        {
          # 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"
        },
        {
          configFilePath: "/resources/hcdStandalone.conf"
          configFileLocation: "Local"
        }
    ]
  • package location
  • package logging
  • package params

    This project is intended to hold reusable models and params used throughout the csw source code.

    Params

    This project is intended to hold reusable models and params used throughout the csw source code.

    This also provides out of the box support to cater to the diverse communication requirements. Consumer of this library will be able to create Commands, Events, States to store ParameterSets.

    Imp Packages

    Commands and Events

    This packages contains classes, traits and models used to create *commands* and *events*. These are all based on type-safe keys and items (a set of values with optional units). Each key has a specific type and the key's values must be of that type.

    Two types of csw.params.commands.Command are supported:

    Following are the concrete commands supported by csw:

    Two types of csw.params.events.Event are supported:

    core

    This package supports serialization and deserialization of commands, events and state variables in JSON format csw.params.core.formats.JsonSupport.

    Scala and Java APIs

    All the param and event classes are immutable. The set methods return a new instance of the object with a new item added and the get methods return an Option, in case the Key is not found. There are also value methods that return a value directly, throwing an exception if the key or value is not found.

    Key Types

    A set of standard key types and matching items are defined. Each key accepts one or more values of the given type.

    Following csw.params.core.generics.KeyType are supported by csw:

    +--------------+-------------------------+---------------------------+
    |  Primitive   |      Scala KeyType      |       Java KeyType        |
    +--------------+-------------------------+---------------------------+
    | Boolean      | KeyType.BooleanKey      | JKeyType.BooleanKey      |
    | Character    | KeyType.CharKey         | JKeyType.JCharKey        |
    | Byte         | KeyType.ByteKey         | JKeyType.ByteKey         |
    | Short        | KeyType.ShortKey        | JKeyType.ShortKey        |
    | Long         | KeyType.LongKey         | JKeyType.LongKey         |
    | Int          | KeyType.IntKey          | JKeyType.IntKey          |
    | Float        | KeyType.FloatKey        | JKeyType.FloatKey        |
    | Double       | KeyType.DoubleKey       | JKeyType.DoubleKey       |
    | String       | KeyType.StringKey       | JKeyType.StringKey       |
    | UtcTime      | KeyType.UTCTimeKey      | JKeyType.UTCTimeKey      |
    | TaiTime      | KeyType.TAITimeKey      | JKeyType.TAITimeKey      |
    | ----------   | ----------              | ----------               |
    | ByteArray    | KeyType.ByteArrayKey    | JKeyType.ByteArrayKey    |
    | ShortArray   | KeyType.ShortArrayKey   | JKeyType.ShortArrayKey   |
    | LongArray    | KeyType.LongArrayKey    | JKeyType.LongArrayKey    |
    | IntArray     | KeyType.IntArrayKey     | JKeyType.IntArrayKey     |
    | FloatArray   | KeyType.FloatArrayKey   | JKeyType.FloatArrayKey   |
    | DoubleArray  | KeyType.DoubleArrayKey  | JKeyType.DoubleArrayKey  |
    | ----------   | ----------              | ----------               |
    | ByteMatrix   | KeyType.ByteMatrixKey   | JKeyType.ByteMatrixKey   |
    | ShortMatrix  | KeyType.ShortMatrixKey  | JKeyType.ShortMatrixKey  |
    | LongMatrix   | KeyType.LongMatrixKey   | JKeyType.LongMatrixKey   |
    | IntMatrix    | KeyType.IntMatrixKey    | JKeyType.IntMatrixKey    |
    | FloatMatrix  | KeyType.FloatMatrixKey  | JKeyType.FloatMatrixKey  |
    | DoubleMatrix | KeyType.DoubleMatrixKey | JKeyType.DoubleMatrixKey |
    | ----------   | ----------              | ----------               |
    | Choice       | KeyType.ChoiceKey       | JKeyType.ChoiceKey       |
    +--------------+-------------------------+---------------------------+

    Detailed information about creating Keys and Parameters can be found here: https://tmtsoftware.github.io/csw/services/messages/keys-parameters.html

    Detailed information about creating commands can be found here: https://tmtsoftware.github.io/csw/services/messages/commands.html

    Detailed information about creating events can be found here: https://tmtsoftware.github.io/csw/services/messages/events.html

  • package prefix
  • package serializable
  • package testkit
  • package time
p

csw

package csw

Package Members

  1. package aas
  2. package alarm
  3. package command
  4. package config
  5. package database

    This module provides the client implementation of data access stored in postgres server.

    Database Service

    This module provides the client implementation of data access stored in postgres server. To access the database service, it is expected that developers create an instance of DatabaseServiceFactory.

    Example: DatabaseServiceFactory
    val system = ActorSystem(Behaviors.empty, "test") // in component handlers the ActorSystem should be provided from ActorContext e.g. ctx.system
    val dbFactory = new DatabaseServiceFactory(system)
    val dsl: DSLContext = dbFactory.makeDsl(locationService, "postgres") // postgres is a dbName here

    There are overloads of makeDsl() available. Once the DSLContext is created, it can be used to access data from postgres.

    Complete guide of different flavours of makeDsl() and how to use DSLContext to access data is available at: https://tmtsoftware.github.io/csw/services/database.html

  6. package event
  7. 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: SupervisorBehavior and TLA Actor (Top Level Actor): ComponentBehaviour defined in the framework which handles the lifecycle and supervision of this component.

    Components are controlled by a 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 Running state, do not receive CommandMessage.

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

    Important Actors in Framework

    - 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.command.client.models.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.command.client.models.framework.SupervisorLifecycleState. For complete list of supported messages per csw.command.client.models.framework.SupervisorLifecycleState, see csw-messages project.

    - ComponentBehaviour : Like Supervisor, evey component is associate with this actor which is known as TLA (Top Level Actor) And it also maintains its own state 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.

    - 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.params.core.states.CurrentState.

    If one component (ex. Assembly) is interested in csw.params.core.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.params.core.states.CurrentState to all subscribers.

    - 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.command.client.messages.SupervisorContainerCommonMessages. It receives csw.command.client.messages.SupervisorContainerCommonMessages.Shutdown or csw.command.client.messages.SupervisorContainerCommonMessages.Restart message and forwards it to all the components residing in this container.

    deploy package

    - 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). Handler class for assembly is csw.common.components.framework.SampleComponentHandlers. 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
        componentHandlerClassName = csw.common.components.framework.SampleComponentHandlers
        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
        componentHandlerClassName = csw.common.components.framework.SampleComponentHandlers
        prefix = tcs.mobie.blue.filter
        locationServiceUsage = RegisterOnly
      },
      {
        name = "Disperser"
        componentType: hcd
        componentHandlerClassName: csw.common.components.framework.SampleComponentHandlers
        prefix: tcs.mobie.blue.disperser
        locationServiceUsage = RegisterOnly
      }
    ]
    Example of Standalone Config File
    name = "IFS_Detector"
    componentType = hcd
    componentHandlerClassName = csw.common.components.framework.SampleComponentHandlers
    prefix = iris.ifs
    locationServiceUsage = RegisterOnly
    connections = []

    - 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: [
        {
          # 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"
        },
        {
          configFilePath: "/resources/hcdStandalone.conf"
          configFileLocation: "Local"
        }
    ]
  8. package location
  9. package logging
  10. package params

    This project is intended to hold reusable models and params used throughout the csw source code.

    Params

    This project is intended to hold reusable models and params used throughout the csw source code.

    This also provides out of the box support to cater to the diverse communication requirements. Consumer of this library will be able to create Commands, Events, States to store ParameterSets.

    Imp Packages

    Commands and Events

    This packages contains classes, traits and models used to create *commands* and *events*. These are all based on type-safe keys and items (a set of values with optional units). Each key has a specific type and the key's values must be of that type.

    Two types of csw.params.commands.Command are supported:

    Following are the concrete commands supported by csw:

    Two types of csw.params.events.Event are supported:

    core

    This package supports serialization and deserialization of commands, events and state variables in JSON format csw.params.core.formats.JsonSupport.

    Scala and Java APIs

    All the param and event classes are immutable. The set methods return a new instance of the object with a new item added and the get methods return an Option, in case the Key is not found. There are also value methods that return a value directly, throwing an exception if the key or value is not found.

    Key Types

    A set of standard key types and matching items are defined. Each key accepts one or more values of the given type.

    Following csw.params.core.generics.KeyType are supported by csw:

    +--------------+-------------------------+---------------------------+
    |  Primitive   |      Scala KeyType      |       Java KeyType        |
    +--------------+-------------------------+---------------------------+
    | Boolean      | KeyType.BooleanKey      | JKeyType.BooleanKey      |
    | Character    | KeyType.CharKey         | JKeyType.JCharKey        |
    | Byte         | KeyType.ByteKey         | JKeyType.ByteKey         |
    | Short        | KeyType.ShortKey        | JKeyType.ShortKey        |
    | Long         | KeyType.LongKey         | JKeyType.LongKey         |
    | Int          | KeyType.IntKey          | JKeyType.IntKey          |
    | Float        | KeyType.FloatKey        | JKeyType.FloatKey        |
    | Double       | KeyType.DoubleKey       | JKeyType.DoubleKey       |
    | String       | KeyType.StringKey       | JKeyType.StringKey       |
    | UtcTime      | KeyType.UTCTimeKey      | JKeyType.UTCTimeKey      |
    | TaiTime      | KeyType.TAITimeKey      | JKeyType.TAITimeKey      |
    | ----------   | ----------              | ----------               |
    | ByteArray    | KeyType.ByteArrayKey    | JKeyType.ByteArrayKey    |
    | ShortArray   | KeyType.ShortArrayKey   | JKeyType.ShortArrayKey   |
    | LongArray    | KeyType.LongArrayKey    | JKeyType.LongArrayKey    |
    | IntArray     | KeyType.IntArrayKey     | JKeyType.IntArrayKey     |
    | FloatArray   | KeyType.FloatArrayKey   | JKeyType.FloatArrayKey   |
    | DoubleArray  | KeyType.DoubleArrayKey  | JKeyType.DoubleArrayKey  |
    | ----------   | ----------              | ----------               |
    | ByteMatrix   | KeyType.ByteMatrixKey   | JKeyType.ByteMatrixKey   |
    | ShortMatrix  | KeyType.ShortMatrixKey  | JKeyType.ShortMatrixKey  |
    | LongMatrix   | KeyType.LongMatrixKey   | JKeyType.LongMatrixKey   |
    | IntMatrix    | KeyType.IntMatrixKey    | JKeyType.IntMatrixKey    |
    | FloatMatrix  | KeyType.FloatMatrixKey  | JKeyType.FloatMatrixKey  |
    | DoubleMatrix | KeyType.DoubleMatrixKey | JKeyType.DoubleMatrixKey |
    | ----------   | ----------              | ----------               |
    | Choice       | KeyType.ChoiceKey       | JKeyType.ChoiceKey       |
    +--------------+-------------------------+---------------------------+

    Detailed information about creating Keys and Parameters can be found here: https://tmtsoftware.github.io/csw/services/messages/keys-parameters.html

    Detailed information about creating commands can be found here: https://tmtsoftware.github.io/csw/services/messages/commands.html

    Detailed information about creating events can be found here: https://tmtsoftware.github.io/csw/services/messages/events.html

  11. package prefix
  12. package serializable
  13. package testkit
  14. package time

Ungrouped