Class DefaultDeployerFactory
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.generic.spi.AbstractGenericHintFactory<T>
-
- org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory<Deployer>
-
- org.codehaus.cargo.generic.deployer.DefaultDeployerFactory
-
- All Implemented Interfaces:
DeployerFactory,Loggable
public class DefaultDeployerFactory extends AbstractIntrospectionGenericHintFactory<Deployer> implements DeployerFactory
DefaultDeployerFactoryimplementation that has all the known container deployers registered against their containers. It also supports registering new deployers against any container.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
-
-
Constructor Summary
Constructors Constructor Description DefaultDeployerFactory()Register default deployers.DefaultDeployerFactory(ClassLoader classLoader)Register deployer name mappings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeployercreateDeployer(Container container)Create aDeployerinstance whose type matches the container's type.DeployercreateDeployer(Container container, DeployerType deployerType)Create aDeployerinstance matching the specified container and type.protected DeployercreateInstance(Constructor<? extends Deployer> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters)Create an implementation class instance.protected Constructor<? extends Deployer>getConstructor(Class<? extends Deployer> deployerClass, String hint, AbstractGenericHintFactory.GenericParameters parameters)Create a constructor.Class<? extends Deployer>getDeployerClass(String containerId, DeployerType deployerType)booleanisDeployerRegistered(String containerId, DeployerType deployerType)voidregisterDeployer(String containerId, DeployerType deployerType, Class<? extends Deployer> deployerClass)Registers aDeployerimplementation.voidregisterDeployer(String containerId, DeployerType deployerType, String deployerClassName)Registers a deployer using a class specified as a String.-
Methods inherited from class org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory
createImplementation, registerImplementation
-
Methods inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
getMapping, getMappings, hasMapping, registerImplementation
-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
-
-
-
-
Constructor Detail
-
DefaultDeployerFactory
public DefaultDeployerFactory()
Register default deployers.
-
DefaultDeployerFactory
public DefaultDeployerFactory(ClassLoader classLoader)
Register deployer name mappings.- Parameters:
classLoader- ClassLoader to discover implementations from. SeeAbstractFactoryRegistry.register(ClassLoader, DeployerFactory)for the details of what this value means.
-
-
Method Detail
-
registerDeployer
public void registerDeployer(String containerId, DeployerType deployerType, Class<? extends Deployer> deployerClass)
Registers aDeployerimplementation.- Specified by:
registerDeployerin interfaceDeployerFactory- Parameters:
containerId- the container attached to this deployerClassdeployerType- the deployer's type (local, remote, etc)deployerClass- the deployer implementation class to register
-
registerDeployer
public void registerDeployer(String containerId, DeployerType deployerType, String deployerClassName)
Registers a deployer using a class specified as a String.- Parameters:
containerId- Container id.deployerType- Deployer type.deployerClassName- Deployer implementation class to register as a String- See Also:
registerDeployer(String, DeployerType, Class)
-
isDeployerRegistered
public boolean isDeployerRegistered(String containerId, DeployerType deployerType)
- Specified by:
isDeployerRegisteredin interfaceDeployerFactory- Parameters:
containerId- the container attached to this deployer classdeployerType- the type to differentiate this deployer from others for the specified container- Returns:
- true if the specified deployer is already registered or false otherwise
-
getDeployerClass
public Class<? extends Deployer> getDeployerClass(String containerId, DeployerType deployerType)
- Specified by:
getDeployerClassin interfaceDeployerFactory- Parameters:
containerId- the container attached to this deployer classdeployerType- the deployer's type- Returns:
- the deployer implementation class
-
createDeployer
public Deployer createDeployer(Container container, DeployerType deployerType)
Create aDeployerinstance matching the specified container and type.- Specified by:
createDeployerin interfaceDeployerFactory- Parameters:
container- the container for which we need to create a deployer instancedeployerType- the deployer's type (local, remote, etc)- Returns:
- the deployer instance
-
createDeployer
public Deployer createDeployer(Container container)
Create aDeployerinstance whose type matches the container's type. For example this creates a local deployer when the container's instance passed is a local container and a remote deployer when the container's instance passed is a remote container.- Specified by:
createDeployerin interfaceDeployerFactory- Parameters:
container- the container for which we need to create a deployer instance- Returns:
- the deployer instance
-
getConstructor
protected Constructor<? extends Deployer> getConstructor(Class<? extends Deployer> deployerClass, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws NoSuchMethodException
Create a constructor.- Specified by:
getConstructorin classAbstractGenericHintFactory<Deployer>- Parameters:
deployerClass- implementation class for which to create the constructorhint- the hint to differentiate this implementation class from othersparameters- additional parameters necessary to create the constructor object- Returns:
- the constructor to use for creating an instance
- Throws:
NoSuchMethodException- in case of error
-
createInstance
protected Deployer createInstance(Constructor<? extends Deployer> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws Exception
Create an implementation class instance.- Specified by:
createInstancein classAbstractGenericHintFactory<Deployer>- Parameters:
constructor- the constructor to use for creating the instancehint- the hint to differentiate this implementation class from othersparameters- additional parameters necessary to create the instance- Returns:
- the created instance
- Throws:
Exception- in case of error
-
-