Management of outgoing commands and reports.
More...
Management of outgoing commands and reports.
Out-going commands are commands in a user application (namely in an application which sends commands to a service provider) and out-going reports are reports in a provider application (namely in an application which sends reports to a service user).
Out-going commands and out-going reports are handled together because their management is performed in the same way and is based on the following components:
- OutComponent: this component models the generic behaviour of an out-going command or report. Concrete commands or report generated by an application are defined as extensions of the base OutComponent component.
- OutFactory: this is a component factory which provides unconfigured instances of OutComponents to encapsulate out-going commands or reports.
- OutLoader: after an application has configured an OutComponent representing an out-going command or report, it loads it into the OutLoader. This component is responsible for selecting the appropriate OutManager to process the out-going command or report.
- OutManager: this component is responsible for controlling the out-going command and the out-going report until the OutComponent which encapsulates them is serialized to the OutStream and sent to its destination as a packet.
- OutStream: this component models the interface through which out-going commands and reports are sent to their destination.
- OutRegistry: this component acts as a registry for pending OutComponents. It provides information about the state of the OutComponent to other parts of the host applications.
Note that the OutFactory, OutLoader, and OutRegistry components are singletons and it is therefore assumed that only one instance of each exists in an application. It is also assumed that there is one (and only one) OutStream for each destination to which commands may be sent.
The lifecycle of an out-going report or command is shown in the figure below using and informal notation and can be summarized as follows:
- When the host application decides that it must issue a command or a report, it asks the OutFactory for an unconfigured OutComponent instance to encapsulate the out-going command or report.
- The application configures the OutComponent and then loads it in the OutLoader.
- The OutLoader selects an OutManager and loads the OutComponent into it. The selection of the OutManager will often be based on the urgency with which the command or report must be issued (e.g. each OutManager component is characterized by a certain priority level).
- The OutManager component processes the out-going command or report. If the command or report is disabled, it is aborted and the component which encapsulated it is returned to its factory (where it is either destroyed or is reused). If instead the command or report is enabled, it remains pending in the OutManager until its ready check indicates that the conditions are in place for it to be issued.
- The report or command is issued by serializing its OutComponent to a packet which is then handed over to the OutStream. The OutStream is responsible for sending the packet to its destination. After the OutComponent encapsulating the command or report has been serialized, it is returned to its factory.