org.codehaus.cargo.generic
Interface ContainerFactory

All Known Implementing Classes:
DefaultContainerFactory

public interface ContainerFactory

Allow instantiating a container by id (e.g. "resin3x").

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

Method Summary
 org.codehaus.cargo.container.Container createContainer(java.lang.String containerId, org.codehaus.cargo.container.ContainerType containerType, org.codehaus.cargo.container.configuration.Configuration configuration)
          Create a container instance instantiated using the specified configuration.
 java.lang.Class getContainerClass(java.lang.String containerId, org.codehaus.cargo.container.ContainerType containerType)
           
 java.util.Map getContainerIds()
           
 boolean isContainerRegistered(java.lang.String containerId, org.codehaus.cargo.container.ContainerType containerType)
           
 void registerContainer(java.lang.String containerId, org.codehaus.cargo.container.ContainerType containerType, java.lang.Class containerClass)
           
 

Method Detail

registerContainer

public void registerContainer(java.lang.String containerId,
                              org.codehaus.cargo.container.ContainerType containerType,
                              java.lang.Class containerClass)
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

getContainerClass

public java.lang.Class getContainerClass(java.lang.String containerId,
                                         org.codehaus.cargo.container.ContainerType containerType)
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

isContainerRegistered

public boolean isContainerRegistered(java.lang.String containerId,
                                     org.codehaus.cargo.container.ContainerType containerType)
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

getContainerIds

public java.util.Map getContainerIds()
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.

createContainer

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

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


Copyright © 2004-2007 Codehaus. All Rights Reserved.