org.codehaus.cargo.generic.deployable
Class DefaultDeployableFactory

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
              extended by org.codehaus.cargo.generic.deployable.DefaultDeployableFactory
All Implemented Interfaces:
DeployableFactory, Loggable

public class DefaultDeployableFactory
extends AbstractIntrospectionGenericHintFactory
implements DeployableFactory

Default deployable factory that returns deployables for a given container. The reason deployable can be different for different containers is because for some container Cargo understand container-specific files. For example for Tomcat Cargo understand the context.xml file.

Version:
$Id: DefaultDeployableFactory.java 1705 2008-09-02 13:14:55Z adriana $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
 
Constructor Summary
DefaultDeployableFactory()
          Register deployable classes mappings.
DefaultDeployableFactory(ClassLoader classLoader)
          Register deployable classes mappings.
 
Method Summary
 Deployable createDeployable(String containerId, String deployableLocation, DeployableType deployableType)
          
protected  Object createInstance(Constructor constructor, String hint, AbstractGenericHintFactory.GenericParameters parameters)
          Create an implementation class instance.
protected  Constructor getConstructor(Class deployableClass, String hint, AbstractGenericHintFactory.GenericParameters parameters)
          Create a constructor.
 boolean isDeployableRegistered(String containerId, DeployableType deployableType)
          
 void registerDeployable(String containerId, DeployableType deployableType, Class deployableClass)
          Registers a deployable implementation against a container.
 void registerDeployable(String containerId, DeployableType deployableType, String deployableClassName)
          Registers a deployable 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDeployableFactory

public DefaultDeployableFactory()
Register deployable classes mappings.


DefaultDeployableFactory

public DefaultDeployableFactory(ClassLoader classLoader)
Register deployable classes mappings.

Parameters:
classLoader - ClassLoader to discover implementations from. See AbstractFactoryRegistry.register(ClassLoader, DeployableFactory) for the details of what this value means.
Method Detail

registerDeployable

public void registerDeployable(String containerId,
                               DeployableType deployableType,
                               Class deployableClass)
Registers a deployable implementation against a container.

Specified by:
registerDeployable in interface DeployableFactory
Parameters:
containerId - the container id attached to this deployable class
deployableType - the type to differentiate this deployable from others for the specified container
deployableClass - the deployable implementation class to register
See Also:
DeployableFactory.registerDeployable(String, DeployableType, Class)

registerDeployable

public void registerDeployable(String containerId,
                               DeployableType deployableType,
                               String deployableClassName)
Registers a deployable using a class specified as a String.

Parameters:
containerId -
deployableType -
deployableClassName - the deployable implementation class to register as a String
See Also:
registerDeployable(String, DeployableType, Class)

isDeployableRegistered

public boolean isDeployableRegistered(String containerId,
                                      DeployableType deployableType)

Specified by:
isDeployableRegistered in interface DeployableFactory
Parameters:
containerId - the container attached to the deployable type class
deployableType - the type to differentiate this deployable from others for the specified container
Returns:
true if the specified deployable is already registered or false otherwise
See Also:
DeployableFactory.isDeployableRegistered(java.lang.String, org.codehaus.cargo.container.deployable.DeployableType)

createDeployable

public Deployable createDeployable(String containerId,
                                   String deployableLocation,
                                   DeployableType deployableType)

Specified by:
createDeployable in interface DeployableFactory
Parameters:
containerId - the container id for which to create the deployable for
deployableLocation - the location of the Deployable being wrapped. It must point to a WAR file, an EAR file or an exanded WAR directory
deployableType - the deployable type to create
Returns:
the Deployable instance
See Also:
DeployableFactory.createDeployable(java.lang.String, java.lang.String, org.codehaus.cargo.container.deployable.DeployableType)

getConstructor

protected Constructor getConstructor(Class deployableClass,
                                     String hint,
                                     AbstractGenericHintFactory.GenericParameters parameters)
                              throws NoSuchMethodException
Create a constructor.

Specified by:
getConstructor in class AbstractGenericHintFactory
Parameters:
deployableClass - implementation class for which to create the constructor
hint - the hint to differentiate this implementation class from others
parameters - additional parameters necessary to create the constructor object
Returns:
the constructor to use for creating an instance
Throws:
NoSuchMethodException - in case of error
See Also:
AbstractGenericHintFactory.getConstructor(java.lang.Class, java.lang.String, org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.GenericParameters)

createInstance

protected Object createInstance(Constructor constructor,
                                String hint,
                                AbstractGenericHintFactory.GenericParameters parameters)
                         throws Exception
Create an implementation class instance.

Specified by:
createInstance in class AbstractGenericHintFactory
Parameters:
constructor - the constructor to use for creating the instance
hint - the hint to differentiate this implementation class from others
parameters - additional parameters necessary to create the instance
Returns:
the created instance
Throws:
Exception - in case of error
See Also:
AbstractGenericHintFactory.createInstance(java.lang.reflect.Constructor, java.lang.String, org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.GenericParameters)


Copyright © 2004-2012 Codehaus. All Rights Reserved.