OpenCOM
Class OCM_MultiReceptacleContext<InterfaceType>

java.lang.Object
  extended by OpenCOM.OCM_MultiReceptacleContext<InterfaceType>
All Implemented Interfaces:
IReceptacle

public class OCM_MultiReceptacleContext<InterfaceType>
extends java.lang.Object
implements IReceptacle

Programming abstraction for a multi-receptacle with context selection. Multiple components all implementing the same interface type can be connected to this receptacle. Only the connection matching the full set of context rules is invoked

public OCM_MultiReceptacleContext<IInterfaceType> m_PSR_IIntfType = new OCM_MultiReceptacleContext<IInterfaceType>(IInterfaceType.class);

m_PSR_IIntfType.setContext("Attr1", "Val1");

m_PSR_IIntfType.setContext("Attr2", "Val2");

m_PSR_IIntfType.m_pIntf.foo(params);


Field Summary
 java.lang.Class class_type
          The interface type of this receptacle.
 InterfaceType m_pIntf
          The receptacle endpoint to be invoked by the programmer.
 
Constructor Summary
OCM_MultiReceptacleContext(java.lang.Class<InterfaceType> cls_type)
          Constructor creates a new instance of OCM_MultiReceptacleContext object.
 
Method Summary
 void addContext(java.lang.String Name, java.lang.Object Value)
          Add a context rule to this receptacle (its a set of name-value pairs).
 boolean connectToRecp(IUnknown pIUnkSink, java.lang.String riid, long provConnID)
          This method connects the recpetacle to given component on the given interface type.
 boolean disconnectFromRecp(long connID)
          This method disconnects a given receptacle
 TypedAttribute getValue(java.lang.String name)
          This method gets the value of a named meta-data attribute.
 java.util.Hashtable getValues()
          This method returns all name-value meta-data pairs on this receptacle instance.
 boolean putData(java.lang.String name, java.lang.String type, java.lang.Object value)
          This method adds meta-data name-value pair attributes to the receptacle instance.
 void removeContext(java.lang.String Name)
          Remove a previously entered context rule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

class_type

public java.lang.Class class_type
The interface type of this receptacle.


m_pIntf

public InterfaceType m_pIntf
The receptacle endpoint to be invoked by the programmer.

Constructor Detail

OCM_MultiReceptacleContext

public OCM_MultiReceptacleContext(java.lang.Class<InterfaceType> cls_type)
Constructor creates a new instance of OCM_MultiReceptacleContext object. Usually called from within OpenCOM component constructors.

Parameters:
cls_type - The type of interface to initialse this receptacle to
Method Detail

addContext

public void addContext(java.lang.String Name,
                       java.lang.Object Value)
Add a context rule to this receptacle (its a set of name-value pairs). This will directly influence the selection of a connection to be invoked by the receptacle. i.e. a connection matching all the rules will be invoked.

Parameters:
Name - The Attribute name
Value - The type of interface to initialse this receptacle to

removeContext

public void removeContext(java.lang.String Name)
Remove a previously entered context rule

Parameters:
Name - The Attribute name

connectToRecp

public boolean connectToRecp(IUnknown pIUnkSink,
                             java.lang.String riid,
                             long provConnID)
This method connects the recpetacle to given component on the given interface type.

Specified by:
connectToRecp in interface IReceptacle
Parameters:
pIUnkSink - Reference to the sink component who hosts the interface that the receptacle is to be connected to.
riid - A string representing the interface type of the connection.
Returns:
A boolean indicating the success of this operation

disconnectFromRecp

public boolean disconnectFromRecp(long connID)
This method disconnects a given receptacle

Specified by:
disconnectFromRecp in interface IReceptacle
Returns:
A boolean indicating the success of this operation

putData

public boolean putData(java.lang.String name,
                       java.lang.String type,
                       java.lang.Object value)
This method adds meta-data name-value pair attributes to the receptacle instance.

Specified by:
putData in interface IReceptacle
Parameters:
name - The attribute name.
type - The attribute name.
value - An Object holding the attribute value.
Returns:
A boolean describing if the pair was added or not.

getValue

public TypedAttribute getValue(java.lang.String name)
This method gets the value of a named meta-data attribute.

Specified by:
getValue in interface IReceptacle
Parameters:
name - The attribute name.
Returns:
The TypedAttribute object storing the value.

getValues

public java.util.Hashtable getValues()
This method returns all name-value meta-data pairs on this receptacle instance.

Specified by:
getValues in interface IReceptacle
Returns:
A Hashtable storing the pairs.