Class DefaultDeployableFactory
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.generic.spi.AbstractGenericHintFactory<T>
-
- org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory<Deployable>
-
- org.codehaus.cargo.generic.deployable.DefaultDeployableFactory
-
- All Implemented Interfaces:
DeployableFactory
,Loggable
public class DefaultDeployableFactory extends AbstractIntrospectionGenericHintFactory<Deployable> implements DeployableFactory
Default deployable factory that returns deployables for a given container. The reason deployable can be different for different containers is because for some container Cargo understand container-specific files. For example for Tomcat Cargo understand the context.xml file.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
-
-
Constructor Summary
Constructors Constructor Description DefaultDeployableFactory()
Register deployable classes mappings.DefaultDeployableFactory(ClassLoader classLoader)
Register deployable classes mappings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Deployable
createDeployable(String containerId, String deployableLocation, DeployableType deployableType)
Creates an Deployable instance, wrapping a file or a directory.protected Deployable
createInstance(Constructor<? extends Deployable> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create an implementation class instance.protected Constructor<? extends Deployable>
getConstructor(Class<? extends Deployable> deployableClass, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create a constructor.boolean
isDeployableRegistered(String containerId, DeployableType deployableType)
Checks if the deployable specified by the deployable type is registered for a specific container.void
registerDeployable(String containerId, DeployableType deployableType, Class<? extends Deployable> deployableClass)
Registers a deployable implementation against a container.void
registerDeployable(String containerId, DeployableType deployableType, String deployableClassName)
Registers a deployable 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
-
DefaultDeployableFactory
public DefaultDeployableFactory()
Register deployable classes mappings.
-
DefaultDeployableFactory
public DefaultDeployableFactory(ClassLoader classLoader)
Register deployable classes mappings.- Parameters:
classLoader
- ClassLoader to discover implementations from. SeeAbstractFactoryRegistry.register(ClassLoader, DeployableFactory)
for the details of what this value means.
-
-
Method Detail
-
registerDeployable
public void registerDeployable(String containerId, DeployableType deployableType, Class<? extends Deployable> deployableClass)
Registers a deployable implementation against a container.- Specified by:
registerDeployable
in interfaceDeployableFactory
- Parameters:
containerId
- the container id attached to this deployable classdeployableType
- the type to differentiate this deployable from others for the specified containerdeployableClass
- the deployable implementation class to register
-
registerDeployable
public void registerDeployable(String containerId, DeployableType deployableType, String deployableClassName)
Registers a deployable using a class specified as a String.- Parameters:
containerId
- Container id.deployableType
- Deployable type.deployableClassName
- Deployable implementation class to register as a String- See Also:
registerDeployable(String, DeployableType, Class)
-
isDeployableRegistered
public boolean isDeployableRegistered(String containerId, DeployableType deployableType)
Checks if the deployable specified by the deployable type is registered for a specific container.- Specified by:
isDeployableRegistered
in interfaceDeployableFactory
- Parameters:
containerId
- the container id attached to the deployable type classdeployableType
- the type to differentiate this deployable from others for the specified container- Returns:
- true if the specified deployable is already registered or false otherwise
-
createDeployable
public Deployable createDeployable(String containerId, String deployableLocation, DeployableType deployableType)
Creates an Deployable instance, wrapping a file or a directory.- Specified by:
createDeployable
in interfaceDeployableFactory
- Parameters:
containerId
- the container id for which to create the deployable fordeployableLocation
- the location of the deployable being wrapped, which must point to a file or a directory (for an expanded deployable)deployableType
- the deployable type to create- Returns:
- the
Deployable
instance
-
getConstructor
protected Constructor<? extends Deployable> getConstructor(Class<? extends Deployable> deployableClass, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws NoSuchMethodException
Create a constructor.- Specified by:
getConstructor
in classAbstractGenericHintFactory<Deployable>
- Parameters:
deployableClass
- 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 Deployable createInstance(Constructor<? extends Deployable> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws Exception
Create an implementation class instance.- Specified by:
createInstance
in classAbstractGenericHintFactory<Deployable>
- 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
-
-