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 voidaddConnector(ISharedObjectConnector conn)IDaddSharedObject(ID sharedObjectID, ISharedObject sharedObject, Map properties)Add an ISharedObject to this container.ISharedObjectConnectorconnectSharedObjects(ID sharedObjectFrom, ID[] sharedObjectsTo)Create an ISharedObjectConnector instance for sending messages from a single ISharedObject to one or more receiver ISharedObjects.protected IDcreateNewSharedObjectID(SharedObjectDescription sd, ISharedObject newObject)IDcreateSharedObject(SharedObjectDescription sd)Create a new ISharedObject within this container from the given SharedObjectDescription.protected ISharedObjectcreateSharedObjectInstance(Class newClass, Class[] argTypes, Object[] args)protected voiddebug(String msg)voiddisconnectSharedObjects(ISharedObjectConnector connector)Destroy an ISharedObjectConnector instance.protected voiddispose()protected Class[]getArgTypes(String[] argTypes, Object[] args, ClassLoader cl)static Class[]getClassesForTypes(String[] argTypes, Object[] args, ClassLoader cl)protected ListgetConnectors()ISharedObjectgetSharedObject(ID sharedObjectID)Get the ISharedObject instance corresponding to the given sharedObjectID.ListgetSharedObjectConnectors(ID sharedObjectFrom)Get the sharedObjectConnectors associated with the given sharedObjectIDID[]getSharedObjectIDs()Get the array of SharedObject instances currently contained by this ISharedObjectContainerprotected ISharedObjectloadSharedObject(SharedObjectDescription sd)protected booleanremoveConnector(ISharedObjectConnector conn)ISharedObjectremoveSharedObject(ID sharedObjectID)Remove the given sharedObjectID from this ISharedObjectContainer.voidsetRemoteAddPolicy(ISharedObjectPolicy policy)Set this shared object manager's policy for adding remote shared objects.protected voidtraceStack(String msg, Throwable e)protected ISharedObjectverifySharedObject(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:ISharedObjectManagerGet the array of SharedObject instances currently contained by this ISharedObjectContainer- Specified by:
getSharedObjectIDsin interfaceISharedObjectManager- Returns:
- ID[] the IDs of currently contained ISharedObject instances
-
createSharedObject
public ID createSharedObject(SharedObjectDescription sd) throws SharedObjectCreateException
Description copied from interface:ISharedObjectManagerCreate a new ISharedObject within this container from the given SharedObjectDescription.- Specified by:
createSharedObjectin 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:ISharedObjectManagerAdd an ISharedObject to this container.- Specified by:
addSharedObjectin 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:ISharedObjectManagerGet the ISharedObject instance corresponding to the given sharedObjectID.- Specified by:
getSharedObjectin 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:ISharedObjectManagerRemove the given sharedObjectID from this ISharedObjectContainer.- Specified by:
removeSharedObjectin 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:ISharedObjectManagerCreate 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:
connectSharedObjectsin 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:ISharedObjectManagerDestroy an ISharedObjectConnector instance.- Specified by:
disconnectSharedObjectsin 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:ISharedObjectManagerGet the sharedObjectConnectors associated with the given sharedObjectID- Specified by:
getSharedObjectConnectorsin 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:ISharedObjectManagerSet this shared object manager's policy for adding remote shared objects.- Specified by:
setRemoteAddPolicyin interfaceISharedObjectManager- Parameters:
policy- the ISharedObjectPolicy instance to use to check the validity of remote requests to add/replicate a shared object into this container
-
-