Class AbstractSharedObjectContainerAdapterFactory
- java.lang.Object
-
- org.eclipse.ecf.core.AbstractContainerAdapterFactory
-
- org.eclipse.ecf.core.sharedobject.AbstractSharedObjectContainerAdapterFactory
-
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdapterFactory
- Direct Known Subclasses:
RemoteServiceContainerAdapterFactory
public abstract class AbstractSharedObjectContainerAdapterFactory extends AbstractContainerAdapterFactory
Abstract container adapter factory. This class implements theIAdapterFactory
interface. It checks that the first parameter of theAbstractContainerAdapterFactory.getAdapter(Object, Class)
method (adaptableObject) is an instance ofISharedObjectContainer
. If it is, then the methodgetSharedObjectAdapter(ISharedObjectContainer, Class)
is called with the ISharedObjectContainer and Class passed in as arguments.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
ADD_ADAPTER_ERROR_CODE
protected static String
ADD_ADAPTER_ERROR_MESSAGE
-
Constructor Summary
Constructors Constructor Description AbstractSharedObjectContainerAdapterFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ISharedObject
createAdapter(ISharedObjectContainer container, Class adapterType, ID adapterID)
Create an adapter instance that implementsISharedObject
and adapterType.protected ID
createAdapterID(ISharedObjectContainer container, Class adapterType)
Get the adapterID for the given adapterTypeprotected Map
createAdapterProperties(ISharedObjectContainer container, Class adapterType, ID sharedObjectID, ISharedObject sharedObjectAdapter)
Get properties to associate with new shared object adapter creationabstract Class[]
getAdapterList()
protected Object
getContainerAdapter(IContainer container, Class adapterType)
Method called by implementation ofAbstractContainerAdapterFactory.getAdapter(Object, Class)
if the adaptableObject is an instance ofIContainer
.protected ISharedObject
getSharedObjectAdapter(ISharedObjectContainer container, Class adapterType)
Get theISharedObject
adapter for givenISharedObjectContainer
.-
Methods inherited from class org.eclipse.ecf.core.AbstractContainerAdapterFactory
getAdapter
-
-
-
-
Field Detail
-
ADD_ADAPTER_ERROR_CODE
protected static final int ADD_ADAPTER_ERROR_CODE
- See Also:
- Constant Field Values
-
ADD_ADAPTER_ERROR_MESSAGE
protected static final String ADD_ADAPTER_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getContainerAdapter
protected Object getContainerAdapter(IContainer container, Class adapterType)
Description copied from class:AbstractContainerAdapterFactory
Method called by implementation ofAbstractContainerAdapterFactory.getAdapter(Object, Class)
if the adaptableObject is an instance ofIContainer
. Subclasses should implement to return the proper container adapter object based upon the given adapterType.- Specified by:
getContainerAdapter
in classAbstractContainerAdapterFactory
- Parameters:
container
- the IContainer adaptable object provided to the adapter. Will not benull
.adapterType
- the type (interface) of the adapter on the given container. Will not benull
- Returns:
- Object the container adapter instance. May be
null
.
-
getSharedObjectAdapter
protected ISharedObject getSharedObjectAdapter(ISharedObjectContainer container, Class adapterType)
Get theISharedObject
adapter for givenISharedObjectContainer
. The resultingISharedObject
must also implement the adapterType interface. Once called, this method will call the following methods in order:createAdapterID(ISharedObjectContainer, Class)
createAdapter(ISharedObjectContainer, Class, ID)
createAdapterProperties(ISharedObjectContainer, Class, ID, ISharedObject)
- Parameters:
container
- theISharedObjectContainer
that will hold the newISharedObject
adapteradapterType
- the type that theISharedObject
must also implement to be an adapter- Returns:
- ISharedObject adapter. Must also implement adapterType interface class
-
createAdapterProperties
protected Map createAdapterProperties(ISharedObjectContainer container, Class adapterType, ID sharedObjectID, ISharedObject sharedObjectAdapter)
Get properties to associate with new shared object adapter creation- Parameters:
container
- the container that will contain the new adapter shared objectadapterType
- the adapterType for the new shared objectsharedObjectID
- the ID for the new shared object adaptersharedObjectAdapter
- the new shared object adapter- Returns:
- Map of properties to associated with new shared object adapter. If null is returned then no properties will be associated with new shared object adapter. This implementation returns null. Subclasses may override as appropriate
-
createAdapterID
protected ID createAdapterID(ISharedObjectContainer container, Class adapterType)
Get the adapterID for the given adapterType- Parameters:
container
- the container the adapter will be added toadapterType
- the type of the adapter- Returns:
- ID the ID to use for the adapter. If null is returned, then
getSharedObjectAdapter(ISharedObjectContainer, Class)
will also return null
-
createAdapter
protected abstract ISharedObject createAdapter(ISharedObjectContainer container, Class adapterType, ID adapterID)
Create an adapter instance that implementsISharedObject
and adapterType. The resulting instance must implement bothISharedObject
and adapterType- Parameters:
container
- the container that will contain the new adapter instanceadapterType
- the adapter type. The returned value must implement this interfaceadapterID
- the ID to use for the new adapter- Returns:
- ISharedObject the new adapter. If null is returned, then
getSharedObjectAdapter(ISharedObjectContainer, Class)
will also return null
-
getAdapterList
public abstract Class[] getAdapterList()
- Specified by:
getAdapterList
in interfaceorg.eclipse.core.runtime.IAdapterFactory
- Specified by:
getAdapterList
in classAbstractContainerAdapterFactory
-
-