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:
org.ow2.util.ee.deploy.api.deployer.IDeployerManager

public final class DeployerManager
extends Object
implements org.ow2.util.ee.deploy.api.deployer.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)

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(org.ow2.util.ee.deploy.api.deployer.IDeployerManagerCallback callback)
          Add a new callback instance that will be invoked at each deployment/undeployment phase.
 void deploy(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Deploy a given deployable by finding the first deployer that accept this type of deployable.
protected  org.ow2.util.ee.deploy.api.deployer.IDeployer findDeployerForDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Find the first available deployer that is supporting the given deployable.
 boolean isDeployed(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Deploy a given deployable by finding the first deployer that accept this type of deployable.
 void register(org.ow2.util.ee.deploy.api.deployer.IDeployer deployer)
          Register a new Deployer on this manager instance.
 void removeCallback(org.ow2.util.ee.deploy.api.deployer.IDeployerManagerCallback callback)
          Remove a callback instance.
 void undeploy(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
          Undeploy a given deployable by finding the first deployer that accept this type of deployable.
 void unregister(org.ow2.util.ee.deploy.api.deployer.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(org.ow2.util.ee.deploy.api.deployer.IDeployer deployer)
Register a new Deployer on this manager instance.

Specified by:
register in interface org.ow2.util.ee.deploy.api.deployer.IDeployerManager
Parameters:
deployer - the deployer to register

unregister

public void unregister(org.ow2.util.ee.deploy.api.deployer.IDeployer deployer)
Unregister a Deployer from this manager instance.

Specified by:
unregister in interface org.ow2.util.ee.deploy.api.deployer.IDeployerManager
Parameters:
deployer - the given deployer to unregister.

findDeployerForDeployable

protected org.ow2.util.ee.deploy.api.deployer.IDeployer findDeployerForDeployable(org.ow2.util.ee.deploy.api.deployable.IDeployable<?> deployable)
                                                                           throws org.ow2.util.ee.deploy.api.deployer.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:
org.ow2.util.ee.deploy.api.deployer.UnsupportedDeployerException - if no deployer is found for the given deployable.

deploy

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

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

undeploy

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

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

isDeployed

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

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

addCallback

public void addCallback(org.ow2.util.ee.deploy.api.deployer.IDeployerManagerCallback callback)
Add a new callback instance that will be invoked at each deployment/undeployment phase.

Specified by:
addCallback in interface org.ow2.util.ee.deploy.api.deployer.IDeployerManager
Parameters:
callback - The given callback

removeCallback

public void removeCallback(org.ow2.util.ee.deploy.api.deployer.IDeployerManagerCallback callback)
Remove a callback instance.

Specified by:
removeCallback in interface org.ow2.util.ee.deploy.api.deployer.IDeployerManager
Parameters:
callback - The given callback


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