Class DefaultConfigurationCapabilityFactory
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.generic.spi.AbstractGenericHintFactory<T>
-
- org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory<ConfigurationCapability>
-
- org.codehaus.cargo.generic.configuration.DefaultConfigurationCapabilityFactory
-
- All Implemented Interfaces:
ConfigurationCapabilityFactory
,Loggable
public class DefaultConfigurationCapabilityFactory extends AbstractIntrospectionGenericHintFactory<ConfigurationCapability> implements ConfigurationCapabilityFactory
Default implementation ofConfigurationCapabilityFactory
. Registers all known configuration capabilities.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationCapabilityFactory()
Initialize configuration capability name mappings with container ids and configuration types.DefaultConfigurationCapabilityFactory(ClassLoader classLoader)
Register configuration capability name mappings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigurationCapability
createConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType)
Create aConfigurationCapability
instance for a given container.protected ConfigurationCapability
createInstance(Constructor<? extends ConfigurationCapability> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create an implementation class instance.protected Constructor<? extends ConfigurationCapability>
getConstructor(Class<? extends ConfigurationCapability> configurationCapabilityClass, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create a constructor.void
registerConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType, Class<? extends ConfigurationCapability> configurationCapabilityClass)
void
registerConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType, String configurationCapabilityClass)
Registers a configuration 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
-
DefaultConfigurationCapabilityFactory
public DefaultConfigurationCapabilityFactory()
Initialize configuration capability name mappings with container ids and configuration types.
-
DefaultConfigurationCapabilityFactory
public DefaultConfigurationCapabilityFactory(ClassLoader classLoader)
Register configuration capability name mappings.- Parameters:
classLoader
- ClassLoader to discover implementations from. SeeAbstractFactoryRegistry.register(ClassLoader, ConfigurationCapabilityFactory)
for the details of what this value means.
-
-
Method Detail
-
registerConfigurationCapability
public void registerConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType, Class<? extends ConfigurationCapability> configurationCapabilityClass)
- Specified by:
registerConfigurationCapability
in interfaceConfigurationCapabilityFactory
- Parameters:
containerId
- the id of the container to register againstcontainerType
- the type of the container to register againstconfigurationType
- the configuration type under which the capability should be registeredconfigurationCapabilityClass
- the configuration capability implementation class to register
-
registerConfigurationCapability
public void registerConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType, String configurationCapabilityClass)
Registers a configuration capability using a class specified as a String.- Parameters:
containerId
- Container idcontainerType
- Container typeconfigurationType
- Configuration typeconfigurationCapabilityClass
- Configuration capability implementation class to register as a String- See Also:
registerConfigurationCapability(String, org.codehaus.cargo.container.ContainerType, org.codehaus.cargo.container.configuration.ConfigurationType, String)
-
createConfigurationCapability
public ConfigurationCapability createConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType)
Create aConfigurationCapability
instance for a given container.- Specified by:
createConfigurationCapability
in interfaceConfigurationCapabilityFactory
- Parameters:
containerId
- the container id associated with the configuration capabilitycontainerType
- the container type associated with the configuration capabilityconfigurationType
- the configuration type associated with the capability- Returns:
- the configuration capability instance matching the parameter passed
-
getConstructor
protected Constructor<? extends ConfigurationCapability> getConstructor(Class<? extends ConfigurationCapability> configurationCapabilityClass, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws NoSuchMethodException
Create a constructor.- Specified by:
getConstructor
in classAbstractGenericHintFactory<ConfigurationCapability>
- Parameters:
configurationCapabilityClass
- 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 ConfigurationCapability createInstance(Constructor<? extends ConfigurationCapability> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws Exception
Create an implementation class instance.- Specified by:
createInstance
in classAbstractGenericHintFactory<ConfigurationCapability>
- 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
-
-