org.ow2.util.ee.deploy.impl.deployer
Class DeployerManager

java.lang.Object
  extended by org.ow2.util.ee.deploy.impl.deployer.DeployerManager
All Implemented Interfaces:
IDeployerManager

public final class DeployerManager
extends Object
implements IDeployerManager

This manager is managing different deployers. The deployer that will be used is a deployer that is supporting a given IDeployable object. If there are many deployers for the same type of Deployable, the first deployer that is supporting the given deployable will be used. At each deployment/undeployment phase, invoke registered callbacks.

Author:
Florent Benoit, Francois Fornaciari (Callback support), Jeremy Cazaux (deployment/undeployment of a list of deployables)

Field Summary
static String DEPLOYER_FACTORY_CLASS_NAME
          Name of the property thats defines the deployer's class.
 
Constructor Summary
DeployerManager()
          Create a new Manager of deployer.
 
Method Summary
 void addCallback(IDeployerManagerCallback callback)
          Add a new callback instance that will be invoked at each deployment/undeployment phase.
 void addCallback(IDeployerManagerReportCallback callback)
          
 void deploy(IDeployable<?> deployable)
          Deploy a given deployable by finding the first deployer that accept this type of deployable.
 List<IDeploymentReport> deploy(List<IDeployable<?>> deployables)
          
protected  List<IDeploymentReport> deployOneTypeList(List<IDeployable<?>> deployables)
          Deploy a one type list of deployable by finding the first deployer that accept this type of deployable.
protected  List<IDeploymentReport> doDeploymentOperation(List<IDeployable<?>> deployables, boolean isDeployOperation)
          Do a deployment operation with a multi type list of deployable by finding the first deployer that accept each type of deployable.
protected  IDeployer findDeployerForDeployable(IDeployable<?> deployable)
          Find the first available deployer that is supporting the given deployable.
protected  IDeployer findDeployerForDeployables(List<IDeployable<?>> deployables)
          Find the first available deployer that is supporting the given deployable.
 List<String> getDeployerClasses()
          
 boolean isDeployed(IDeployable<?> deployable)
          Deploy a given deployable by finding the first deployer that accept this type of deployable.
 void register(IDeployer deployer)
          Register a new Deployer on this manager instance.
 void removeCallback(IDeployerManagerCallback callback)
          Remove a callback instance.
 void removeCallback(IDeployerManagerReportCallback callback)
          
 void undeploy(IDeployable<?> deployable)
          Undeploy a given deployable by finding the first deployer that accept this type of deployable.
 List<IDeploymentReport> undeploy(List<IDeployable<?>> deployables)
          
protected  List<IDeploymentReport> undeployOneTypeList(List<IDeployable<?>> deployables)
          Undeploy a one type list of deployable by finding the first deployer that accept this type of deployable.
 void unregister(IDeployer deployer)
          Unregister a Deployer from this manager instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEPLOYER_FACTORY_CLASS_NAME

public static final String DEPLOYER_FACTORY_CLASS_NAME
Name of the property thats defines the deployer's class. (optional)

Constructor Detail

DeployerManager

public DeployerManager()
Create a new Manager of deployer.

Method Detail

register

public void register(IDeployer deployer)
Register a new Deployer on this manager instance.

Specified by:
register in interface IDeployerManager
Parameters:
deployer - the deployer to register

unregister

public void unregister(IDeployer deployer)
Unregister a Deployer from this manager instance.

Specified by:
unregister in interface IDeployerManager
Parameters:
deployer - the given deployer to unregister.

findDeployerForDeployable

protected IDeployer findDeployerForDeployable(IDeployable<?> deployable)
                                       throws UnsupportedDeployerException
Find the first available deployer that is supporting the given deployable.

Parameters:
deployable - the given deployable to test.
Returns:
the fist available deployer
Throws:
UnsupportedDeployerException - if no deployer is found for the given deployable.

findDeployerForDeployables

protected IDeployer findDeployerForDeployables(List<IDeployable<?>> deployables)
                                        throws UnsupportedDeployerException
Find the first available deployer that is supporting the given deployable.

Parameters:
deployables - the list of deployable to test.
Returns:
the fist available deployer
Throws:
UnsupportedDeployerException - if no deployer is found for these deployables.

deploy

public void deploy(IDeployable<?> deployable)
            throws DeployerException,
                   UnsupportedDeployerException
Deploy a given deployable by finding the first deployer that accept this type of deployable.

Specified by:
deploy in interface IDeployerManager
Parameters:
deployable - the given deployable to deploy.
Throws:
DeployerException - if it cannot be undeployed.
UnsupportedDeployerException - if no deployer is found for the given deployable.

doDeploymentOperation

protected List<IDeploymentReport> doDeploymentOperation(List<IDeployable<?>> deployables,
                                                        boolean isDeployOperation)
Do a deployment operation with a multi type list of deployable by finding the first deployer that accept each type of deployable.

Parameters:
deployables - the list of deployable to deploy.
isDeployOperation - True if it's a deploy operation. Otherwise it's an undeploy operation
Returns:
the list of IDeploymentReport

deploy

public List<IDeploymentReport> deploy(List<IDeployable<?>> deployables)

Specified by:
deploy in interface IDeployerManager

deployOneTypeList

protected List<IDeploymentReport> deployOneTypeList(List<IDeployable<?>> deployables)
Deploy a one type list of deployable by finding the first deployer that accept this type of deployable.

Parameters:
deployables - the list of deployable to deploy.
Returns:
the IDeploymentReport

undeployOneTypeList

protected List<IDeploymentReport> undeployOneTypeList(List<IDeployable<?>> deployables)
Undeploy a one type list of deployable by finding the first deployer that accept this type of deployable.

Parameters:
deployables - the list of deployable to undeploy.
Returns:
the IDeploymentReport

undeploy

public void undeploy(IDeployable<?> deployable)
              throws DeployerException,
                     UnsupportedDeployerException
Undeploy a given deployable by finding the first deployer that accept this type of deployable.

Specified by:
undeploy in interface IDeployerManager
Parameters:
deployable - the given deployable to undeploy.
Throws:
DeployerException - if it cannot be undeployed.
UnsupportedDeployerException - if no deployer is found for the given deployable.

undeploy

public List<IDeploymentReport> undeploy(List<IDeployable<?>> deployables)

Specified by:
undeploy in interface IDeployerManager

getDeployerClasses

public List<String> getDeployerClasses()

Specified by:
getDeployerClasses in interface IDeployerManager

isDeployed

public boolean isDeployed(IDeployable<?> deployable)
                   throws DeployerException,
                          UnsupportedDeployerException
Deploy a given deployable by finding the first deployer that accept this type of deployable.

Specified by:
isDeployed in interface IDeployerManager
Parameters:
deployable - the given deployable to deploy.
Throws:
DeployerException - if it cannot be undeployed.
UnsupportedDeployerException - if no deployer is found for the given deployable.

addCallback

public void addCallback(IDeployerManagerCallback callback)
Add a new callback instance that will be invoked at each deployment/undeployment phase.

Specified by:
addCallback in interface IDeployerManager
Parameters:
callback - The given callback

removeCallback

public void removeCallback(IDeployerManagerCallback callback)
Remove a callback instance.

Specified by:
removeCallback in interface IDeployerManager
Parameters:
callback - The given callback

addCallback

public void addCallback(IDeployerManagerReportCallback callback)

Specified by:
addCallback in interface IDeployerManager

removeCallback

public void removeCallback(IDeployerManagerReportCallback callback)

Specified by:
removeCallback in interface IDeployerManager


Copyright © 2007-2012 OW2 Consortium. All Rights Reserved.