Wiring Pattern

Figure: Wiring Pattern

  • The ninth example demonstrates the usage of a wiring master and a wiring slave ports.
  • The wiring pattern provides a consistent mechanism for dynamic wiring of client parts of communication patterns from outside a component. The service requesting part of a communication pattern can expose itself as wireable from outside the component by enrolling at the component's wiring slave object. It becomes a managed client and can then be connected to an appropriate service provider from outside the component via the master part of the wiring pattern.
  • A service requestor can get connected to any service provider as long as both are compatible in terms of the service. Compatibility of a service requires that both parts belong to the same type of communication pattern and that both are parameterized by the same types of communication objects.
  • Wiring at run-time covers every kind of changes in connections between client and server parts of services at any time and requires the communication patterns to appropriately cope with connection changes even when there are pending communication activities. All that is handled inside the communication patterns and is not visible to the user which tremendously reduces user level complexity.
  • Dynamic wiring is, for example, needed to change the data flow between components to compose different behaviors out of a set of skills.
  • The wiring pattern is different to the other communication patterns in not requiring communication objects. Furthermore, the wiring slave does not possess user callable member functions and operates transparently for the user without requiring user interactions.
  • The connect/disconnect member functions of the wiring master must not be confused with the conforming member functions of the service requestors of the other patterns. The connect member function does not establish a connection from the wiring master to the wiring slave but connects a managed client with a service provider. A wiring master can wire arbitrary managed clients of arbitrary components without being explicitly connected to a wiring slave before issuing a wiring command.
  • The integration of the wiring pattern into a component is illustrated in the figure below. Applying the wiring pattern just requires to instantiate the wiring classes. A component can have at most one wiring slave. Service requestors can themselves register at the component central wiring slave using their add / remove member functions. Independently of being a managed client, one can still use the connect / disconnect member functions of the service requestors to change wirings. The finally effective wiring is solely determined by the order of the calls. A wiring master can of course also be used to configure the managed clients of its component.

Figure: Wiring slaves