public class DefaultContainerFactory extends AbstractIntrospectionGenericHintFactory implements ContainerFactory
ContainerFactory
. Registers all known containers.AbstractGenericHintFactory.GenericParameters
Constructor and Description |
---|
DefaultContainerFactory()
Initialize container name mappings with container ids.
|
Modifier and Type | Method and Description |
---|---|
Container |
createContainer(String containerId,
ContainerType containerType,
Configuration configuration)
Create a container instance instantiated using the specified configuration.
|
protected Object |
createInstance(Constructor constructor,
String containerType,
AbstractGenericHintFactory.GenericParameters parameters)
Create an implementation class instance.
|
protected Constructor |
getConstructor(Class containerClass,
String containerType,
AbstractGenericHintFactory.GenericParameters parameters)
Create a constructor.
|
Class |
getContainerClass(String containerId,
ContainerType containerType) |
Map |
getContainerIds() |
boolean |
isContainerRegistered(String containerId,
ContainerType containerType) |
void |
registerContainer(String containerId,
ContainerType containerType,
Class containerClass) |
void |
registerContainer(String containerId,
ContainerType containerType,
String containerClassName)
Registers a container using a class specified as a String.
|
createImplementation, registerImplementation
getMapping, getMappings, hasMapping, registerImplementation
public DefaultContainerFactory()
public boolean isContainerRegistered(String containerId, ContainerType containerType)
isContainerRegistered
in interface ContainerFactory
containerId
- the id of the container to checkcontainerType
- the container typeContainerFactory.isContainerRegistered(String, ContainerType)
public void registerContainer(String containerId, ContainerType containerType, Class containerClass)
registerContainer
in interface ContainerFactory
containerId
- the id of the container to registercontainerType
- the container type to register (ContainerType.INSTALLED
,
ContainerType.EMBEDDED
or ContainerType.REMOTE
)containerClass
- the container implementation class to registerContainerFactory.registerContainer(String, org.codehaus.cargo.container.ContainerType, Class)
public void registerContainer(String containerId, ContainerType containerType, String containerClassName)
containerId
- containerType
- containerClassName
- the container implementation class to register as a StringregisterContainer(String, ContainerType, Class)
public Class getContainerClass(String containerId, ContainerType containerType)
getContainerClass
in interface ContainerFactory
containerId
- the id of the container for which to retrieve the implementation classcontainerType
- the container's type (ContainerType.INSTALLED
,
ContainerType.EMBEDDED
or ContainerType.REMOTE
)ContainerFactory.getContainerClass(java.lang.String, org.codehaus.cargo.container.ContainerType)
public Container createContainer(String containerId, ContainerType containerType, Configuration configuration)
createContainer
in interface ContainerFactory
containerId
- the name under which the container will be looked upcontainerType
- the container's type (local installed, local embedded, remote, etc)configuration
- the configuration to pass to the container's constructorContainerFactory.createContainer(String, ContainerType, Configuration)
protected Constructor getConstructor(Class containerClass, String containerType, AbstractGenericHintFactory.GenericParameters parameters) throws NoSuchMethodException
getConstructor
in class AbstractGenericHintFactory
containerClass
- implementation class for which to create the constructorcontainerType
- the hint to differentiate this implementation class from othersparameters
- additional parameters necessary to create the constructor objectNoSuchMethodException
- in case of errorAbstractGenericHintFactory.getConstructor(java.lang.Class, java.lang.String, org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.GenericParameters)
protected Object createInstance(Constructor constructor, String containerType, AbstractGenericHintFactory.GenericParameters parameters) throws Exception
createInstance
in class AbstractGenericHintFactory
constructor
- the constructor to use for creating the instancecontainerType
- the hint to differentiate this implementation class from othersparameters
- additional parameters necessary to create the instanceException
- in case of errorAbstractGenericHintFactory.createInstance(java.lang.reflect.Constructor, java.lang.String, org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.GenericParameters)
public Map getContainerIds()
getContainerIds
in interface ContainerFactory
ContainerType
s registered
for that container, as a Set.ContainerFactory.getContainerIds()
Copyright © 2004-2013 Codehaus. All Rights Reserved.