Package org.codehaus.cargo.generic
Class DefaultContainerCapabilityFactory
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.generic.spi.AbstractGenericHintFactory<T>
-
- org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory<ContainerCapability>
-
- org.codehaus.cargo.generic.DefaultContainerCapabilityFactory
-
- All Implemented Interfaces:
ContainerCapabilityFactory
,Loggable
public class DefaultContainerCapabilityFactory extends AbstractIntrospectionGenericHintFactory<ContainerCapability> implements ContainerCapabilityFactory
Default implementation ofContainerCapabilityFactory
. Registers all known container capabilities.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
-
-
Constructor Summary
Constructors Constructor Description DefaultContainerCapabilityFactory()
Initialize container capability name mappings with container ids.DefaultContainerCapabilityFactory(ClassLoader classLoader)
Register container capability name mappings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContainerCapability
createContainerCapability(String containerId)
Create aContainerCapability
instance.protected ContainerCapability
createInstance(Constructor<? extends ContainerCapability> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create an implementation class instance.protected Constructor<? extends ContainerCapability>
getConstructor(Class<? extends ContainerCapability> containerCapabilityClass, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create a constructor.void
registerContainerCapability(String containerId, Class<? extends ContainerCapability> containerCapabilityClass)
void
registerContainerCapability(String containerId, String containerCapabilityClassName)
Registers a container capability 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
-
DefaultContainerCapabilityFactory
public DefaultContainerCapabilityFactory()
Initialize container capability name mappings with container ids.
-
DefaultContainerCapabilityFactory
public DefaultContainerCapabilityFactory(ClassLoader classLoader)
Register container capability name mappings.- Parameters:
classLoader
- ClassLoader to discover implementations from. SeeAbstractFactoryRegistry.register(ClassLoader, ContainerCapabilityFactory)
for the details of what this value means.
-
-
Method Detail
-
registerContainerCapability
public void registerContainerCapability(String containerId, Class<? extends ContainerCapability> containerCapabilityClass)
- Specified by:
registerContainerCapability
in interfaceContainerCapabilityFactory
- Parameters:
containerId
- the id of the container to registercontainerCapabilityClass
- the container capability implementation class to register
-
registerContainerCapability
public void registerContainerCapability(String containerId, String containerCapabilityClassName)
Registers a container capability using a class specified as a String.- Parameters:
containerId
- Container id.containerCapabilityClassName
- Container capability implementation class to register as a String- See Also:
registerContainerCapability(String, Class)
-
createContainerCapability
public ContainerCapability createContainerCapability(String containerId)
Create aContainerCapability
instance.- Specified by:
createContainerCapability
in interfaceContainerCapabilityFactory
- Parameters:
containerId
- the id under which the container will be looked up- Returns:
- the container capability instance matching the parameter passed
-
getConstructor
protected Constructor<? extends ContainerCapability> getConstructor(Class<? extends ContainerCapability> containerCapabilityClass, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws NoSuchMethodException
Create a constructor.- Specified by:
getConstructor
in classAbstractGenericHintFactory<ContainerCapability>
- Parameters:
containerCapabilityClass
- 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 ContainerCapability createInstance(Constructor<? extends ContainerCapability> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws Exception
Create an implementation class instance.- Specified by:
createInstance
in classAbstractGenericHintFactory<ContainerCapability>
- 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
-
-