|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IContainer
Contract for ECF communications container
IContainer instances are used by clients to define a context for
communications.
The typical life cycle of an ECF communications container is:
ContainerFactory
// Create container instance via factory IContainer container = ContainerFactory.getDefault().createContainer( "ecf.generic.client"); // Get presence protocol adapter IPresenceContainerAdapter presence = (IPresenceContainerAdapter) container .getAdapter(IPresenceContainerAdapter.class); // ... setup presence listeners and local input here using presence // Connect container.connect(target, targetConnectContext); // Engage in appropriate communications here using protocol adapter(s) // Manage protocol adapters as needed when finished // Disconnect container.disconnect();
Method Summary | |
---|---|
void |
addListener(IContainerListener listener)
Add listener to IContainer. |
void |
connect(ID targetID,
IConnectContext connectContext)
Connect to a target remote process or process group. |
void |
disconnect()
Disconnect. |
void |
dispose()
Dispose this IContainer instance. |
java.lang.Object |
getAdapter(java.lang.Class serviceType)
This specialization of IAdaptable.getAdapter() returns additional services supported by this container. |
ID |
getConnectedID()
Get the target ID that this container instance has connected to. |
Namespace |
getConnectNamespace()
Get the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls to connect(ID, IConnectContext) . |
void |
removeListener(IContainerListener listener)
Remove listener from IContainer. |
Methods inherited from interface org.eclipse.ecf.core.identity.IIdentifiable |
---|
getID |
Method Detail |
---|
void connect(ID targetID, IConnectContext connectContext) throws ContainerConnectException
targetID
- the ID of the remote server or group to connect to. See
getConnectNamespace()
for a explanation of the
constraints upon this parameter.connectContext
- any required context to allow this container to authenticate.
May be null
if underlying provider does not
have any authentication requirements for connection.
ContainerConnectException
- thrown if communication cannot be established with remote
service. Causes can include network connection failure,
authentication failure, server error, or if container is
already connected.ID getConnectedID()
null
if container not connected.Namespace getConnectNamespace()
connect(ID, IConnectContext)
.
If this method returns null
, then it means that
null
is expected as a valid parameter in subsequent calls
to connect(ID, IConnectContext)
. If this method returns a non-null
Namespace, then the targetID
parameter in
connect(ID, IConnectContext)
must be non-null
instance created of the returned Namespace.
connect(ID, IConnectContext)
. If null
,
then the targetID
instances passed to
connect(ID, IConnectContext)
may be null
.
If not null
, then targetID
instances passed to connect(ID, IConnectContext)
must be
instances of the returned Namespace.void disconnect()
null
.
java.lang.Object getAdapter(java.lang.Class serviceType)
IContainer
should return them using this method. It is recommended that clients use
this method rather than instanceof checks and downcasts to find out about
the capabilities of a specific container.
Typically, after obtaining an IContainer, a client would use this method as a means to obtain a more meaningful interface to the container. This interface may or may not extend IContainer. For example, a client could use the following code to obtain an instance of ISharedObjectContainer:
IContainer newContainer = ContainerFactory.createContainer(type); ISharedObjectContainer soContainer = (ISharedObjectContainer) newContainer .getAdapter(ISharedObjectContainer.class); if (soContainer == null) throw new ContainerCreateException(message);
Implementations of this method should delegate to
IAdapterManager.loadAdapter()
if the service
cannot be provided directly to ensure extensibility by third-party
plug-ins.
getAdapter
in interface org.eclipse.core.runtime.IAdaptable
serviceType
- the service type to look up
null
if this container does not support the given
servicevoid dispose()
void addListener(IContainerListener listener)
container action | Event |
connect start | IContainerConnectingEvent |
connect complete | IContainerConnectedEvent |
disconnect start | IContainerDisconnectingEvent |
disconnect complete | IContainerDisconnectedEvent |
listener
- the IContainerListener to addvoid removeListener(IContainerListener listener)
listener
- the IContainerListener to remove
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |