org.codehaus.cargo.generic
Class DefaultContainerFactory

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.DefaultContainerFactory
All Implemented Interfaces:
ContainerFactory, Loggable

public class DefaultContainerFactory
extends AbstractIntrospectionGenericHintFactory
implements ContainerFactory

Default implementation of ContainerFactory. Registers all known containers.

Version:
$Id: DefaultContainerFactory.java 1919 2009-03-05 02:23:52Z adriancole $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.cargo.generic.spi.AbstractGenericHintFactory
AbstractGenericHintFactory.GenericParameters
 
Constructor Summary
DefaultContainerFactory()
          Initialize container name mappings with container ids.
DefaultContainerFactory(java.lang.ClassLoader classLoader)
          Register packager name mappings.
 
Method Summary
 Container createContainer(java.lang.String containerId, ContainerType containerType, Configuration configuration)
          Create a container instance instantiated using the specified configuration.
protected  java.lang.Object createInstance(java.lang.reflect.Constructor constructor, java.lang.String containerType, AbstractGenericHintFactory.GenericParameters parameters)
          Create an implementation class instance.
protected  java.lang.reflect.Constructor getConstructor(java.lang.Class containerClass, java.lang.String containerType, AbstractGenericHintFactory.GenericParameters parameters)
          Create a constructor.
 java.lang.Class getContainerClass(java.lang.String containerId, ContainerType containerType)
          
 java.util.Map getContainerIds()
          
 boolean isContainerRegistered(java.lang.String containerId, ContainerType containerType)
          
 void registerContainer(java.lang.String containerId, ContainerType containerType, java.lang.Class containerClass)
          
 void registerContainer(java.lang.String containerId, ContainerType containerType, java.lang.String containerClassName)
          Registers a container using a class specified as a String.
 void registerGeronimo()
          Register Apache Geronimo
 void registerJBoss()
          Register JBoss
 void registerJetty()
          Register Jetty
 void registerJO()
          Register JO!
 void registerJOnAS()
          Register OW2 JOnAS
 void registerJRun()
          Register JRun
 void registerOrion()
          Register Orion
 void registerResin()
          Register Resin
 void registerTomcat()
          Register Tomcat
 void registerWeblogic()
          Register BEA/Oracle Weblogic
 
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

DefaultContainerFactory

public DefaultContainerFactory()
Initialize container name mappings with container ids.


DefaultContainerFactory

public DefaultContainerFactory(java.lang.ClassLoader classLoader)
Register packager name mappings.

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

registerGeronimo

public void registerGeronimo()
Register Apache Geronimo


registerJBoss

public void registerJBoss()
Register JBoss


registerJetty

public void registerJetty()
Register Jetty


registerJO

public void registerJO()
Register JO!


registerJOnAS

public void registerJOnAS()
Register OW2 JOnAS


registerJRun

public void registerJRun()
Register JRun


registerOrion

public void registerOrion()
Register Orion


registerResin

public void registerResin()
Register Resin


registerTomcat

public void registerTomcat()
Register Tomcat


registerWeblogic

public void registerWeblogic()
Register BEA/Oracle Weblogic


isContainerRegistered

public boolean isContainerRegistered(java.lang.String containerId,
                                     ContainerType containerType)

Specified by:
isContainerRegistered in interface ContainerFactory
Parameters:
containerId - the id of the container to check
containerType - the container type
Returns:
true if the specified container and type is already registered or false otherwise
See Also:
ContainerFactory.isContainerRegistered(String, ContainerType)

registerContainer

public void registerContainer(java.lang.String containerId,
                              ContainerType containerType,
                              java.lang.Class containerClass)

Specified by:
registerContainer in interface ContainerFactory
Parameters:
containerId - the id of the container to register
containerType - the container type to register (ContainerType.INSTALLED, ContainerType.EMBEDDED or ContainerType.REMOTE)
containerClass - the container implementation class to register
See Also:
ContainerFactory.registerContainer(String, org.codehaus.cargo.container.ContainerType, Class)

registerContainer

public void registerContainer(java.lang.String containerId,
                              ContainerType containerType,
                              java.lang.String containerClassName)
Registers a container using a class specified as a String.

Parameters:
containerId -
containerType -
containerClassName - the container implementation class to register as a String
See Also:
registerContainer(String, ContainerType, Class)

getContainerClass

public java.lang.Class getContainerClass(java.lang.String containerId,
                                         ContainerType containerType)

Specified by:
getContainerClass in interface ContainerFactory
Parameters:
containerId - the id of the container for which to retrieve the implementation class
containerType - the container's type (ContainerType.INSTALLED, ContainerType.EMBEDDED or ContainerType.REMOTE)
Returns:
the container implementation class
See Also:
ContainerFactory.getContainerClass(java.lang.String, org.codehaus.cargo.container.ContainerType)

createContainer

public Container createContainer(java.lang.String containerId,
                                 ContainerType containerType,
                                 Configuration configuration)
Create a container instance instantiated using the specified configuration.

Specified by:
createContainer in interface ContainerFactory
Parameters:
containerId - the name under which the container will be looked up
containerType - the container's type (local installed, local embedded, remote, etc)
configuration - the configuration to pass to the container's constructor
Returns:
the container whose class name matches the parameter passed
See Also:
ContainerFactory.createContainer(String, ContainerType, Configuration)

getConstructor

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

Specified by:
getConstructor in class AbstractGenericHintFactory
Parameters:
containerClass - implementation class for which to create the constructor
containerType - 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(java.lang.Class, java.lang.String, org.codehaus.cargo.generic.spi.AbstractGenericHintFactory.GenericParameters)

createInstance

protected java.lang.Object createInstance(java.lang.reflect.Constructor constructor,
                                          java.lang.String containerType,
                                          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
containerType - 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)

getContainerIds

public java.util.Map getContainerIds()

Specified by:
getContainerIds in interface ContainerFactory
Returns:
the list of container ids that have been registered as Map. The Map keys are the container ids and the Map values are the lists of ContainerTypes registered for that container, as a Set.
See Also:
ContainerFactory.getContainerIds()


Copyright © 2004-2011 Codehaus. All Rights Reserved.