Package org.eclipse.ecf.provider.generic

# Class SOContext

java.lang.Object
org.eclipse.ecf.provider.generic.SOContext

All Implemented Interfaces:
  `org.eclipse.core.runtime.IAdaptable`, `ISharedObjectContext`

public class SOContext extends Object implements ISharedObjectContext

## Field Summary

Fields
Modifier and Type
Field
Description
`protected SOContainer`
`container`
`protected ID`
`homeContainerID`
`protected boolean`
`isActive`
`protected Map`
`properties`
`protected IQueueEnqueue`
`queue`
`protected ID`
`sharedObjectID`

## Constructor Summary

Constructors
Constructor
Description
`SOContext(ID objID, ID homeID, SOContainer cont, Map props, IQueueEnqueue queue)`

## Method Summary

Modifier and Type
Method
Description
`void`
`connect(ID groupID, IConnectContext joinContext)`
(non-Javadoc)
`void`
`disconnect()`
(non-Javadoc)
`Object`
`getAdapter(Class clazz)`
`ID`
`getConnectedID()`
(non-Javadoc)
`Namespace`
`getConnectNamespace()`
Get the Namespace instance that defines the ID type expected by the remote target container
`ID[]`
`getGroupMemberIDs()`
(non-Javadoc)
`ID`
`getLocalContainerID()`
Get the local container instance's ID
`Map`
`getLocalContainerProperties()`
Get local container properties that it wishes to expose to shared object access
`IQueueEnqueue`
`getQueue()`
Get the IQueueEnqueue instance associated with this ISharedObject.
`ISharedObjectManager`
`getSharedObjectManager()`
Get the ISharedObjectManager for this context
`boolean`
`isActive()`
`boolean`
`isGroupManager()`
(non-Javadoc)
`boolean`
`isGroupServer()`
`protected boolean`
`isInactive()`
`protected void`
`makeInactive()`
`void`
`sendCreate(ID toContainerID, ReplicaSharedObjectDescription sd)`
Send message to create a remote instance of an ISharedObject with the same ID as this instance.
`void`
`sendCreateResponse(ID toContainerID, Throwable throwable, long identifier)`
Send create response back to an ISharedObject with the same ID as this instance.
`void`
`sendDispose(ID toContainerID)`
Send message to dispose of a remote instance of the ISharedObject with same ID as this instance.
`void`
`sendMessage(ID toContainerID, Object data)`
Send arbitrary message to remote instance of the ISharedObject with same ID as this instance.
`protected void`
`trace(String msg)`
`protected void`
`traceStack(String msg, Throwable e)`

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

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

## Field Details

### container

protected SOContainer container

### sharedObjectID

protected ID sharedObjectID

### homeContainerID

protected ID homeContainerID

### isActive

protected boolean isActive

### properties

protected Map properties

### queue

protected IQueueEnqueue queue

## Constructor Details

### SOContext

public SOContext(ID objID, ID homeID, SOContainer cont, Map props, IQueueEnqueue queue)

## Method Details

### isActive

public boolean isActive()

Specified by:
  `isActive` in interface `ISharedObjectContext`

### trace

protected void trace(String msg)

### traceStack

protected void traceStack(String msg, Throwable e)

### makeInactive

protected void makeInactive()

### isInactive

protected boolean isInactive()

### getLocalContainerID

public ID getLocalContainerID()
Description copied from interface: `ISharedObjectContext`
Get the local container instance's ID

Specified by:
  `getLocalContainerID` in interface `ISharedObjectContext`
Returns:
  the ID of the enclosing container

### getSharedObjectManager

public ISharedObjectManager getSharedObjectManager()
Description copied from interface: `ISharedObjectContext`
Get the ISharedObjectManager for this context

Specified by:
  `getSharedObjectManager` in interface `ISharedObjectContext`
Returns:
  ISharedObjectManager the shared object manager instance for this container. Null if none available.

### getQueue

public IQueueEnqueue getQueue()
Description copied from interface: `ISharedObjectContext`
Get the IQueueEnqueue instance associated with this ISharedObject. If the given container provides a queue for this ISharedObject, this method will return a IQueueEnqueue reference to the appropriate queue.

Specified by:
  `getQueue` in interface `ISharedObjectContext`
Returns:
  IQueueEnqueue instance if an active queue is associated with this ISharedObject. If no active queue is associated with the ISharedObject, returns null.

### connect

public void connect(ID groupID, IConnectContext joinContext) throws ContainerConnectException
Description copied from interface: `ISharedObjectContext`
(non-Javadoc)

Specified by:
  `connect` in interface `ISharedObjectContext`
Throws:
  `ContainerConnectException`
See Also:
  - `IContainer.connect(ID,IConnectContext)`

### disconnect

public void disconnect()
Description copied from interface: `ISharedObjectContext`
(non-Javadoc)

Specified by:
  `disconnect` in interface `ISharedObjectContext`
See Also:
  - `IContainer.disconnect()`

### getConnectedID

public ID getConnectedID()
Description copied from interface: `ISharedObjectContext`
(non-Javadoc)

Specified by:
  `getConnectedID` in interface `ISharedObjectContext`
See Also:
  - `IContainer.getConnectedID()`

### isGroupManager

public boolean isGroupManager()
Description copied from interface: `ISharedObjectContext`
(non-Javadoc)

Specified by:
  `isGroupManager` in interface `ISharedObjectContext`
See Also:
  - `IReliableContainer.isGroupManager()`

### isGroupServer

public boolean isGroupServer()

### getGroupMemberIDs

public ID[] getGroupMemberIDs()
Description copied from interface: `ISharedObjectContext`
(non-Javadoc)

Specified by:
  `getGroupMemberIDs` in interface `ISharedObjectContext`
See Also:
  - `IReliableContainer.getGroupMemberIDs()`

### sendCreate

public void sendCreate(ID toContainerID, ReplicaSharedObjectDescription sd) throws IOException
Description copied from interface: `ISharedObjectContext`
Send message to create a remote instance of an ISharedObject with the same ID as this instance. This method allows ISharedObject instances (with a reference to a valid ISharedObjectContext) to send messages to remote containers asking them to create an instance of a new ISharedObject. The given ReplicaSharedObjectDescription provides the specification of the new object.

Specified by:
  `sendCreate` in interface `ISharedObjectContext`
Parameters:
  `toContainerID` - the ID of the remote that is the target of the create request. If this parameter is null, the request is assumed to be made of all currently in the given group (excepting the local container).
  `sd` - the ReplicaSharedObjectDescription describing the class, constructor and other properties to be associated with the new instance
Throws:
  `IOException` - thrown if message cannot be sent by container

### sendCreateResponse

public void sendCreateResponse(ID toContainerID, Throwable throwable, long identifier) throws IOException
Description copied from interface: `ISharedObjectContext`
Send create response back to an ISharedObject with the same ID as this instance. This method allows ISharedObject instances (with a reference to a valid ISharedObjectContext) to send messages to remote containers asking them to deliver the create response status back to the ISharedObject.

Specified by:
  `sendCreateResponse` in interface `ISharedObjectContext`
Parameters:
  `toContainerID` - the ID of the target that is to receive this response
  `throwable` - a throwable associated with the creation. Null means that no exception occurred
  `identifier` - the identifier used in the original create message (in the shared object description)
Throws:
  `IOException` - thrown if the create response cannot be sent

### sendDispose

public void sendDispose(ID toContainerID) throws IOException
Description copied from interface: `ISharedObjectContext`
Send message to dispose of a remote instance of the ISharedObject with same ID as this instance. This method allows ISharedObject instances to control the destruction of remote replicas.

Specified by:
  `sendDispose` in interface `ISharedObjectContext`
Parameters:
  `toContainerID` - the ID of the remote that is the target of the dispose request. If this parameter is null, the request is assumed to be made of all remotes currently in the given group (excepting the local container).
Throws:
  `IOException` - thrown if message cannot be sent by container, or if data cannot be serialized

### sendMessage

public void sendMessage(ID toContainerID, Object data) throws IOException
Description copied from interface: `ISharedObjectContext`
Send arbitrary message to remote instance of the ISharedObject with same ID as this instance. This method allows ISharedObject instances to send arbitrary data to one or more remote replicas of this ISharedObject.

Specified by:
  `sendMessage` in interface `ISharedObjectContext`
Parameters:
  `toContainerID` - the ID of the remote that is the target for the sendMessage. If this parameter is null, the message is sent to the entire group membership all remote containers currently in the given group (excepting the local container).
  `data` - arbitrary message object. The allowable types of this parameter are dependent upon the type of the underlying implementing container
Throws:
  `IOException` - thrown if message cannot be sent by container, or if data cannot be serialized

### getAdapter

public Object getAdapter(Class clazz)

Specified by:
  `getAdapter` in interface `org.eclipse.core.runtime.IAdaptable`

### getConnectNamespace

public Namespace getConnectNamespace()
Description copied from interface: `ISharedObjectContext`
Get the Namespace instance that defines the ID type expected by the remote target container

Specified by:
  `getConnectNamespace` in interface `ISharedObjectContext`
Returns:
  Namespace the namespace by the target for a call to connect(). Null if container namespace no longer available

### getLocalContainerProperties

public Map getLocalContainerProperties()
Description copied from interface: `ISharedObjectContext`
Get local container properties that it wishes to expose to shared object access

Specified by:
  `getLocalContainerProperties` in interface `ISharedObjectContext`
Returns:
  Map of properties available to calling shared object. Map returned must not be null.