Package org.codehaus.cargo.generic.spi
Class AbstractIntrospectionGenericHintFactory<T>
- java.lang.Object
-
- org.codehaus.cargo.util.log.LoggedObject
-
- org.codehaus.cargo.generic.spi.AbstractGenericHintFactory<T>
-
- org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory<T>
-
- All Implemented Interfaces:
Loggable
- Direct Known Subclasses:
DefaultConfigurationCapabilityFactory
,DefaultConfigurationFactory
,DefaultContainerCapabilityFactory
,DefaultContainerFactory
,DefaultDeployableFactory
,DefaultDeployerFactory
,DefaultPackagerFactory
public abstract class AbstractIntrospectionGenericHintFactory<T> extends AbstractGenericHintFactory<T>
Extension toAbstractGenericHintFactory
that registers and creates instances from implementation classes specified as String, using introspection. If the implementation fails to load the registration fails silently. This is to cover the user case where a specific container's implementation jar may not be present in the classpath if it's not used by the user. This allows users to only put the container implementation jars the require in the classpath.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
-
-
Constructor Summary
Constructors Constructor Description AbstractIntrospectionGenericHintFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected T
createImplementation(RegistrationKey key, AbstractGenericHintFactory.GenericParameters parameters, String implementationConceptName)
Generic method to create an implementation based on the registered implementation classes.protected void
registerImplementation(RegistrationKey key, String objectClassName)
Allow registering container objects using introspection so that at build time and runtime the user can handpick the container implementation jars that he want to use.-
Methods inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
createInstance, getConstructor, getMapping, getMappings, hasMapping, registerImplementation
-
Methods inherited from class org.codehaus.cargo.util.log.LoggedObject
getLogger, setLogger
-
-
-
-
Method Detail
-
registerImplementation
protected void registerImplementation(RegistrationKey key, String objectClassName)
Allow registering container objects using introspection so that at build time and runtime the user can handpick the container implementation jars that he want to use. If we were not using introspection the user would have to have all container implementation jars in the classpath when using this generic API.- Parameters:
key
- the key under which to register the class nameobjectClassName
- the object to register
-
createImplementation
protected T createImplementation(RegistrationKey key, AbstractGenericHintFactory.GenericParameters parameters, String implementationConceptName)
Generic method to create an implementation based on the registered implementation classes.- Overrides:
createImplementation
in classAbstractGenericHintFactory<T>
- Parameters:
key
- the key under which the implementation class is registeredparameters
- the additional parameters necessary to create the constructor objectimplementationConceptName
- the name of what the implementation class is representing. This is used in exception text messages to provide message customization. For example "container", "configuration", "deployable', etc.- Returns:
- the created instance
-
-