Class SOContainer
- java.lang.Object
- 
- org.eclipse.ecf.core.AbstractContainer
- 
- org.eclipse.ecf.provider.generic.SOContainer
 
 
- 
- All Implemented Interfaces:
- org.eclipse.core.runtime.IAdaptable,- IContainer,- IIdentifiable,- IReliableContainer,- ISharedObjectContainer
 - Direct Known Subclasses:
- ClientSOContainer,- ServerSOContainer
 
 public abstract class SOContainer extends AbstractContainer implements ISharedObjectContainer 
- 
- 
Field SummaryFields Modifier and Type Field Description protected ISharedObjectContainerConfigconfigstatic StringDEFAULT_OBJECT_ARG_KEYstatic StringDEFAULT_OBJECT_ARGTYPES_KEYprotected org.eclipse.ecf.provider.generic.SOContainerGMMgroupManagerprotected booleanisClosingprotected ThreadGrouploadingThreadGroupprotected ISharedObjectPolicypolicyprotected ISynchAsynchEventHandlerreceiverprotected SOManagersharedObjectManagerprotected ISharedObjectMessageSerializersharedObjectMessageSerializerprotected ThreadGroupsharedObjectThreadGroup
 - 
Constructor SummaryConstructors Constructor Description SOContainer(ISharedObjectContainerConfig config)
 - 
Method Summary- 
Methods inherited from class org.eclipse.ecf.core.AbstractContaineraddListener, fireContainerEvent, getPasswordFromConnectContext, removeListener
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.eclipse.ecf.core.IContaineraddListener, removeListener
 
- 
 
- 
- 
- 
Field Detail- 
DEFAULT_OBJECT_ARG_KEYpublic static final String DEFAULT_OBJECT_ARG_KEY 
 - 
DEFAULT_OBJECT_ARGTYPES_KEYpublic static final String DEFAULT_OBJECT_ARGTYPES_KEY 
 - 
configprotected ISharedObjectContainerConfig config 
 - 
groupManagerprotected org.eclipse.ecf.provider.generic.SOContainerGMM groupManager 
 - 
isClosingprotected boolean isClosing 
 - 
loadingThreadGroupprotected ThreadGroup loadingThreadGroup 
 - 
sharedObjectManagerprotected SOManager sharedObjectManager 
 - 
policyprotected ISharedObjectPolicy policy 
 - 
sharedObjectThreadGroupprotected ThreadGroup sharedObjectThreadGroup 
 - 
sharedObjectMessageSerializerprotected ISharedObjectMessageSerializer sharedObjectMessageSerializer - Since:
- 2.0
 
 - 
receiverprotected ISynchAsynchEventHandler receiver 
 
- 
 - 
Constructor Detail- 
SOContainerpublic SOContainer(ISharedObjectContainerConfig config) 
 
- 
 - 
Method Detail- 
setSharedObjectMessageSerializerpublic void setSharedObjectMessageSerializer(ISharedObjectMessageSerializer serializer) Description copied from interface:ISharedObjectContainerSet the shared object message serializer. The serializer should not be null.Note that users of this method should guarantee that their are not pending messages to be sent/received...typically by only calling this method prior to connecting/being connected to from remote containers. Note also that the serializer must perform well when it's methods are called, to prevent negatively impacting overall container messaging performance. - Specified by:
- setSharedObjectMessageSerializerin interface- ISharedObjectContainer
- Since:
- 2.0
 
 - 
getSharedObjectMessageSerializerprotected ISharedObjectMessageSerializer getSharedObjectMessageSerializer() - Returns:
- ISharedObjectMessageSerializer the shared object message serializer
- Since:
- 2.0
 
 - 
getIDpublic ID getID() Description copied from interface:IIdentifiableReturn the ID for this 'identifiable' object. The returned ID should be unique within its namespace. May returnnull.- Specified by:
- getIDin interface- IIdentifiable
- Returns:
- the ID for this identifiable object.  May return null.
 
 - 
connectpublic abstract void connect(ID groupID, IConnectContext connectContext) throws ContainerConnectException Description copied from interface:IContainerConnect to a target remote process or process group. The target identified by the first parameter (targetID) is connected the implementation class. If authentication information is required, the required information is given via via the second parameter (connectContext). Callers note that depending upon the provider implementation this method may block. It is suggested that callers use a separate thread to call this method. This method provides an implementation independent way for container implementations to connect, authenticate, and communicate with a remote service or group of services. Providers are responsible for implementing this operation in a way appropriate to the given remote service (or group) via expected protocol.- Specified by:
- connectin interface- IContainer
- Parameters:
- groupID- the ID of the remote server or group to connect to. See- IContainer.getConnectNamespace()for a explanation of the constraints upon this parameter.
- connectContext- any required context to allow this container to authenticate. May be- nullif underlying provider does not have any authentication requirements for connection.
- Throws:
- 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.
 
 - 
getConnectedIDpublic abstract ID getConnectedID() Description copied from interface:IContainerGet the target ID that this container instance has connected to. Returns null if not connected.- Specified by:
- getConnectedIDin interface- IContainer
- Returns:
- ID of the target we are connected to. Returns nullif container not connected.
 
 - 
disconnectpublic abstract void disconnect() Description copied from interface:IContainerDisconnect. This operation will disconnect the local container instance from any previously joined target or group. Subsequent calls to getConnectedID() will returnnull.- Specified by:
- disconnectin interface- IContainer
 
 - 
getConnectNamespacepublic Namespace getConnectNamespace() Description copied from interface:IContainerGet the Namespace for creating a targetID suitable for use as the first parameter in subsequent calls toIContainer.connect(ID, IConnectContext). If this method returnsnull, then it means thatnullis expected as a valid parameter in subsequent calls toIContainer.connect(ID, IConnectContext). If this method returns a non-nullNamespace, then thetargetIDparameter inIContainer.connect(ID, IConnectContext)must be non-nullinstance created of the returned Namespace.- Specified by:
- getConnectNamespacein interface- IContainer
- Returns:
- Namespace the namespace associated with subsequent calls to
         IContainer.connect(ID, IConnectContext). Ifnull, then thetargetIDinstances passed toIContainer.connect(ID, IConnectContext)may benull. If notnull, thentargetIDinstances passed toIContainer.connect(ID, IConnectContext)must be instances of the returned Namespace.
 
 - 
disposepublic 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 interface- IContainer
- Overrides:
- disposein class- AbstractContainer
 
 - 
getAdapterpublic Object getAdapter(Class adapter) 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 interface- org.eclipse.core.runtime.IAdaptable
- Specified by:
- getAdapterin interface- IContainer
- Overrides:
- getAdapterin class- AbstractContainer
- Parameters:
- adapter- 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
 
 - 
getSharedObjectManagerpublic ISharedObjectManager getSharedObjectManager() Description copied from interface:ISharedObjectContainerGet SharedObjectManager for this container- Specified by:
- getSharedObjectManagerin interface- ISharedObjectContainer
- Returns:
- ISharedObjectManager for this container instance
 
 - 
getGroupMemberIDspublic ID[] getGroupMemberIDs() Description copied from interface:IReliableContainerGet the current membership of the joined group. This method will accurately report the current group membership of the connected group.- Specified by:
- getGroupMemberIDsin interface- IReliableContainer
- Returns:
- ID[] the IDs of the current group membership
 
 - 
getConfigpublic ISharedObjectContainerConfig getConfig() 
 - 
isGroupManagerpublic abstract boolean isGroupManager() - Specified by:
- isGroupManagerin interface- IReliableContainer
- Returns:
- true if this IReliableContainer instance is in the 'manager' role for the group, false otherwise.
 
 - 
setRemoteAddPolicyprotected void setRemoteAddPolicy(ISharedObjectPolicy policy) 
 - 
addSharedObject0protected ISharedObjectContainerTransaction addSharedObject0(ID id, ISharedObject s, Map props) throws Exception - Throws:
- Exception
 
 - 
addSharedObjectAndWaitprotected void addSharedObjectAndWait(ID id, ISharedObject s, Map properties) throws Exception - Throws:
- Exception
 
 - 
addSharedObjectWrapperprotected ISharedObjectContainerTransaction addSharedObjectWrapper(SOWrapper wrapper) throws Exception - Throws:
- Exception
 
 - 
addToLoadingprotected boolean addToLoading(org.eclipse.ecf.provider.generic.SOContainer.LoadingSharedObject lso) 
 - 
checkRemoteCreateprotected Object checkRemoteCreate(ID fromID, ID toID, ReplicaSharedObjectDescription desc) throws Exception Check remote creation of shared objects. This method is called by the remote shared object creation message handler, to verify that the shared object from container 'fromID' to container 'toID' with description 'desc' is to be allowed to be created within the current container. If this method throws, a failure (and exception will be sent back to caller If this method returns null, the create message is ignored. If this method returns a non-null object, the creation is allowed to proceed. The default implementation is to return a non-null object- Parameters:
- fromID- the ID of the container sending us this create request
- toID- the ID (or null) of the container intended to receive this request
- desc- the SharedObjectDescription that describes the shared object to be created
- Returns:
- Object null if the create message is to be ignored, non-null if the creation should continue
- Throws:
- Exception- may throw any Exception to communicate back (via sendCreateResponse) to the sender that the creation has failed
 
 - 
debugprotected void debug(String msg) 
 - 
destroySharedObjectprotected boolean destroySharedObject(ID sharedObjectID) 
 - 
forwardprotected final void forward(ID fromID, ID toID, ContainerMessage data) throws IOException - Throws:
- IOException
 
 - 
forwardExcludingprotected abstract void forwardExcluding(ID from, ID excluding, ContainerMessage data) throws IOException - Throws:
- IOException
 
 - 
forwardToRemoteprotected abstract void forwardToRemote(ID from, ID to, ContainerMessage data) throws IOException - Throws:
- IOException
 
 - 
getArgsFromPropertiesprotected Object[] getArgsFromProperties(SharedObjectDescription sd) - Parameters:
- sd- shared object description
- Returns:
- Object[] arguments from the shared object description properties
 
 - 
getArgTypesFromPropertiesprotected String[] getArgTypesFromProperties(SharedObjectDescription sd) - Parameters:
- sd- shared object description
- Returns:
- String[] arguments types from shared object description properties
 
 - 
serializepublic static byte[] serialize(Serializable obj) throws IOException - Throws:
- IOException
 
 - 
getClassLoaderForContainerprotected ClassLoader getClassLoaderForContainer() 
 - 
getClassLoaderForSharedObjectprotected ClassLoader getClassLoaderForSharedObject(SharedObjectDescription sd) - Parameters:
- sd- shared object description
- Returns:
- ClassLoader classloader to used for given shared object description
 
 - 
getGroupMembershipLockprotected Object getGroupMembershipLock() 
 - 
getMaxGroupMembersprotected int getMaxGroupMembers() 
 - 
getNewSharedObjectThreadprotected Thread getNewSharedObjectThread(ID sharedObjectID, Runnable runnable) 
 - 
getNextSequenceNumberprotected long getNextSequenceNumber() 
 - 
deserializeContainerMessagepublic static ContainerMessage deserializeContainerMessage(byte[] bytes) throws IOException - Throws:
- IOException
 
 - 
printToSystemErrorprotected static void printToSystemError(String message, Throwable t) - Parameters:
- message- message
- t- exception to print to system error
- Since:
- 2.0
 
 - 
getOtherMemberIDsprotected ID[] getOtherMemberIDs() 
 - 
getReceiverprotected ISynchAsynchEventHandler getReceiver() 
 - 
getMessageReceiverpublic ISynchAsynchEventHandler getMessageReceiver() - Returns:
- ISynchAsyncEventHandler message receiver
- Since:
- 4.7
 
 - 
getSharedObjectprotected ISharedObject getSharedObject(ID id) 
 - 
getSharedObjectIDsprotected ID[] getSharedObjectIDs() 
 - 
handleAsynchIOExceptionprotected void handleAsynchIOException(IOException except, AsynchEvent e) 
 - 
handleCreateMessageprotected void handleCreateMessage(ContainerMessage mess) throws IOException - Throws:
- IOException
 
 - 
handleCreateResponseMessageprotected void handleCreateResponseMessage(ContainerMessage mess) throws IOException - Throws:
- IOException
 
 - 
handleLeaveGroupMessageprotected abstract void handleLeaveGroupMessage(ContainerMessage mess) - Parameters:
- mess- leave group message
 
 - 
verifySharedObjectMessageTargetprotected boolean verifySharedObjectMessageTarget(ID containerID) - Parameters:
- containerID- containerID
- Returns:
- boolean true if verified, false otherwise
- Since:
- 4.0
 
 - 
handleSharedObjectDisposeMessageprotected void handleSharedObjectDisposeMessage(ContainerMessage mess) throws IOException - Throws:
- IOException
 
 - 
verifyToIDForSharedObjectMessageprotected boolean verifyToIDForSharedObjectMessage(ID toID) 
 - 
handleSharedObjectMessageprotected void handleSharedObjectMessage(ContainerMessage mess) throws IOException - Throws:
- IOException
 
 - 
handleUndeliveredSharedObjectMessageprotected void handleUndeliveredSharedObjectMessage(ContainerMessage.SharedObjectMessage resp) - Parameters:
- resp- response message
- Since:
- 4.0
 
 - 
handleUnidentifiedMessageprotected void handleUnidentifiedMessage(ContainerMessage mess) throws IOException - Parameters:
- mess- message
- Throws:
- IOException- not thrown by this implementation.
 
 - 
handleViewChangeMessageprotected abstract void handleViewChangeMessage(ContainerMessage mess) throws IOException - Throws:
- IOException
 
 - 
isClosingprotected boolean isClosing() 
 - 
disconnectprotected void disconnect(IConnection conn) 
 - 
loadprotected ISharedObject load(SharedObjectDescription sd) throws Exception - Throws:
- Exception
 
 - 
createSharedObjectConfigprotected SOConfig createSharedObjectConfig(ID id, ISharedObject obj, Map props) throws ECFException - Parameters:
- id- id
- obj- obj
- props- props
- Returns:
- SOConfig a non-nullinstance.
- Throws:
- ECFException- not thrown by this implementation.
 
 - 
createRemoteSharedObjectConfigprotected SOConfig createRemoteSharedObjectConfig(ID fromID, ReplicaSharedObjectDescription sd, ISharedObject obj) 
 - 
createSharedObjectContextprotected SOContext createSharedObjectContext(SOConfig soconfig, IQueueEnqueue queue) 
 - 
createRemoteSharedObjectContextprotected SOContext createRemoteSharedObjectContext(SOConfig soconfig, IQueueEnqueue queue) 
 - 
createSharedObjectWrapperprotected SOWrapper createSharedObjectWrapper(ID id, ISharedObject s, Map props) throws ECFException - Throws:
- ECFException
 
 - 
createRemoteSharedObjectWrapperprotected SOWrapper createRemoteSharedObjectWrapper(ID fromID, ReplicaSharedObjectDescription sd, ISharedObject s) 
 - 
handleLeaveprotected void handleLeave(ID leftID, IConnection conn) 
 - 
moveFromLoadingToActiveprotected void moveFromLoadingToActive(SOWrapper wrap) 
 - 
notifySharedObjectActivatedprotected void notifySharedObjectActivated(ID sharedObjectID) 
 - 
notifySharedObjectDeactivatedprotected void notifySharedObjectDeactivated(ID sharedObjectID) 
 - 
validateContainerMessageprotected ContainerMessage validateContainerMessage(Object mess) 
 - 
processAsynchprotected void processAsynch(AsynchEvent event) throws IOException - Parameters:
- event- event
- Throws:
- IOException- not thrown by this implementation.
 
 - 
getIDForConnectionprotected abstract ID getIDForConnection(IAsynchConnection connection) 
 - 
processDisconnectprotected abstract void processDisconnect(DisconnectEvent event) 
 - 
processSynchprotected Serializable processSynch(SynchEvent e) throws IOException - Throws:
- IOException
 
 - 
queueContainerMessageprotected abstract void queueContainerMessage(ContainerMessage mess) throws IOException - Throws:
- IOException
 
 - 
removeFromLoadingprotected void removeFromLoading(ID id) 
 - 
removeRemoteMemberprotected boolean removeRemoteMember(ID remoteMember) 
 - 
removeSharedObjectprotected ISharedObject removeSharedObject(ID id) 
 - 
sendCreateprotected void sendCreate(ID sharedObjectID, ID toContainerID, SharedObjectDescription sd) throws IOException - Throws:
- IOException
 
 - 
sendCreateResponseprotected void sendCreateResponse(ID homeID, ID sharedObjectID, Throwable t, long identifier) throws IOException - Throws:
- IOException
 
 - 
sendCreateResponseSharedObjectMessageprotected void sendCreateResponseSharedObjectMessage(ID toContainerID, ID fromSharedObject, Throwable t, long ident) throws IOException - Throws:
- IOException
 
 - 
sendCreateSharedObjectMessageprotected ID[] sendCreateSharedObjectMessage(ID toContainerID, SharedObjectDescription sd) throws IOException - Throws:
- IOException
 
 - 
createContainerPropertiesForSharedObjectprotected Map createContainerPropertiesForSharedObject(ID sharedObjectID) 
 - 
sendDisposeprotected void sendDispose(ID toContainerID, ID sharedObjectID) throws IOException - Throws:
- IOException
 
 - 
sendDisposeSharedObjectMessageprotected void sendDisposeSharedObjectMessage(ID toContainerID, ID fromSharedObject) throws IOException - Throws:
- IOException
 
 - 
sendMessageprotected void sendMessage(ContainerMessage data) throws IOException - Throws:
- IOException
 
 - 
serializeSharedObjectMessageprotected byte[] serializeSharedObjectMessage(ID sharedObjectID, Object message) throws IOException - Throws:
- IOException
 
 - 
defaultSerializeSharedObjectMessageprotected byte[] defaultSerializeSharedObjectMessage(ID sharedObjectID, Object message) throws IOException - Parameters:
- sharedObjectID- shared object ID
- message- message
- Returns:
- byte[] serialized message
- Throws:
- IOException- if some problem serializing
- Since:
- 2.0
 
 - 
defaultDeserializeSharedObjectMessageprotected Object defaultDeserializeSharedObjectMessage(byte[] bytes) throws IOException, ClassNotFoundException - Parameters:
- bytes- data to deserialized
- Returns:
- Object the deserialized shared object message
- Throws:
- IOException- if deserialization cannot be done
- ClassNotFoundException- if deserialization cannot be done
- Since:
- 2.0
 
 - 
deserializeSharedObjectMessageprotected Object deserializeSharedObjectMessage(byte[] bytes) throws IOException, ClassNotFoundException - Throws:
- IOException
- ClassNotFoundException
 
 - 
sendMessageprotected void sendMessage(ID toContainerID, ID sharedObjectID, Object message) throws IOException - Throws:
- IOException
 
 - 
sendSharedObjectMessageprotected void sendSharedObjectMessage(ID toContainerID, ID fromSharedObject, Serializable data) throws IOException - Throws:
- IOException
 
 - 
setMaxGroupMembersprotected void setMaxGroupMembers(int max) 
 - 
fireDelegateContainerEventprotected void fireDelegateContainerEvent(IContainerEvent containerEvent) - Parameters:
- containerEvent- container event
 
 
- 
 
-