org.codehaus.cargo.generic.spi
Class AbstractIntrospectionGenericHintFactory

java.lang.Object
  extended by org.codehaus.cargo.util.log.LoggedObject
      extended by org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
          extended by org.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory
All Implemented Interfaces:
org.codehaus.cargo.util.log.Loggable
Direct Known Subclasses:
DefaultConfigurationCapabilityFactory, DefaultConfigurationFactory, DefaultContainerCapabilityFactory, DefaultContainerFactory, DefaultDeployableFactory, DefaultDeployerFactory, DefaultPackagerFactory

public abstract class AbstractIntrospectionGenericHintFactory
extends AbstractGenericHintFactory

Extension to AbstractGenericHintFactory 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.

Version:
$Id: AbstractIntrospectionGenericHintFactory.java 1233 2006-11-22 09:15:56Z vmassol $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
 
Constructor Summary
AbstractIntrospectionGenericHintFactory()
           
 
Method Summary
protected  java.lang.Object createImplementation(RegistrationKey key, AbstractGenericHintFactory.GenericParameters parameters, java.lang.String implementationConceptName)
          Generic method to create an implementation based on the registered implementation classes.
protected  void registerImplementation(RegistrationKey key, java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIntrospectionGenericHintFactory

public AbstractIntrospectionGenericHintFactory()
Method Detail

registerImplementation

protected void registerImplementation(RegistrationKey key,
                                      java.lang.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 name
objectClassName - the object to register

createImplementation

protected java.lang.Object createImplementation(RegistrationKey key,
                                                AbstractGenericHintFactory.GenericParameters parameters,
                                                java.lang.String implementationConceptName)
Generic method to create an implementation based on the registered implementation classes.

Overrides:
createImplementation in class AbstractGenericHintFactory
Parameters:
key - the key under which the implementation class is registered
parameters - the additional parameters necessary to create the constructor object
implementationConceptName - 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
See Also:
AbstractGenericHintFactory.createImplementation(org.codehaus.cargo.generic.internal.util.RegistrationKey, org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.GenericParameters, java.lang.String)


Copyright © 2004-2010 Codehaus. All Rights Reserved.