org.eclipse.ecf.provider.datashare
Class SharedObjectDatashareContainerAdapter

java.lang.Object
  extended by org.eclipse.ecf.core.sharedobject.BaseSharedObject
      extended by org.eclipse.ecf.provider.datashare.SharedObjectDatashareContainerAdapter
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IIdentifiable, ISharedObject, IAbstractChannelContainerAdapter, IChannelContainerAdapter

public class SharedObjectDatashareContainerAdapter
extends BaseSharedObject
implements IChannelContainerAdapter


Field Summary
protected  java.util.List channelContainerListeners
           
protected static int DEFAULT_TRANSACTION_WAIT
           
 
Fields inherited from class org.eclipse.ecf.core.sharedobject.BaseSharedObject
DESTROYREMOTE_CODE, DESTROYSELFLOCAL_CODE
 
Constructor Summary
SharedObjectDatashareContainerAdapter()
           
 
Method Summary
 void addListener(IChannelContainerListener listener)
          Add listener for IChannelContainerAdapter events.
 IChannel createChannel(IChannelConfig newChannelConfig)
          Create a new channel within this container
 IChannel createChannel(ID newID, IChannelListener listener, java.util.Map properties)
          Create a new channel within this container
protected  SharedObjectDescription createChannelSharedObjectDescription(IChannelConfig channelConfig)
           
protected  ISharedObjectTransactionConfig createChannelSharedObjectTransactionConfig()
           
protected  ISharedObject createSharedObject(SharedObjectTypeDescription typeDescription, ISharedObjectTransactionConfig transactionConfig, IChannelListener listener)
           
protected  void fireChannelContainerListeners(IChannelContainerEvent event)
           
 java.lang.Object getAdapter(java.lang.Class adapter)
           
 IChannel getChannel(ID channelID)
          Get IChannel with given channelID.
 Namespace getChannelNamespace()
          Get expected Namespace for channel ID creation
protected  void initialize()
          Initialize this shared object.
 boolean removeChannel(ID channelID)
          Remove channel with given ID.
 void removeListener(IChannelContainerListener listener)
          Remove listener for IChannelContainerAdapter events
 
Methods inherited from class org.eclipse.ecf.core.sharedobject.BaseSharedObject
addEventProcessor, clearEventProcessors, creationCompleted, destroyRemote, destroySelf, destroySelfLocal, dispose, fireEventProcessors, getConfig, getConnectedID, getContext, getGroupMemberIDs, getHomeContainerID, getID, getLocalContainerID, getProperties, getReplicaDescription, getReplicaDescriptions, getSharedObjectMsgFromEvent, handleEvent, handleEvents, handleSharedObjectCreateResponseEvent, handleSharedObjectMsg, handleSharedObjectMsgEvent, handleUnhandledEvent, init, isConnected, isPrimary, log, log, removeEventProcessor, replicateToRemoteContainers, sendSharedObjectMsgTo, sendSharedObjectMsgToPrimary, sendSharedObjectMsgToSelf, trace, traceCatching, traceEntering, traceEntering, traceEntering, traceExiting, traceExiting
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TRANSACTION_WAIT

protected static final int DEFAULT_TRANSACTION_WAIT
See Also:
Constant Field Values

channelContainerListeners

protected java.util.List channelContainerListeners
Constructor Detail

SharedObjectDatashareContainerAdapter

public SharedObjectDatashareContainerAdapter()
Method Detail

initialize

protected void initialize()
                   throws SharedObjectInitException
Description copied from class: BaseSharedObject
Initialize this shared object. Subclasses may override as appropriate to define custom initialization behavior. If initialization should fail, then a SharedObjectInitException should be thrown by implementing code. Also, subclasses overriding this method should call super.initialize() before running their own code.

Overrides:
initialize in class BaseSharedObject
Throws:
SharedObjectInitException - if initialization should throw

fireChannelContainerListeners

protected void fireChannelContainerListeners(IChannelContainerEvent event)

createChannel

public IChannel createChannel(ID newID,
                              IChannelListener listener,
                              java.util.Map properties)
                       throws ECFException
Description copied from interface: IChannelContainerAdapter
Create a new channel within this container

Specified by:
createChannel in interface IChannelContainerAdapter
Parameters:
newID - the ID of the new channel. Must not be null.
listener - a listener for receiving messages from remotes for this channel. May be null if no listener is to be notified.
properties - a Map of properties to provide to the channel. May be null.
Returns:
IChannel the new IChannel instance
Throws:
ECFException - if some problem creating IChannel instance

createChannelSharedObjectDescription

protected SharedObjectDescription createChannelSharedObjectDescription(IChannelConfig channelConfig)
                                                                throws ECFException
Parameters:
channelConfig -
Returns:
SharedObjectDescription a non-null instance.
Throws:
ECFException - not thrown by this implementation.

createChannelSharedObjectTransactionConfig

protected ISharedObjectTransactionConfig createChannelSharedObjectTransactionConfig()

createSharedObject

protected ISharedObject createSharedObject(SharedObjectTypeDescription typeDescription,
                                           ISharedObjectTransactionConfig transactionConfig,
                                           IChannelListener listener)
                                    throws SharedObjectCreateException
Throws:
SharedObjectCreateException

createChannel

public IChannel createChannel(IChannelConfig newChannelConfig)
                       throws ECFException
Description copied from interface: IChannelContainerAdapter
Create a new channel within this container

Specified by:
createChannel in interface IChannelContainerAdapter
Parameters:
newChannelConfig - the configuration for the newly created channel. Must not be null.
Returns:
IChannel the new IChannel instance. Will not be null.
Throws:
ECFException - if some problem creating IChannel instance

getChannel

public IChannel getChannel(ID channelID)
Description copied from interface: IAbstractChannelContainerAdapter
Get IChannel with given channelID.

Specified by:
getChannel in interface IAbstractChannelContainerAdapter
Parameters:
channelID - the ID of the channel to get. Must not be null.
Returns:
IChannel of channel within container with given ID. Returns null if channel not found.

removeChannel

public boolean removeChannel(ID channelID)
Description copied from interface: IAbstractChannelContainerAdapter
Remove channel with given ID. If the channel is found in the container, the enclosing container will call IAbstractChannel.dispose() to dispose the channel before returning from this method.

Specified by:
removeChannel in interface IAbstractChannelContainerAdapter
Parameters:
channelID - the ID of the channel to remove within this container. Must not be null.
Returns:
true if channel found and Removed. False if channel not found within container.

getChannelNamespace

public Namespace getChannelNamespace()
Description copied from interface: IAbstractChannelContainerAdapter
Get expected Namespace for channel ID creation

Specified by:
getChannelNamespace in interface IAbstractChannelContainerAdapter
Returns:
Namespace that can be used to create channel ID instances for this channel container. Will not be null.

addListener

public void addListener(IChannelContainerListener listener)
Description copied from interface: IAbstractChannelContainerAdapter
Add listener for IChannelContainerAdapter events.

Specified by:
addListener in interface IAbstractChannelContainerAdapter
Parameters:
listener - to be added. Must not be null.

removeListener

public void removeListener(IChannelContainerListener listener)
Description copied from interface: IAbstractChannelContainerAdapter
Remove listener for IChannelContainerAdapter events

Specified by:
removeListener in interface IAbstractChannelContainerAdapter
Parameters:
listener - to be removed. Must not be null.

getAdapter

public java.lang.Object getAdapter(java.lang.Class adapter)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class BaseSharedObject