org.codehaus.cargo.generic.deployer
Class DefaultDeployerFactory

java.lang.Object
  extended byorg.codehaus.cargo.util.log.LoggedObject
      extended byorg.codehaus.cargo.generic.spi.AbstractGenericHintFactory
          extended byorg.codehaus.cargo.generic.spi.AbstractIntrospectionGenericHintFactory
              extended byorg.codehaus.cargo.generic.deployer.DefaultDeployerFactory
All Implemented Interfaces:
DeployerFactory, org.codehaus.cargo.util.log.Loggable

public class DefaultDeployerFactory
extends AbstractIntrospectionGenericHintFactory
implements DeployerFactory

Default DeployerFactory implementation that has all the known container deployers registered against their containers. It also supports registering new deployers against any container.

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

Nested Class Summary
 
Nested classes inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
 
Constructor Summary
DefaultDeployerFactory()
          Register default deployers.
 
Method Summary
 org.codehaus.cargo.container.deployer.Deployer createDeployer(org.codehaus.cargo.container.Container container)
          Create a Deployer instance whose type matches the container's type. For example this creates a local deployer when the container's instance passed is a local container and a remote deployer when the container's instance passed is a remote container.
 org.codehaus.cargo.container.deployer.Deployer createDeployer(org.codehaus.cargo.container.Container container, org.codehaus.cargo.container.deployer.DeployerType deployerType)
          Create a Deployer instance matching the specified container and type.
protected  java.lang.Object createInstance(java.lang.reflect.Constructor constructor, java.lang.String hint, AbstractGenericHintFactory.GenericParameters parameters)
          Create an implementation class instance.
protected  java.lang.reflect.Constructor getConstructor(java.lang.Class deployerClass, java.lang.String hint, AbstractGenericHintFactory.GenericParameters parameters)
          Create a constructor.
 java.lang.Class getDeployerClass(java.lang.String containerId, org.codehaus.cargo.container.deployer.DeployerType deployerType)
          
 boolean isDeployerRegistered(java.lang.String containerId, org.codehaus.cargo.container.deployer.DeployerType deployerType)
          
 void registerDeployer(java.lang.String containerId, org.codehaus.cargo.container.deployer.DeployerType deployerType, java.lang.Class deployerClass)
          Registers a Deployer implementation.
 void registerDeployer(java.lang.String containerId, org.codehaus.cargo.container.deployer.DeployerType deployerType, java.lang.String deployerClassName)
          Registers a deployer 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

DefaultDeployerFactory

public DefaultDeployerFactory()
Register default deployers.

Method Detail

registerDeployer

public void registerDeployer(java.lang.String containerId,
                             org.codehaus.cargo.container.deployer.DeployerType deployerType,
                             java.lang.Class deployerClass)
Registers a Deployer implementation.

Specified by:
registerDeployer in interface DeployerFactory
Parameters:
containerId - the container attached to this deployerClass
deployerType - the deployer's type (local, remote, etc)
deployerClass - the deployer implementation class to register
See Also:
DeployerFactory.registerDeployer(String, DeployerType, Class)

registerDeployer

public void registerDeployer(java.lang.String containerId,
                             org.codehaus.cargo.container.deployer.DeployerType deployerType,
                             java.lang.String deployerClassName)
Registers a deployer using a class specified as a String.

Parameters:
containerId - {@inheritDoc}
deployerType - {@inheritDoc}
deployerClassName - the deployer implementation class to register as a String
See Also:
registerDeployer(String, DeployerType, Class)

isDeployerRegistered

public boolean isDeployerRegistered(java.lang.String containerId,
                                    org.codehaus.cargo.container.deployer.DeployerType deployerType)

Specified by:
isDeployerRegistered in interface DeployerFactory
Parameters:
containerId - the container attached to this deployer class
deployerType - the type to differentiate this deployer from others for the specified container
Returns:
true if the specified deployer is already registered or false otherwise
See Also:
DeployerFactory.isDeployerRegistered(String, DeployerType)

getDeployerClass

public java.lang.Class getDeployerClass(java.lang.String containerId,
                                        org.codehaus.cargo.container.deployer.DeployerType deployerType)

Specified by:
getDeployerClass in interface DeployerFactory
Parameters:
containerId - the container attached to this deployer class
deployerType - the deployer's type
Returns:
the deployer implementation class
See Also:
DeployerFactory.getDeployerClass(String, org.codehaus.cargo.container.deployer.DeployerType)

createDeployer

public org.codehaus.cargo.container.deployer.Deployer createDeployer(org.codehaus.cargo.container.Container container,
                                                                     org.codehaus.cargo.container.deployer.DeployerType deployerType)
Create a Deployer instance matching the specified container and type.

Specified by:
createDeployer in interface DeployerFactory
Parameters:
container - the container for which we need to create a deployer instance
deployerType - the deployer's type (local, remote, etc)
Returns:
the deployer instance
See Also:
DeployerFactory.createDeployer(Container, DeployerType)

createDeployer

public org.codehaus.cargo.container.deployer.Deployer createDeployer(org.codehaus.cargo.container.Container container)
Create a Deployer instance whose type matches the container's type. For example this creates a local deployer when the container's instance passed is a local container and a remote deployer when the container's instance passed is a remote container.

Specified by:
createDeployer in interface DeployerFactory
Parameters:
container - the container for which we need to create a deployer instance
Returns:
the deployer instance
See Also:
DeployerFactory.createDeployer(Container)

getConstructor

protected java.lang.reflect.Constructor getConstructor(java.lang.Class deployerClass,
                                                       java.lang.String hint,
                                                       AbstractGenericHintFactory.GenericParameters parameters)
                                                throws java.lang.NoSuchMethodException
Create a constructor.

Specified by:
getConstructor in class AbstractGenericHintFactory
Parameters:
deployerClass - 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:
java.lang.NoSuchMethodException - in case of error
See Also:
org.codehaus.cargo.generic.spi.AbstractGenericHintFactory#getConstructor(Class, String, GenericParameters)

createInstance

protected java.lang.Object createInstance(java.lang.reflect.Constructor constructor,
                                          java.lang.String hint,
                                          AbstractGenericHintFactory.GenericParameters parameters)
                                   throws java.lang.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:
java.lang.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-2008 Codehaus. All Rights Reserved.