Class DefaultConfigurationFactory
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.generic.spi.AbstractGenericHintFactory<T>
-
- org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory<Configuration>
-
- org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory
-
- All Implemented Interfaces:
ConfigurationFactory
,Loggable
public class DefaultConfigurationFactory extends AbstractIntrospectionGenericHintFactory<Configuration> implements ConfigurationFactory
DefaultConfigurationFactory
implementation that has all the known container configurations registered against their containers. It also supports registering new configurations 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 DefaultConfigurationFactory()
Register default configurations.DefaultConfigurationFactory(ClassLoader classLoader)
Register configuration name mappings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Configuration
createConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType)
Create a configuration instance matching the specified container and type.Configuration
createConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType, String home)
Create a configuration instance matching the specified container and type.protected Configuration
createInstance(Constructor<? extends Configuration> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create an implementation class instance.Class<? extends Configuration>
getConfigurationClass(String containerId, ContainerType containerType, ConfigurationType configurationType)
protected Constructor<? extends Configuration>
getConstructor(Class<? extends Configuration> configurationClass, String hint, AbstractGenericHintFactory.GenericParameters parameters)
Create a constructor.boolean
isConfigurationRegistered(String containerId, ContainerType containerType, ConfigurationType configurationType)
void
registerConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType, Class<? extends Configuration> configurationClass)
Registers a configuration implementation.void
registerConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType, String configurationClassName)
Registers a configuration using a class specified as a String.void
setLogger(Logger logger)
Overriden in order to set the logger on ancillary components.-
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
-
-
-
-
Constructor Detail
-
DefaultConfigurationFactory
public DefaultConfigurationFactory()
Register default configurations.
-
DefaultConfigurationFactory
public DefaultConfigurationFactory(ClassLoader classLoader)
Register configuration name mappings.- Parameters:
classLoader
- ClassLoader to discover implementations from. SeeAbstractFactoryRegistry.register(ClassLoader, ConfigurationFactory)
for the details of what this value means.
-
-
Method Detail
-
setLogger
public void setLogger(Logger logger)
Overriden in order to set the logger on ancillary components.- Specified by:
setLogger
in interfaceLoggable
- Overrides:
setLogger
in classLoggedObject
- Parameters:
logger
- the logger to set and set in the ancillary objects
-
isConfigurationRegistered
public boolean isConfigurationRegistered(String containerId, ContainerType containerType, ConfigurationType configurationType)
- Specified by:
isConfigurationRegistered
in interfaceConfigurationFactory
- Parameters:
containerId
- the container id attached to this configuration classcontainerType
- the container type attached to this configuration classconfigurationType
- the type to differentiate this configuration from others for the specified container- Returns:
- true if the specified configuration is already registered or false otherwise
-
registerConfiguration
public void registerConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType, Class<? extends Configuration> configurationClass)
Registers a configuration implementation.- Specified by:
registerConfiguration
in interfaceConfigurationFactory
- Parameters:
containerId
- the container id attached to this configuration classcontainerType
- the container type attached to this configuration classconfigurationType
- the type to differentiate this configuration from others for the specified containerconfigurationClass
- the configuration implementation class to register
-
registerConfiguration
public void registerConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType, String configurationClassName)
Registers a configuration using a class specified as a String.- Parameters:
containerId
- Container id.containerType
- Container type.configurationType
- Configuration type.configurationClassName
- Configuration implementation class to register as a String- See Also:
registerConfiguration(String, org.codehaus.cargo.container.ContainerType, org.codehaus.cargo.container.configuration.ConfigurationType, Class)
-
getConfigurationClass
public Class<? extends Configuration> getConfigurationClass(String containerId, ContainerType containerType, ConfigurationType configurationType)
- Specified by:
getConfigurationClass
in interfaceConfigurationFactory
- Parameters:
containerId
- the container id attached to this configuration classcontainerType
- the container type attached to this configuration classconfigurationType
- the configuration's type- Returns:
- the configuration implementation class
-
createConfiguration
public Configuration createConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType)
Create a configuration instance matching the specified container and type.- Specified by:
createConfiguration
in interfaceConfigurationFactory
- Parameters:
containerId
- the id of the container for which to create a configurationcontainerType
- the type of the container for which to create a configurationconfigurationType
- the type that differentiates the configuration we wish to create from other configurations for this container- Returns:
- the configuration instance
-
createConfiguration
public Configuration createConfiguration(String containerId, ContainerType containerType, ConfigurationType configurationType, String home)
Create a configuration instance matching the specified container and type.- Specified by:
createConfiguration
in interfaceConfigurationFactory
- Parameters:
containerId
- the id of the container for which to create a configurationcontainerType
- the type of the container for which to create a configurationconfigurationType
- the type that differentiates the configuration we wish to create from other configurations for this containerhome
- the configuration home- Returns:
- the configuration instance
-
getConstructor
protected Constructor<? extends Configuration> getConstructor(Class<? extends Configuration> configurationClass, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws NoSuchMethodException
Create a constructor.- Specified by:
getConstructor
in classAbstractGenericHintFactory<Configuration>
- Parameters:
configurationClass
- 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 Configuration createInstance(Constructor<? extends Configuration> constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters) throws Exception
Create an implementation class instance.- Specified by:
createInstance
in classAbstractGenericHintFactory<Configuration>
- 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
-
-