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 ConfigurationCapabilitycreateConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType)Create aConfigurationCapabilityinstance for a given container.protected ConfigurationCapabilitycreateInstance(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.voidregisterConfigurationCapability(String containerId, ContainerType containerType, ConfigurationType configurationType, Class<? extends ConfigurationCapability> configurationCapabilityClass)voidregisterConfigurationCapability(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:
registerConfigurationCapabilityin 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 aConfigurationCapabilityinstance for a given container.- Specified by:
createConfigurationCapabilityin 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:
getConstructorin 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:
createInstancein 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
-
-