org.eclipse.ecf.provider.generic
Class ClientSOContainer
java.lang.Object
org.eclipse.ecf.core.AbstractContainer
org.eclipse.ecf.provider.generic.SOContainer
org.eclipse.ecf.provider.generic.ClientSOContainer
- All Implemented Interfaces:
- org.eclipse.core.runtime.IAdaptable, IContainer, IIdentifiable, IReliableContainer, ISharedObjectContainer, ISharedObjectContainerClient
- Direct Known Subclasses:
- TCPClientSOContainer, XMPPContainer
public abstract class ClientSOContainer
- extends SOContainer
- implements ISharedObjectContainerClient
Fields inherited from class org.eclipse.ecf.provider.generic.SOContainer |
config, DEFAULT_OBJECT_ARG_KEY, DEFAULT_OBJECT_ARGTYPES_KEY, groupManager, isClosing, loadingThreadGroup, policy, receiver, sharedObjectManager, sharedObjectMessageSerializer, sharedObjectThreadGroup |
Method Summary |
void |
connect(ID targetID,
IConnectContext joinContext)
Connect to a target remote process or process group. |
protected Callback[] |
createAuthorizationCallbacks()
|
protected abstract ISynchAsynchConnection |
createConnection(ID targetID,
java.lang.Object data)
Create connection instance. |
void |
disconnect()
Disconnect. |
protected void |
disconnect(java.lang.Throwable exception)
|
void |
dispose()
Dispose this IContainer instance. |
protected void |
forwardExcluding(ID from,
ID excluding,
byte msg,
java.io.Serializable data)
|
protected void |
forwardExcluding(ID from,
ID excluding,
ContainerMessage data)
|
protected void |
forwardToRemote(ID from,
ID to,
ContainerMessage message)
|
protected java.lang.Object |
getConnectData(ID remote,
IConnectContext joinContext)
|
ID |
getConnectedID()
Get the target ID that this container instance has connected to. |
protected ISynchAsynchConnection |
getConnection()
|
protected org.eclipse.ecf.provider.generic.ClientSOContainer.Lock |
getConnectLock()
|
protected int |
getConnectTimeout()
|
protected ID |
getIDForConnection(IAsynchConnection conn)
|
protected java.io.Serializable |
getLeaveData(ID target)
|
protected ID |
handleConnectResponse(ID orginalTarget,
java.lang.Object serverData)
|
protected void |
handleLeave(ID fromID,
IConnection conn)
|
protected void |
handleLeaveGroupMessage(ContainerMessage mess)
|
protected void |
handleViewChangeMessage(ContainerMessage mess)
|
protected boolean |
isConnected()
|
protected boolean |
isConnecting()
|
boolean |
isGroupManager()
|
protected void |
processAsynch(AsynchEvent evt)
|
protected void |
processDisconnect(DisconnectEvent evt)
|
protected java.io.Serializable |
processSynch(SynchEvent evt)
|
protected void |
queueContainerMessage(ContainerMessage message)
|
protected void |
sendCreate(ID sharedObjectId,
ID toContainerId,
SharedObjectDescription sd)
|
protected ID[] |
sendCreateMsg(ID toID,
SharedObjectDescription createInfo)
|
protected void |
sendCreateResponse(ID homeId,
ID sharedObjectId,
java.lang.Throwable t,
long identifier)
|
protected void |
sendCreateResponseSharedObjectMessage(ID toContainerId,
ID fromSharedObject,
java.lang.Throwable t,
long ident)
|
protected ID[] |
sendCreateSharedObjectMessage(ID toContainerId,
SharedObjectDescription sd)
|
protected void |
sendDispose(ID toContainerId,
ID sharedObjectId)
|
protected void |
sendDisposeSharedObjectMessage(ID toContainerId,
ID fromSharedObject)
|
protected void |
sendMessage(ContainerMessage data)
|
protected void |
sendMessage(ID toContainerId,
ID sharedObjectId,
java.lang.Object message)
|
protected void |
sendSharedObjectMessage(ID toContainerId,
ID fromSharedObject,
java.io.Serializable data)
|
void |
setConnectInitiatorPolicy(IConnectInitiatorPolicy policy)
Set the connect initiator policy handler for authentication policy |
Methods inherited from class org.eclipse.ecf.provider.generic.SOContainer |
addNewRemoteMember, addSharedObject0, addSharedObjectAndWait, addSharedObjectWrapper, addToLoading, checkRemoteCreate, createContainerPropertiesForSharedObject, createRemoteSharedObjectConfig, createRemoteSharedObjectContext, createRemoteSharedObjectWrapper, createSharedObjectConfig, createSharedObjectContext, createSharedObjectWrapper, debug, defaultDeserializeSharedObjectMessage, defaultSerializeSharedObjectMessage, deserializeContainerMessage, deserializeSharedObjectMessage, destroySharedObject, disconnect, fireDelegateContainerEvent, forward, getAdapter, getArgsFromProperties, getArgTypesFromProperties, getClassLoaderForContainer, getClassLoaderForSharedObject, getConfig, getConnectNamespace, getGroupMemberIDs, getGroupMembershipLock, getID, getMaxGroupMembers, getNewSharedObjectThread, getNextSequenceNumber, getOtherMemberIDs, getReceiver, getSharedObject, getSharedObjectIDs, getSharedObjectManager, getSharedObjectMessageSerializer, getSharedObjectWrapper, handleAsynchIOException, handleCreateMessage, handleCreateResponseMessage, handleSharedObjectDisposeMessage, handleSharedObjectMessage, handleUndeliveredSharedObjectMessage, handleUnidentifiedMessage, isClosing, load, moveFromLoadingToActive, notifySharedObjectActivated, notifySharedObjectDeactivated, printToSystemError, removeFromLoading, removeRemoteMember, removeSharedObject, serialize, serializeSharedObjectMessage, setMaxGroupMembers, setRemoteAddPolicy, setSharedObjectMessageSerializer, traceStack, validateContainerMessage, verifySharedObjectMessageTarget, verifyToIDForSharedObjectMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_CONNECT_TIMEOUT
public static final int DEFAULT_CONNECT_TIMEOUT
- See Also:
- Constant Field Values
connection
protected ISynchAsynchConnection connection
remoteServerID
protected ID remoteServerID
connectionState
protected byte connectionState
connectPolicy
protected IConnectInitiatorPolicy connectPolicy
DISCONNECTED
public static final byte DISCONNECTED
- See Also:
- Constant Field Values
CONNECTING
public static final byte CONNECTING
- See Also:
- Constant Field Values
CONNECTED
public static final byte CONNECTED
- See Also:
- Constant Field Values
connectLock
protected org.eclipse.ecf.provider.generic.ClientSOContainer.Lock connectLock
ClientSOContainer
public ClientSOContainer(ISharedObjectContainerConfig config)
getConnectLock
protected org.eclipse.ecf.provider.generic.ClientSOContainer.Lock getConnectLock()
getConnection
protected ISynchAsynchConnection getConnection()
setConnectInitiatorPolicy
public void setConnectInitiatorPolicy(IConnectInitiatorPolicy policy)
- Description copied from interface:
ISharedObjectContainerClient
- Set the connect initiator policy handler for authentication policy
- Specified by:
setConnectInitiatorPolicy
in interface ISharedObjectContainerClient
- Parameters:
policy
- the policy to use
dispose
public void dispose()
- Description copied from interface:
IContainer
- Dispose 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:
dispose
in interface IContainer
- Overrides:
dispose
in class SOContainer
isGroupManager
public final boolean isGroupManager()
- Specified by:
isGroupManager
in interface IReliableContainer
- Specified by:
isGroupManager
in class SOContainer
- Returns:
- true if this IReliableContainer instance is in the 'manager' role
for the group, false otherwise.
getConnectedID
public ID getConnectedID()
- Description copied from interface:
IContainer
- Get the target ID that this container instance has connected to. Returns
null if not connected.
- Specified by:
getConnectedID
in interface IContainer
- Specified by:
getConnectedID
in class SOContainer
- Returns:
- ID of the target we are connected to. Returns
null
if container not connected.
connect
public void connect(ID targetID,
IConnectContext joinContext)
throws ContainerConnectException
- Description copied from interface:
IContainer
- Connect 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:
connect
in interface IContainer
- Specified by:
connect
in class SOContainer
- Parameters:
targetID
- the ID of the remote server or group to connect to. See
IContainer.getConnectNamespace()
for a explanation of the
constraints upon this parameter.joinContext
- any required context to allow this container to authenticate.
May be null
if 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.
createAuthorizationCallbacks
protected Callback[] createAuthorizationCallbacks()
getConnectData
protected java.lang.Object getConnectData(ID remote,
IConnectContext joinContext)
throws java.io.IOException,
UnsupportedCallbackException
- Throws:
java.io.IOException
UnsupportedCallbackException
getConnectTimeout
protected int getConnectTimeout()
handleLeaveGroupMessage
protected void handleLeaveGroupMessage(ContainerMessage mess)
- Specified by:
handleLeaveGroupMessage
in class SOContainer
handleViewChangeMessage
protected void handleViewChangeMessage(ContainerMessage mess)
throws java.io.IOException
- Specified by:
handleViewChangeMessage
in class SOContainer
- Throws:
java.io.IOException
forwardExcluding
protected void forwardExcluding(ID from,
ID excluding,
ContainerMessage data)
throws java.io.IOException
- Specified by:
forwardExcluding
in class SOContainer
- Parameters:
from
- excluding
- data
-
- Throws:
java.io.IOException
- not thrown by this implementation.
getLeaveData
protected java.io.Serializable getLeaveData(ID target)
disconnect
public void disconnect()
- Description copied from interface:
IContainer
- Disconnect. This operation will disconnect the local container instance
from any previously joined target or group. Subsequent calls to
getConnectedID() will return
null
.
- Specified by:
disconnect
in interface IContainer
- Specified by:
disconnect
in class SOContainer
createConnection
protected abstract ISynchAsynchConnection createConnection(ID targetID,
java.lang.Object data)
throws ConnectionCreateException
- Create connection instance. This method is called by
connect(ID, IConnectContext)
. Following
a return from this method, the new ISynchAsynchConnection instance's IConnection.connect(ID, Object, int)
method is subsequently
called.
- Parameters:
targetID
- the targetID to connect to. The value is the same as that passed into connect(ID, IConnectContext)
.data
- and data provided to the connection via the IConnectContext passed into the connect(ID, IConnectContext)
call.
- Returns:
ISynchAsynchConnection
a connection instance. Will not be null
.
- Throws:
ConnectionCreateException
- thrown if the connection cannot be created.
queueContainerMessage
protected void queueContainerMessage(ContainerMessage message)
throws java.io.IOException
- Specified by:
queueContainerMessage
in class SOContainer
- Throws:
java.io.IOException
forwardExcluding
protected void forwardExcluding(ID from,
ID excluding,
byte msg,
java.io.Serializable data)
throws java.io.IOException
- Parameters:
from
- excluding
- msg
- data
-
- Throws:
java.io.IOException
- not thrown by this implementation.
forwardToRemote
protected void forwardToRemote(ID from,
ID to,
ContainerMessage message)
throws java.io.IOException
- Specified by:
forwardToRemote
in class SOContainer
- Parameters:
from
- to
- message
-
- Throws:
java.io.IOException
- not thrown by this implementation.
getIDForConnection
protected ID getIDForConnection(IAsynchConnection conn)
- Specified by:
getIDForConnection
in class SOContainer
handleLeave
protected void handleLeave(ID fromID,
IConnection conn)
- Overrides:
handleLeave
in class SOContainer
sendMessage
protected void sendMessage(ContainerMessage data)
throws java.io.IOException
- Overrides:
sendMessage
in class SOContainer
- Throws:
java.io.IOException
sendCreateMsg
protected ID[] sendCreateMsg(ID toID,
SharedObjectDescription createInfo)
throws java.io.IOException
- Throws:
java.io.IOException
sendCreate
protected void sendCreate(ID sharedObjectId,
ID toContainerId,
SharedObjectDescription sd)
throws java.io.IOException
- Overrides:
sendCreate
in class SOContainer
- Throws:
java.io.IOException
sendCreateResponse
protected void sendCreateResponse(ID homeId,
ID sharedObjectId,
java.lang.Throwable t,
long identifier)
throws java.io.IOException
- Overrides:
sendCreateResponse
in class SOContainer
- Throws:
java.io.IOException
sendCreateResponseSharedObjectMessage
protected void sendCreateResponseSharedObjectMessage(ID toContainerId,
ID fromSharedObject,
java.lang.Throwable t,
long ident)
throws java.io.IOException
- Overrides:
sendCreateResponseSharedObjectMessage
in class SOContainer
- Throws:
java.io.IOException
sendCreateSharedObjectMessage
protected ID[] sendCreateSharedObjectMessage(ID toContainerId,
SharedObjectDescription sd)
throws java.io.IOException
- Overrides:
sendCreateSharedObjectMessage
in class SOContainer
- Throws:
java.io.IOException
sendDispose
protected void sendDispose(ID toContainerId,
ID sharedObjectId)
throws java.io.IOException
- Overrides:
sendDispose
in class SOContainer
- Throws:
java.io.IOException
sendDisposeSharedObjectMessage
protected void sendDisposeSharedObjectMessage(ID toContainerId,
ID fromSharedObject)
throws java.io.IOException
- Overrides:
sendDisposeSharedObjectMessage
in class SOContainer
- Throws:
java.io.IOException
sendMessage
protected void sendMessage(ID toContainerId,
ID sharedObjectId,
java.lang.Object message)
throws java.io.IOException
- Overrides:
sendMessage
in class SOContainer
- Throws:
java.io.IOException
sendSharedObjectMessage
protected void sendSharedObjectMessage(ID toContainerId,
ID fromSharedObject,
java.io.Serializable data)
throws java.io.IOException
- Overrides:
sendSharedObjectMessage
in class SOContainer
- Throws:
java.io.IOException
disconnect
protected void disconnect(java.lang.Throwable exception)
processDisconnect
protected void processDisconnect(DisconnectEvent evt)
- Specified by:
processDisconnect
in class SOContainer
processAsynch
protected void processAsynch(AsynchEvent evt)
throws java.io.IOException
- Overrides:
processAsynch
in class SOContainer
- Throws:
java.io.IOException
- not thrown by this implementation.
processSynch
protected java.io.Serializable processSynch(SynchEvent evt)
throws java.io.IOException
- Overrides:
processSynch
in class SOContainer
- Throws:
java.io.IOException
isConnected
protected boolean isConnected()
isConnecting
protected boolean isConnecting()
handleConnectResponse
protected ID handleConnectResponse(ID orginalTarget,
java.lang.Object serverData)
throws java.lang.Exception
- Throws:
java.lang.Exception