org.eclipse.ecf.core.sharedobject

## 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 the `IAdapterFactory` interface. It checks that the first parameter of the `AbstractContainerAdapterFactory.getAdapter(Object, Class)` method (adaptableObject) is an instance of `ISharedObjectContainer`. If it is, then the method `getSharedObjectAdapter(ISharedObjectContainer, Class)` is called with the ISharedObjectContainer and Class passed in as arguments.

See Also:
  `getSharedObjectAdapter(ISharedObjectContainer, Class)`

### Field Summary

Fields
`protected static int` `ADD_ADAPTER_ERROR_CODE`
`protected static String` `ADD_ADAPTER_ERROR_MESSAGE`

### Constructor Summary

Constructors
Constructor and Description
`AbstractSharedObjectContainerAdapterFactory()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected abstract ISharedObject` `createAdapter(ISharedObjectContainer container, Class adapterType, ID adapterID)` Create an adapter instance that implements `ISharedObject` and adapterType.
`protected ID` `createAdapterID(ISharedObjectContainer container, Class adapterType)` Get the adapterID for the given adapterType
`protected Map` `createAdapterProperties(ISharedObjectContainer container, Class adapterType, ID sharedObjectID, ISharedObject sharedObjectAdapter)` Get properties to associate with new shared object adapter creation
`abstract Class[]` `getAdapterList()`
`protected Object` `getContainerAdapter(IContainer container, Class adapterType)` Method called by implementation of `AbstractContainerAdapterFactory.getAdapter(Object, Class)` if the adaptableObject is an instance of `IContainer`.
`protected ISharedObject` `getSharedObjectAdapter(ISharedObjectContainer container, Class adapterType)` Get the `ISharedObject` adapter for given `ISharedObjectContainer`.

### Methods inherited from class org.eclipse.ecf.core.AbstractContainerAdapterFactory

`getAdapter`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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

### Constructor Detail

#### AbstractSharedObjectContainerAdapterFactory

    public AbstractSharedObjectContainerAdapterFactory()

### Method Detail

#### getContainerAdapter

    protected Object getContainerAdapter(IContainer container,
                                         Class adapterType)

Description copied from class: `AbstractContainerAdapterFactory`
Method called by implementation of `AbstractContainerAdapterFactory.getAdapter(Object, Class)` if the adaptableObject is an instance of `IContainer`. Subclasses should implement to return the proper container adapter object based upon the given adapterType.

Specified by:
  `getContainerAdapter` in class `AbstractContainerAdapterFactory`
Parameters:
  `container` - the IContainer adaptable object provided to the adapter. Will not be `null`.
  `adapterType` - the type (interface) of the adapter on the given container. Will not be `null`
Returns:
  Object the container adapter instance. May be `null`.

#### getSharedObjectAdapter

    protected ISharedObject getSharedObjectAdapter(ISharedObjectContainer container,
                                                   Class adapterType)

Get the `ISharedObject` adapter for given `ISharedObjectContainer`. The resulting `ISharedObject` 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` - the `ISharedObjectContainer` that will hold the new `ISharedObject` adapter
  `adapterType` - the type that the `ISharedObject` 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 object
  `adapterType` - the adapterType for the new shared object
  `sharedObjectID` - the ID for the new shared object adapter
  `sharedObjectAdapter` - 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 to
  `adapterType` - 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 implements `ISharedObject` and adapterType. The resulting instance must implement both `ISharedObject` and adapterType

Parameters:
  `container` - the container that will contain the new adapter instance
  `adapterType` - the adapter type. The returned value must implement this interface
  `adapterID` - 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 interface `org.eclipse.core.runtime.IAdapterFactory`
Specified by:
  `getAdapterList` in class `AbstractContainerAdapterFactory`