gov.cca
Interface Services


public interface Services

This is the framework/container services interface, through which the component accesses the framework and (indirectly) other components.


Method Summary
 void addProvidesPort(Port inPort, PortInfo name_type_and_props)
          Exports a Port implemented by this component to the framework.
 PortInfo createPortInfo(java.lang.String name, java.lang.String type, java.lang.String[] properties)
          Creates a PortInfo to be used in subsequent calls to describe a Port.
 ComponentID getComponentID()
          Get a reference interface for the component to which this Services object belongs.
 Port getPort(java.lang.String name)
          Fetch a previously registered Port (defined by either addProvide or registerUses).
 Port getPortNonblocking(java.lang.String name)
          Fetch a previously registered Port (defined by either addProvide or registerUses) and return that Port if it is available immediately or return null otherwise.
 PortInfo[] getProvidedPorts()
          UNADOPTED: Return the Ports this component currently provides.
 PortInfo[] getRegisteredPorts()
          UNADOPTED: Return the Ports this component currently wants.
 void registerUsesPort(PortInfo name_and_type)
          Register a request for a Port that will be retrieved subsequently with a call to getPort().
 void releasePort(java.lang.String name)
          Notifies the framework that this component is finished using this previously fetched Port.
 void removeProvidesPort(java.lang.String name)
          Notifies the framework that a previously exported Port is no longer available for use.
 void unregisterUsesPort(java.lang.String name)
          Notify the framework that a Port, previously registered by this component, is no longer desired.
 

Method Detail

getPort

Port getPort(java.lang.String name)
             throws java.lang.Exception
Fetch a previously registered Port (defined by either addProvide or registerUses).

Returns:
Will return the Port (possibly waiting forever to acquire it) or return null. There is an implied contract that the port will remain valid for use by the component until the port is released via releasePort(), or a DisconnectingConnectionEvent is dispatched to the component.
Throws:
java.lang.Exception - if named port is not known.

getPortNonblocking

Port getPortNonblocking(java.lang.String name)
                        throws java.lang.Exception
Fetch a previously registered Port (defined by either addProvide or registerUses) and return that Port if it is available immediately or return null otherwise. There is an implied contract that the port will remain valid for use by the component until the port is released via releasePort().

Throws:
java.lang.Exception

releasePort

void releasePort(java.lang.String name)
Notifies the framework that this component is finished using this previously fetched Port. releasePort() method calls should exactly match getPort() method calls; however, an extra call to releasePort() is not an error.


createPortInfo

PortInfo createPortInfo(java.lang.String name,
                        java.lang.String type,
                        java.lang.String[] properties)
Creates a PortInfo to be used in subsequent calls to describe a Port.

See Also:
PortInfo

registerUsesPort

void registerUsesPort(PortInfo name_and_type)
                      throws java.lang.Exception
Register a request for a Port that will be retrieved subsequently with a call to getPort().

Throws:
java.lang.Exception - Registering the same name twice is an error, regardless of the associated type or properties in the PortInfo.

unregisterUsesPort

void unregisterUsesPort(java.lang.String name)
                        throws java.lang.Exception
Notify the framework that a Port, previously registered by this component, is no longer desired.

Throws:
java.lang.Exception - Unregistering a port which is currently in use (i.e. an unreleased getPort() being outstanding) is an error.

addProvidesPort

void addProvidesPort(Port inPort,
                     PortInfo name_type_and_props)
                     throws java.lang.Exception
Exports a Port implemented by this component to the framework. This Port is now available for the framework to connect to other components.

Throws:
java.lang.Exception - Adding an already defined port name (registered or provided) is an error.

removeProvidesPort

void removeProvidesPort(java.lang.String name)
Notifies the framework that a previously exported Port is no longer available for use.


getProvidedPorts

PortInfo[] getProvidedPorts()
UNADOPTED: Return the Ports this component currently provides.


getRegisteredPorts

PortInfo[] getRegisteredPorts()
UNADOPTED: Return the Ports this component currently wants.


getComponentID

ComponentID getComponentID()
Get a reference interface for the component to which this Services object belongs.