org.codehaus.cargo.generic.packager
Class DefaultPackagerFactory

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.packager.DefaultPackagerFactory
All Implemented Interfaces:
org.codehaus.cargo.util.log.Loggable, PackagerFactory

public class DefaultPackagerFactory
extends AbstractIntrospectionGenericHintFactory
implements PackagerFactory

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

Version:
$Id: $

Nested Class Summary
 
Nested classes inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
 
Constructor Summary
DefaultPackagerFactory()
          Register default deployers.
 
Method Summary
protected  java.lang.Object createInstance(java.lang.reflect.Constructor constructor, java.lang.String hint, AbstractGenericHintFactory.GenericParameters parameters)
          Create an implementation class instance.
 org.codehaus.cargo.container.packager.Packager createPackager(java.lang.String containerId, org.codehaus.cargo.container.packager.PackagerType packagerType, java.lang.String outputLocation)
          Create a Packager instance matching the specified container id.
protected  java.lang.reflect.Constructor getConstructor(java.lang.Class deployerClass, java.lang.String hint, AbstractGenericHintFactory.GenericParameters parameters)
          Create a constructor.
 boolean isPackagerRegistered(java.lang.String containerId, org.codehaus.cargo.container.packager.PackagerType packagerType)
          
 void registerPackager(java.lang.String containerId, org.codehaus.cargo.container.packager.PackagerType packagerType, java.lang.Class packagerClass)
          Registers a Packager implementation.
 void registerPackager(java.lang.String containerId, org.codehaus.cargo.container.packager.PackagerType packagerType, java.lang.String packagerClassName)
          Registers a packager 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

DefaultPackagerFactory

public DefaultPackagerFactory()
Register default deployers.

Method Detail

registerPackager

public void registerPackager(java.lang.String containerId,
                             org.codehaus.cargo.container.packager.PackagerType packagerType,
                             java.lang.Class packagerClass)
Registers a Packager implementation.

Specified by:
registerPackager in interface PackagerFactory
Parameters:
containerId - the container attached to this packager
packagerType - the packager's type (directory, zip, etc)
packagerClass - the packager implementation class to register
See Also:
PackagerFactory.registerPackager(String, org.codehaus.cargo.container.packager.PackagerType, Class)

registerPackager

public void registerPackager(java.lang.String containerId,
                             org.codehaus.cargo.container.packager.PackagerType packagerType,
                             java.lang.String packagerClassName)
Registers a packager using a class specified as a String.

Parameters:
containerId - {@inheritDoc}
packagerType - {@inheritDoc}
packagerClassName - the packager implementation class to register as a String
See Also:
registerPackager(String, org.codehaus.cargo.container.packager.PackagerType, Class)

isPackagerRegistered

public boolean isPackagerRegistered(java.lang.String containerId,
                                    org.codehaus.cargo.container.packager.PackagerType packagerType)

Specified by:
isPackagerRegistered in interface PackagerFactory
Parameters:
containerId - the container attached to this packager class
packagerType - the type to differentiate this packager from others for the specified container
Returns:
true if the specified packager is already registered or false otherwise
See Also:
PackagerFactory.isPackagerRegistered(String, org.codehaus.cargo.container.packager.PackagerType)

createPackager

public org.codehaus.cargo.container.packager.Packager createPackager(java.lang.String containerId,
                                                                     org.codehaus.cargo.container.packager.PackagerType packagerType,
                                                                     java.lang.String outputLocation)
Create a Packager instance matching the specified container id.

Specified by:
createPackager in interface PackagerFactory
Parameters:
containerId - the container for which we need to create a packager instance
packagerType - the packager's type (directory, zip, etc)
outputLocation - the location where the package will be generated. For example for a Directory Packager this will be the directory into which the package will be generated.
Returns:
the packager instance
See Also:
PackagerFactory.createPackager(java.lang.String, org.codehaus.cargo.container.packager.PackagerType, java.lang.String)

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:
AbstractGenericHintFactory.getConstructor(Class, String, org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.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-2007 Codehaus. All Rights Reserved.