myWMS The Communications Panel Seite 1/2 myWMS The Communications Panel by Olaf Krause Audience | Panel | Panel Singleton This document describes the Panel and the PanelSingleton which are featured classes of the myWMS environment. Audience The reader of this document should know about the myWMS idea of a Channel and a Protocol, a ComDispatcher and the meaning of ComObjects. The Panel, described in here founds on all this features. To understand the PanelSingleton a developer should know the meaning of the singleton pattern as system global instance. Start Panel Motivation In some cases a developer may want to connect more than one object or module to one channel simultaneously. Others may want to connect one channel to more than one dispatchers. This problem is solved by the Panel. Many channels may be connected to one panel at a time without one knowing each other. The panel will also contain any number of dispatchers, which means classes implementing the ComDispatcher interface. The function of a panel is it’s forwarding mechanisms. Forwarding ComObject messages As the channel reads a message it will be translated to a ComObject and delivered to the Panel. For this the panel implements the ComDispatcher Interface. The panel will then distribute the message object to each registered dispatcher. The dispatchers are called in the order they have been added to the panel. The dispatcher, receiving an message object will retrieve the channel reference to the originating channel as if it would be called directly. So there is no difference in handling a message in the dispatcher. Just one thing a developer must spend a thought about is: especially in this usage of the dispatcher it may retrieve ComObjects which seem to be useless to it, because they are intended to be received by another dispatcher. This also is true for the evalTimeout() call-back to the dispatcher. Any registered dispatcher may be notified if a timeout occurred. At all the usage of timing out messages seems not to be sensefull to be used in combination with a panel. Broadcast The only way to write to a channel of the panel without having an reference to a connected channel is to broadcast the ComObject via the panel’s broadcast() method. Each connected channel will be informed to send the ComObject in the order the channels have been added to the panel. If a channel could not send it, because the media was not ready or something else happened to the channel, there will nothing indicate the loss except maybe a log in the © 2000 – 2002 Fraunhofer IML myWMS The Communications Panel Seite 2/2 myWMS logging facility. A developer may use execution messages and the myWMS timer facility instead, if it must be secured, that a message is delivered this way. Of cause any implementation may use a known channel at it’s primary usage, via it’s method write(ComObject). Start PanelSingleton Motivation So far the panel is the crossroads regarding messages and message handlers. In a system there is not at all the way co-ordinating the different channels and dispatchers, because each has it’s own domain of instantiation. For example a channel may be instantiated and initialised using a device object of myWMS, which guarantees persistence and remote configuration. The dispatcher may be a LoadHandler, used to steer a material flow component. Each has it’s competence and is instantiated automatically during myWMS’s start-up. For the developer it might be ambiguous when each object is instantiated and in fact although myWMS has a defined order of instantiating objects it does not make any warranty to the developer. This seems more clear if one presumes, that a channel might not be fully initialised if it’s construction returns. Unique Panels The singleton keeps track of co-ordinating the several interests. A developer may ask for a panel using a name, given as String. The Singleton then will deliver a unique panel, associated to this name. If the panel did not exist so far, it was created on the fly. At this panel any component may insert it’s dispatcher or it’s channel, regardless of the order of insertion and the time of insertion. Just the name of the panel must be arranged between the several modules. Of cause it is legal to add a dispatcher to several panels. So one dispatcher instance may be used to consume messages from multiple channels and even more to multiple panels. Start Last update of this document: 29.06.2016 01:25:00 © 2000 – 2002 Fraunhofer IML