Package org.eclipse.ecf.provider.generic
Class SOManager
- java.lang.Object
-
- org.eclipse.ecf.provider.generic.SOManager
-
- All Implemented Interfaces:
ISharedObjectManager
public class SOManager extends Object implements ISharedObjectManager
-
-
Constructor Summary
Constructors Constructor Description SOManager(SOContainer cont)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addConnector(ISharedObjectConnector conn)
ID
addSharedObject(ID sharedObjectID, ISharedObject sharedObject, 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(Class newClass, Class[] argTypes, Object[] args)
protected void
debug(String msg)
void
disconnectSharedObjects(ISharedObjectConnector connector)
Destroy an ISharedObjectConnector instance.protected void
dispose()
protected Class[]
getArgTypes(String[] argTypes, Object[] args, ClassLoader cl)
static Class[]
getClassesForTypes(String[] argTypes, Object[] args, ClassLoader cl)
protected List
getConnectors()
ISharedObject
getSharedObject(ID sharedObjectID)
Get the ISharedObject instance corresponding to the given sharedObjectID.List
getSharedObjectConnectors(ID sharedObjectFrom)
Get the sharedObjectConnectors associated with the given sharedObjectIDID[]
getSharedObjectIDs()
Get the array of SharedObject instances currently contained by this ISharedObjectContainerprotected 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(String msg, Throwable e)
protected ISharedObject
verifySharedObject(Object newSharedObject)
-
-
-
Constructor Detail
-
SOManager
public SOManager(SOContainer cont)
-
-
Method Detail
-
debug
protected void debug(String msg)
-
addConnector
protected void addConnector(ISharedObjectConnector conn)
-
removeConnector
protected boolean removeConnector(ISharedObjectConnector conn)
-
getConnectors
protected List getConnectors()
-
getArgTypes
protected Class[] getArgTypes(String[] argTypes, Object[] args, ClassLoader cl) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
createSharedObjectInstance
protected ISharedObject createSharedObjectInstance(Class newClass, Class[] argTypes, Object[] args) throws Exception
- Throws:
Exception
-
verifySharedObject
protected ISharedObject verifySharedObject(Object newSharedObject)
-
loadSharedObject
protected ISharedObject loadSharedObject(SharedObjectDescription sd) throws Exception
- Throws:
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 interfaceISharedObjectManager
- 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 interfaceISharedObjectManager
- 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, Map properties) throws SharedObjectAddException
Description copied from interface:ISharedObjectManager
Add an ISharedObject to this container.- Specified by:
addSharedObject
in interfaceISharedObjectManager
- Parameters:
sharedObjectID
- the ID of new SharedObjectsharedObject
- the ISharedObject instance to addproperties
- 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 interfaceISharedObjectManager
- 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 interfaceISharedObjectManager
- 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 interfaceISharedObjectManager
- Parameters:
sharedObjectFrom
- the ID of the sender ISharedObjectsharedObjectsTo
- 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 interfaceISharedObjectManager
- 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 List getSharedObjectConnectors(ID sharedObjectFrom)
Description copied from interface:ISharedObjectManager
Get the sharedObjectConnectors associated with the given sharedObjectID- Specified by:
getSharedObjectConnectors
in interfaceISharedObjectManager
- Returns:
- List of ISharedObjectConnector instances
-
getClassesForTypes
public static Class[] getClassesForTypes(String[] argTypes, Object[] args, ClassLoader cl) throws ClassNotFoundException
- Throws:
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 interfaceISharedObjectManager
- Parameters:
policy
- the ISharedObjectPolicy instance to use to check the validity of remote requests to add/replicate a shared object into this container
-
-