Package org.eclipse.ecf.core
Class ContainerFactory
- java.lang.Object
- 
- org.eclipse.ecf.core.ContainerFactory
 
- 
- All Implemented Interfaces:
- IContainerFactory,- IContainerManager
 
 public class ContainerFactory extends Object implements IContainerFactory, IContainerManager Factory for creatingIContainerinstances. This class provides ECF clients an entry point to constructingIContainerinstances.
 
 Here is an example use of the ContainerFactory to construct an instance of the 'standalone' container (has no connection to other containers):
 
 IContainer container =For more details on the creation and lifecycle of IContainer instances created via this factory see
 ContainerFactory.getDefault().createContainer("ecf.generic.client");
 ...further use of container here...IContainer.- Since:
- 3.1
- See Also:
- IContainer,- IContainerFactory
 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringBASE_CONTAINER_NAME
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedContainerFactory()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IContaineraddContainer(IContainer container, ContainerTypeDescription typeDescription)Add given container to manager.ContainerTypeDescriptionaddDescription(ContainerTypeDescription containerTypeDescription)Add a ContainerTypeDescription to the set of known ContainerDescriptions.protected ContainerTypeDescriptionaddDescription0(ContainerTypeDescription containerTypeDescription)booleanaddListener(IContainerManagerListener listener)Add listener to thisIContainerManager.booleancontainsDescription(ContainerTypeDescription containerTypeDescription)Check to see if a given named description is already contained by this factoryprotected booleancontainsDescription0(ContainerTypeDescription containerTypeDescription)IContainercreateContainer()Make a base IContainer instance.IContainercreateContainer(String containerTypeDescriptionName)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, Object[] parameters)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, String containerId)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, String containerId, Object[] parameters)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, String containerId, Map parameters)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, Map parameters)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, ID containerID)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, ID containerID, Object[] parameters)Create a new container.IContainercreateContainer(String containerTypeDescriptionName, ID containerID, Map parameters)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, Object[] parameters)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, String containerId)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, String containerId, Object[] parameters)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, String containerId, Map parameters)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, Map parameters)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, ID containerID)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, ID containerID, Object[] parameters)Create a new container.IContainercreateContainer(ContainerTypeDescription containerTypeDescription, ID containerID, Map parameters)Create a new container.IContainercreateContainer(ID containerID)Create a new container.IContainer[]getAllContainers()Get all containers known to this container manager.IContainergetContainer(ID containerID)Get container for given ID.IContainerFactorygetContainerFactory()Get container factory associated with this container manager.ContainerTypeDescriptiongetContainerTypeDescription(ID containerID)Get the container type description used to create the container with the given ID.static IContainerFactorygetDefault()protected ContainerTypeDescriptiongetDescription0(String containerTypeDescriptionName)protected ContainerTypeDescriptiongetDescription0(ContainerTypeDescription containerTypeDescription)ContainerTypeDescriptiongetDescriptionByName(String containerTypeDescriptionName)Get the known ContainerTypeDescription given it's name.ListgetDescriptions()Get a collection of the ContainerDescriptions currently known to this factory.protected ListgetDescriptions0()ContainerTypeDescription[]getDescriptionsForContainerAdapter(Class containerAdapter)Get container type descriptions that support the given containerAdapterbooleanhasContainer(ID containerID)Return true if this container manager has the given container under management, false otherwise.voidremoveAllContainers()Remove all containers from this managerIContainerremoveContainer(IContainer container)Remove given container from manager.IContainerremoveContainer(ID containerID)Remove given container from manager.ContainerTypeDescriptionremoveDescription(ContainerTypeDescription containerTypeDescription)Remove given description from set known to this factory.protected ContainerTypeDescriptionremoveDescription0(ContainerTypeDescription containerTypeDescription)booleanremoveListener(IContainerManagerListener listener)Remove listener from thisIContainerManager.protected voidthrowContainerCreateException(String message, Throwable cause, String method)
 
- 
- 
- 
Field Detail- 
BASE_CONTAINER_NAMEpublic static final String BASE_CONTAINER_NAME - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getDefaultpublic static IContainerFactory getDefault() 
 - 
addDescriptionpublic ContainerTypeDescription addDescription(ContainerTypeDescription containerTypeDescription) Description copied from interface:IContainerFactoryAdd a ContainerTypeDescription to the set of known ContainerDescriptions.- Specified by:
- addDescriptionin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to add to this factory. Must not be- null.
- Returns:
- ContainerTypeDescription the old description of the same name, null if none found
 
 - 
getDescriptionspublic List getDescriptions() Description copied from interface:IContainerFactoryGet a collection of the ContainerDescriptions currently known to this factory. This allows clients to query the factory to determine what if any other ContainerDescriptions are currently registered with the factory, and if so, what they are.- Specified by:
- getDescriptionsin interface- IContainerFactory
- Returns:
- List of ContainerTypeDescription instances
 
 - 
getDescriptions0protected List getDescriptions0() 
 - 
addDescription0protected ContainerTypeDescription addDescription0(ContainerTypeDescription containerTypeDescription) 
 - 
containsDescriptionpublic boolean containsDescription(ContainerTypeDescription containerTypeDescription) Description copied from interface:IContainerFactoryCheck to see if a given named description is already contained by this factory- Specified by:
- containsDescriptionin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to look for
- Returns:
- true if description is already known to factory, false otherwise
 
 - 
containsDescription0protected boolean containsDescription0(ContainerTypeDescription containerTypeDescription) 
 - 
getDescription0protected ContainerTypeDescription getDescription0(ContainerTypeDescription containerTypeDescription) 
 - 
getDescription0protected ContainerTypeDescription getDescription0(String containerTypeDescriptionName) 
 - 
getDescriptionByNamepublic ContainerTypeDescription getDescriptionByName(String containerTypeDescriptionName) Description copied from interface:IContainerFactoryGet the known ContainerTypeDescription given it's name.- Specified by:
- getDescriptionByNamein interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the name to use as key to find ContainerTypeDescription. Must not be- null.
- Returns:
- ContainerTypeDescription found. Null if not found.
 
 - 
removeDescriptionpublic ContainerTypeDescription removeDescription(ContainerTypeDescription containerTypeDescription) Description copied from interface:IContainerFactoryRemove given description from set known to this factory.- Specified by:
- removeDescriptionin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to remove
- Returns:
- the removed ContainerTypeDescription, null if nothing removed
 
 - 
removeDescription0protected ContainerTypeDescription removeDescription0(ContainerTypeDescription containerTypeDescription) 
 - 
getDescriptionsForContainerAdapterpublic ContainerTypeDescription[] getDescriptionsForContainerAdapter(Class containerAdapter) Description copied from interface:IContainerFactoryGet container type descriptions that support the given containerAdapter- Specified by:
- getDescriptionsForContainerAdapterin interface- IContainerFactory
- Parameters:
- containerAdapter- the container adapter. Must not be null.
- Returns:
- ContainerTypeDescription[] of descriptions that support the given container adapter. If no ContainerTypeDescriptions found that support the given adapter, an empty array will be returned.
 
 - 
throwContainerCreateExceptionprotected void throwContainerCreateException(String message, Throwable cause, String method) throws ContainerCreateException - Throws:
- ContainerCreateException
 
 - 
createContainerpublic IContainer createContainer() throws ContainerCreateException Description copied from interface:IContainerFactoryMake a base IContainer instance.- Specified by:
- createContainerin interface- IContainerFactory
- Returns:
- IContainer instance.  A non-nullinstance will be returned.
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(ID containerID) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerID- the container's new ID. Must not be- null.
- Returns:
- IContainer instance.  A non-null. instance will be returned.
- Throws:
- ContainerCreateException- if some problem creating a base IContainer instance.
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use. Must not be- null.
- Returns:
- a valid instance of IContainer. Will not be null.
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to lookup. Must not be- null.
- Returns:
- a valid instance of IContainer. Will not be null.
- Throws:
- ContainerCreateException- if cannot create container of given name
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, Object[] parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use to create the instance. Must not be- null.
- parameters- an Object [] of parameters passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer. A non-nullinstance will be returned.
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, Object[] parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to lookup. Must not be- null.
- parameters- the Object [] of parameters passed to the IContainerInstantiator.createInstance method. May be- null.
- Returns:
- a valid instance of IContainer. Will not be null.
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, ID containerID, Object[] parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use to create the instance. Must not be- null.
- containerID- the container's new ID. May be- null.
- parameters- an Object [] of parameters passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, ID containerID, Object[] parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to lookup. Must not be- null.
- containerID- the new container's id. May be- null.
- parameters- the Object [] of parameters passed to the IContainerInstantiator.createInstance method. May be- null.
- Returns:
- a valid instance of IContainer. Will not be null.
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, ID containerID) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to lookup. Must not be- null.
- containerID- the new container's id. May be- null.
- Returns:
- a valid instance of IContainer.  Will not be null.
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, ID containerID) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to lookup. Must not be- null.
- containerID- the new container's id. May be- null.
- Returns:
- a valid instance of IContainer.  Will not be null.
- Throws:
- ContainerCreateException- if some problem creating the instance.
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, String containerId) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to use to create the instance. Must not be- null.
- containerId- the container's new ID. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, String containerId, Object[] parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to use to create the instance. Must not be- null.
- containerId- the container's new ID. May be- null.
- parameters- an Object [] of parameters passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, String containerId) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use to create the instance. Must not be- null.
- containerId- the container's new ID. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, String containerId, Object[] parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use to create the instance. Must not be- null.
- containerId- the container's new ID. May be- null.
- parameters- an Object [] of parameters passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
getAllContainerspublic IContainer[] getAllContainers() Description copied from interface:IContainerManagerGet all containers known to this container manager.- Specified by:
- getAllContainersin interface- IContainerManager
- Returns:
- IContainer[] of active container instances known to this
         container manager. Will not return null, but may return empty IContainer[].
 
 - 
getContainerpublic IContainer getContainer(ID containerID) Description copied from interface:IContainerManagerGet container for given ID. IfcontainerIDisnullthennullwill be returned. If active container with givencontainerID,is not known to this container manager, thennullwill also be returned.- Specified by:
- getContainerin interface- IContainerManager
- Parameters:
- containerID- the ID of the container instance to retrieve from this manager. If- null- nullwill be returned.
- Returns:
- IContainer instance with given containerID. Will benullif there is no container with given ID known to this container manager.
 
 - 
hasContainerpublic boolean hasContainer(ID containerID) Description copied from interface:IContainerManagerReturn true if this container manager has the given container under management, false otherwise.- Specified by:
- hasContainerin interface- IContainerManager
- Parameters:
- containerID- the ID of the container to find. If- nullthis method returns false.
- Returns:
- true if this container manager has the given container under management, false otherwise.
 
 - 
addListenerpublic boolean addListener(IContainerManagerListener listener) Description copied from interface:IContainerManagerAdd listener to thisIContainerManager.- Specified by:
- addListenerin interface- IContainerManager
- Parameters:
- listener- the listener to add. Must not be- null.
- Returns:
- true if listener successfully added
 
 - 
removeListenerpublic boolean removeListener(IContainerManagerListener listener) Description copied from interface:IContainerManagerRemove listener from thisIContainerManager.- Specified by:
- removeListenerin interface- IContainerManager
- Parameters:
- listener- the listener to remove. Must not be- null.
- Returns:
- true if listener successfully removed
 
 - 
addContainerpublic IContainer addContainer(IContainer container, ContainerTypeDescription typeDescription) Description copied from interface:IContainerManagerAdd given container to manager.- Specified by:
- addContainerin interface- IContainerManager
- Parameters:
- container- to add. Must not be- null. Also- container.getID()must return a non-- nullvalue. If- container.getID()returns- nullthen this method will throw a- NullPointerException.
- typeDescription- the container type description used to create the given container. Must not be- null.
- Returns:
- IContainer previously added (with same ID).
 
 - 
removeContainerpublic IContainer removeContainer(IContainer container) Description copied from interface:IContainerManagerRemove given container from manager.- Specified by:
- removeContainerin interface- IContainerManager
- Parameters:
- container- the container to remove. Must not be- null.
- Returns:
- IContainer instance removed.  If no instance with same ID is found
 then nullwill be returned.
 
 - 
removeContainerpublic IContainer removeContainer(ID containerID) Description copied from interface:IContainerManagerRemove given container from manager.- Specified by:
- removeContainerin interface- IContainerManager
- Parameters:
- containerID- the ID of the container to remove. Must not be- null.
- Returns:
- IContainer instance removed.  If no instance with same ID is found
 then nullwill be returned.
 
 - 
getContainerTypeDescriptionpublic ContainerTypeDescription getContainerTypeDescription(ID containerID) Description copied from interface:IContainerManagerGet the container type description used to create the container with the given ID.- Specified by:
- getContainerTypeDescriptionin interface- IContainerManager
- Parameters:
- containerID- the ID of the container to get the description for.
- Returns:
- ContainerTypeDescription for the container with the given ID.  Will return nullif no container with the given containerID exists under this manager.
 
 - 
getContainerFactorypublic IContainerFactory getContainerFactory() Description copied from interface:IContainerManagerGet container factory associated with this container manager.- Specified by:
- getContainerFactoryin interface- IContainerManager
- Returns:
- IContainerFactory.  Will not return null.
 
 - 
removeAllContainerspublic void removeAllContainers() Description copied from interface:IContainerManagerRemove all containers from this manager- Specified by:
- removeAllContainersin interface- IContainerManager
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, ID containerID, Map parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use to create the instance. Must not be- null.
- containerID- the container's new ID. Must not be- null.
- parameters- a Map of parameters (name/value pairs) passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, String containerId, Map parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use to create the instance. Must not be- null.
- containerId- the container's new ID. May be- null.
- parameters- a Map of parameters (name/value pairs) passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, ID containerID, Map parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to lookup. Must not be- null.
- containerID- the container's new ID. May be- null.
- parameters- a Map of parameters (name/value pairs) passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, String containerId, Map parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to lookup. Must not be- null.
- containerId- the container's new ID. May be- null.
- parameters- a Map of parameters (name/value pairs) passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(ContainerTypeDescription containerTypeDescription, Map parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescription- the ContainerTypeDescription to use to create the instance. Must not be- null.
- parameters- a Map of parameters (name/value pairs) passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 - 
createContainerpublic IContainer createContainer(String containerTypeDescriptionName, Map parameters) throws ContainerCreateException Description copied from interface:IContainerFactoryCreate a new container.- Specified by:
- createContainerin interface- IContainerFactory
- Parameters:
- containerTypeDescriptionName- the ContainerTypeDescription name to lookup. Must not be- null.
- parameters- a Map of parameters (name/value pairs) passed to the createInstance method of the IContainerInstantiator. May be- null.
- Returns:
- a valid instance of IContainer
- Throws:
- ContainerCreateException- if some problem creating the instance.
- Since:
- 3.1
 
 
- 
 
-