What are Factories and Factory Containers

This section describes Factories and Factory Containers in the Communications Architecture. Factories create Nodes.

The Communications Framework uses Factories to create Nodes. Each type of Node has a Factory that is specific to that Node. A Factory is an instance of a class and is implemented as an ECOM plug-in. The plug-in DLL can contain a number of factories. The implementation of a Factory as an ECOM plug-in allows device creators to add new Factories to the Communications Framework.

The Communications Framework creates containers for Factory objects called Factory Containers. The Communications Framework uses Factory Containers to create and store Factory objects. Each type of Node has a Factory Container that is specific to that Node.When the Communications Framework receives the first request to create a Node of a given type the Factory Container creates that Factory first. The Factory exists in the same thread as the Factory Container and is available to create more Nodes. When a thread terminates, the Factory Container closes the Nodes created by the Factories managed by that Factory Container.

Factory Containers are Nodes and have the same behaviour as Nodes. Factory Containers can manage creation requests from other Nodes. Note that there is no Factopry to create a Factory Container.

A Node can ask the Communications Framework to create a new Node. A Node gets the UID that identifies the required type of Node from the Comms Database. A Node asks the Communications Framework to return the correct Factory Container. The Node then asks that Factory Container to supply the Factory that can create the required type of Node.

The implementation of the Communications Framework provides a Factory Container for each type of Node in each Plane in each thread. For example, if the Communications Framework uses two threads to implement the Control Plane, then the Communications Framework creates two Factory Containers for Connection Provider (CPR) Nodes and two Factory Containers for SubConnection Provider (SCPR) Nodes. Code in a thread can make a call to a static function to access a Factory Container. The Communications Framework makes sure that Factory Containers are available in a thread. After a Node is created, the thread ID forms part of the Node ID.

Tools and applications do not create or destroy Factory Containers.

Related concepts
Nodes