org.eclipse.ecf.provider.generic
Class SOManager

java.lang.Object
  extended by org.eclipse.ecf.provider.generic.SOManager
All Implemented Interfaces:
ISharedObjectManager

public class SOManager
extends java.lang.Object
implements ISharedObjectManager


Constructor Summary
SOManager(SOContainer cont)
           
 
Method Summary
protected  void addConnector(ISharedObjectConnector conn)
           
 ID addSharedObject(ID sharedObjectID, ISharedObject sharedObject, java.util.Map properties)
          Add an ISharedObject to this container.
 ISharedObjectConnector connectSharedObjects(ID sharedObjectFrom, ID[] sharedObjectsTo)
          Create an ISharedObjectConnector instance for sending messages from a single ISharedObject to one or more receiver ISharedObjects.
protected  ID createNewSharedObjectID(SharedObjectDescription sd, ISharedObject newObject)
           
 ID createSharedObject(SharedObjectDescription sd)
          Create a new ISharedObject within this container from the given SharedObjectDescription.
protected  ISharedObject createSharedObjectInstance(java.lang.Class newClass, java.lang.Class[] argTypes, java.lang.Object[] args)
           
protected  void debug(java.lang.String msg)
           
 void disconnectSharedObjects(ISharedObjectConnector connector)
          Destroy an ISharedObjectConnector instance.
protected  void dispose()
           
protected  java.lang.Class[] getArgTypes(java.lang.String[] argTypes, java.lang.Object[] args, java.lang.ClassLoader cl)
           
static java.lang.Class[] getClassesForTypes(java.lang.String[] argTypes, java.lang.Object[] args, java.lang.ClassLoader cl)
           
protected  java.util.List getConnectors()
           
 ISharedObject getSharedObject(ID sharedObjectID)
          Get the ISharedObject instance corresponding to the given sharedObjectID.
 java.util.List getSharedObjectConnectors(ID sharedObjectFrom)
          Get the sharedObjectConnectors associated with the given sharedObjectID
 ID[] getSharedObjectIDs()
          Get the array of SharedObject instances currently contained by this ISharedObjectContainer
protected  ISharedObject loadSharedObject(SharedObjectDescription sd)
           
protected  boolean removeConnector(ISharedObjectConnector conn)
           
 ISharedObject removeSharedObject(ID sharedObjectID)
          Remove the given sharedObjectID from this ISharedObjectContainer.
 void setRemoteAddPolicy(ISharedObjectPolicy policy)
          Set this shared object manager's policy for adding remote shared objects.
protected  void traceStack(java.lang.String msg, java.lang.Throwable e)
           
protected  ISharedObject verifySharedObject(java.lang.Object newSharedObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SOManager

public SOManager(SOContainer cont)
Method Detail

debug

protected void debug(java.lang.String msg)

traceStack

protected void traceStack(java.lang.String msg,
                          java.lang.Throwable e)

addConnector

protected void addConnector(ISharedObjectConnector conn)

removeConnector

protected boolean removeConnector(ISharedObjectConnector conn)

getConnectors

protected java.util.List getConnectors()

getArgTypes

protected java.lang.Class[] getArgTypes(java.lang.String[] argTypes,
                                        java.lang.Object[] args,
                                        java.lang.ClassLoader cl)
                                 throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

createSharedObjectInstance

protected ISharedObject createSharedObjectInstance(java.lang.Class newClass,
                                                   java.lang.Class[] argTypes,
                                                   java.lang.Object[] args)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

verifySharedObject

protected ISharedObject verifySharedObject(java.lang.Object newSharedObject)

loadSharedObject

protected ISharedObject loadSharedObject(SharedObjectDescription sd)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

getSharedObjectIDs

public ID[] getSharedObjectIDs()
Description copied from interface: ISharedObjectManager
Get the array of SharedObject instances currently contained by this ISharedObjectContainer

Specified by:
getSharedObjectIDs in interface ISharedObjectManager
Returns:
ID[] the IDs of currently contained ISharedObject instances

createSharedObject

public ID createSharedObject(SharedObjectDescription sd)
                      throws SharedObjectCreateException
Description copied from interface: ISharedObjectManager
Create a new ISharedObject within this container from the given SharedObjectDescription.

Specified by:
createSharedObject in interface ISharedObjectManager
Parameters:
sd - the SharedObjectDescription that describes the SharedObject to be created
Returns:
ID the sharedObjectID of the added ISharedObject
Throws:
SharedObjectCreateException - if the SharedObject cannot be created

createNewSharedObjectID

protected ID createNewSharedObjectID(SharedObjectDescription sd,
                                     ISharedObject newObject)
                              throws IDCreateException
Throws:
IDCreateException

addSharedObject

public ID addSharedObject(ID sharedObjectID,
                          ISharedObject sharedObject,
                          java.util.Map properties)
                   throws SharedObjectAddException
Description copied from interface: ISharedObjectManager
Add an ISharedObject to this container.

Specified by:
addSharedObject in interface ISharedObjectManager
Parameters:
sharedObjectID - the ID of new SharedObject
sharedObject - the ISharedObject instance to add
properties - the Map associated with the added ISharedObject
Returns:
ID the sharedObjectID of the added ISharedObject
Throws:
SharedObjectAddException - if the add cannot be accomplished for any reason

getSharedObject

public ISharedObject getSharedObject(ID sharedObjectID)
Description copied from interface: ISharedObjectManager
Get the ISharedObject instance corresponding to the given sharedObjectID.

Specified by:
getSharedObject in interface ISharedObjectManager
Parameters:
sharedObjectID - of the desired ISharedObject
Returns:
ISharedObject found. Return null if ISharedObject not found.

removeSharedObject

public ISharedObject removeSharedObject(ID sharedObjectID)
Description copied from interface: ISharedObjectManager
Remove the given sharedObjectID from this ISharedObjectContainer.

Specified by:
removeSharedObject in interface ISharedObjectManager
Parameters:
sharedObjectID - the ID of the ISharedObject to remove
Returns:
ISharedObject removed. Returns null if ISharedObject not found

connectSharedObjects

public ISharedObjectConnector connectSharedObjects(ID sharedObjectFrom,
                                                   ID[] sharedObjectsTo)
                                            throws SharedObjectConnectException
Description copied from interface: ISharedObjectManager
Create an ISharedObjectConnector instance for sending messages from a single ISharedObject to one or more receiver ISharedObjects. All specified ISharedObject instances must be contained by this ISharedObjectContainer.

Specified by:
connectSharedObjects in interface ISharedObjectManager
Parameters:
sharedObjectFrom - the ID of the sender ISharedObject
sharedObjectsTo - the ID[] of the receiver ISharedObjects
Returns:
a valid instance of ISharedObjectConnector. Null if no connector can be made
Throws:
SharedObjectConnectException - thrown if specified sender or receivers do not exist within the context of this container

disconnectSharedObjects

public void disconnectSharedObjects(ISharedObjectConnector connector)
                             throws SharedObjectDisconnectException
Description copied from interface: ISharedObjectManager
Destroy an ISharedObjectConnector instance.

Specified by:
disconnectSharedObjects in interface ISharedObjectManager
Parameters:
connector - the connector previously created via connectSharedObjects
Throws:
SharedObjectDisconnectException - thrown if specified connector does not exist in the context of this container

dispose

protected void dispose()

getSharedObjectConnectors

public java.util.List getSharedObjectConnectors(ID sharedObjectFrom)
Description copied from interface: ISharedObjectManager
Get the sharedObjectConnectors associated with the given sharedObjectID

Specified by:
getSharedObjectConnectors in interface ISharedObjectManager
Returns:
List of ISharedObjectConnector instances

getClassesForTypes

public static java.lang.Class[] getClassesForTypes(java.lang.String[] argTypes,
                                                   java.lang.Object[] args,
                                                   java.lang.ClassLoader cl)
                                            throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

setRemoteAddPolicy

public void setRemoteAddPolicy(ISharedObjectPolicy policy)
Description copied from interface: ISharedObjectManager
Set this shared object manager's policy for adding remote shared objects.

Specified by:
setRemoteAddPolicy in interface ISharedObjectManager
Parameters:
policy - the ISharedObjectPolicy instance to use to check the validity of remote requests to add/replicate a shared object into this container