Package org.eclipse.ecf.core
Class AbstractContainer
java.lang.Object
org.eclipse.ecf.core.AbstractContainer
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,IContainer,IIdentifiable
- Direct Known Subclasses:
AbstractClientContainer,AbstractDiscoveryContainerAdapter,AbstractRSAContainer,BaseContainer,SOContainer
Abstract implementation of IContainer. Provides implementations of listener
methods that subsclasses may use to avoid having to implement them
themselves. This class may be subclassed as needed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd listener to IContainer.voiddispose()Dispose this IContainer instance.protected voidFires a container event<T> TgetAdapter(Class<T> serviceType) This specialization of IAdaptable.getAdapter() returns additional services supported by this container.protected StringgetPasswordFromConnectContext(IConnectContext connectContext) voidRemove listener from IContainer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ecf.core.IContainer
connect, disconnect, getConnectedID, getConnectNamespaceMethods inherited from interface org.eclipse.ecf.core.identity.IIdentifiable
getID
-
Constructor Details
-
AbstractContainer
public AbstractContainer()
-
-
Method Details
-
addListener
Description copied from interface:IContainerAdd listener to IContainer. The listener's handleEvent method will be synchronously called when container methods are called. Minimally, the events delivered to the listener are as follows
Container Events container action Event connect start IContainerConnectingEvent connect complete IContainerConnectedEvent disconnect start IContainerDisconnectingEvent disconnect complete IContainerDisconnectedEvent - Specified by:
addListenerin interfaceIContainer- Parameters:
l- the IContainerListener to add
-
removeListener
Description copied from interface:IContainerRemove listener from IContainer.- Specified by:
removeListenerin interfaceIContainer- Parameters:
l- the IContainerListener to remove
-
dispose
public void dispose()Description copied from interface:IContainerDispose this IContainer instance. The container instance will be made inactive after the completion of this method and will be unavailable for subsequent usage.- Specified by:
disposein interfaceIContainer
-
fireContainerEvent
Fires a container event- Parameters:
event- event
-
getAdapter
Description copied from interface:IContainerThis specialization of IAdaptable.getAdapter() returns additional services supported by this container. A container that supports additional services over and above the methods onIContainershould 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.- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- Specified by:
getAdapterin interfaceIContainer- Parameters:
serviceType- the service type to look up- Returns:
- the service instance castable to the given class, or
nullif this container does not support the given service
-
getPasswordFromConnectContext
protected String getPasswordFromConnectContext(IConnectContext connectContext) throws ContainerConnectException - Throws:
ContainerConnectException
-