org.jboss.deployers.plugins.deployers
Class DeployersImpl

java.lang.Object
  extended by org.jboss.deployers.plugins.deployers.DeployersImpl
All Implemented Interfaces:
MBeanRegistration, org.jboss.dependency.spi.ControllerContextActions, DeployersImplMBean, Deployers

public class DeployersImpl
extends Object
implements Deployers, org.jboss.dependency.spi.ControllerContextActions, DeployersImplMBean, MBeanRegistration

DeployersImpl.

Version:
$Revision: 84534 $
Author:
Adrian Brock, Ales Justin

Constructor Summary
DeployersImpl(org.jboss.dependency.spi.Controller controller)
          Create a new DeployersImpl.
DeployersImpl(org.jboss.dependency.spi.Controller controller, Set<Deployer> deployers)
          Create a new DeployersImpl.
 
Method Summary
 void addDeployer(Deployer deployer)
          Add a deployer
protected  void addDeploymentStage(DeploymentStage stage)
          Add a deployment stage
 void change(DeploymentContext context, DeploymentStage stage)
          Change the state of a deployment
protected  void checkComplete(boolean checkContexts, DeploymentContext... contexts)
          Check if deployments are complete.
 void checkComplete(Collection<DeploymentContext> errors, Collection<Deployment> missingDeployer)
          Check all the deployments are complete
 void checkComplete(DeploymentContext... contexts)
          Check if deployments are complete
protected  void checkComplete(DeploymentContext context, Map<String,Throwable> contextsInError, Map<String,Set<MissingDependency>> contextsMissingDependencies, Set<org.jboss.dependency.spi.ControllerContext> notInstalled, org.jboss.dependency.spi.ControllerStateModel states)
          Check complete on deployment context.
protected  void checkControllerContext(org.jboss.dependency.spi.ControllerContext context, Map<String,Throwable> contextsInError, Map<String,Set<MissingDependency>> contextsMissingDependencies, org.jboss.dependency.spi.ControllerStateModel states)
          Check controller context.
protected  void checkControllerContext(org.jboss.dependency.spi.ControllerContext context, Map<String,Throwable> contextsInError, Map<String,Set<MissingDependency>> contextsMissingDependencies, Set<org.jboss.dependency.spi.ControllerContext> notInstalled, org.jboss.dependency.spi.ControllerStateModel states)
          Check complete on deployment context.
protected  void checkShutdown()
          Check whether we are shutdown
 void checkStructureComplete(DeploymentContext... contexts)
          Check if deployments are structurally complete
protected  void doDeploy(Deployer deployer, DeploymentUnit unit)
          Do a deployment
protected  void doInstallParentFirst(Deployer deployer, DeploymentContext context)
          Do the install parent first
protected  void doInstallParentLast(Deployer deployer, DeploymentContext context)
          Do the install parent last
protected  void doUndeploy(Deployer deployer, DeploymentUnit unit)
          Do an undeployment
protected  void doUninstallParentFirst(Deployer deployer, DeploymentContext context, boolean doContext, boolean doComponents)
          Do the uninstall parent first
protected  void doUninstallParentLast(Deployer deployer, DeploymentContext context, boolean doChildren, boolean doComponents)
          Do the uninstall parent last
 ManagedObjectCreator getDeployerManagedObjectBuilder(Deployer deployer)
          Get the ManagedObjectBuilder for a deployer.
protected  List<Deployer> getDeployersList(String stageName)
          Build a list of deployers for this stage
 Set<DeployerWrapper> getDeployerWrappers()
          Get the deployers.
 DeploymentStage getDeploymentStage(DeploymentContext context)
          Get the deployment stage for a deployment
 Map<String,org.jboss.managed.api.ManagedObject> getManagedObjects(DeploymentContext context)
          Get the managed objects for a deployer
 ManagedObjectCreator getMgtObjectCreator()
           
 org.jboss.metadata.spi.repository.MutableMetaDataRepository getRepository()
          Get the repository.
 ScopeBuilder getScopeBuilder()
          Get the scopeBuilder.
protected  List<Deployer> insert(List<Deployer> original, Deployer newDeployer)
          Insert the new Deployer.
 void install(org.jboss.dependency.spi.ControllerContext context, org.jboss.dependency.spi.ControllerState fromState, org.jboss.dependency.spi.ControllerState toState)
           
protected  void internalListDeployers(String stageName, String attachment, StringBuilder builder)
          List the deployers for a stage
 boolean isCollectStats()
          Get the collectStats.
protected  boolean isDeployed(DeploymentContext context)
          Is context deployed.
 boolean isRegisterMBeans()
          Get whether to register mbeans
protected  boolean isRelevant(Deployer deployer, DeploymentUnit unit, boolean isTopLevel, boolean isComponent)
          Test whether a deployer is relevant
 String listDeployers(String stageName)
          List the deployers for each stage in order
 String listDeployersByAttachment(String attachment)
          List the deployers for a given attachment
 String listDeployerTimes(boolean details)
          List the deployer times
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer server, ObjectName name)
           
 void process(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
          Process deployment
protected  void registerMBean(DeploymentContext context)
          Register a deployment context's mbean
 void removeDeployer(Deployer deployer)
          Remove a deployer
 void setCollectStats(boolean collectStats)
          Set the collectStats.
 void setDeployerManagedObjectBuilder(Deployer deployer, ManagedObjectCreator managedObjectCreator)
          Set the ManagedObjectBuilder for a deployer.
 void setDeployers(Set<Deployer> deployers)
          Set the deployers.
 void setMgtObjectCreator(ManagedObjectCreator mgtObjectCreator)
           
 void setRegisterMBeans(boolean registerMBeans)
          Set whether to register mbeans
 void setRepository(org.jboss.metadata.spi.repository.MutableMetaDataRepository repository)
          Set the repository.
 void setScopeBuilder(ScopeBuilder scopeBuilder)
          Set the scopeBuilder.
 void shutdown()
          Shutdown.
 void start()
           
 void uninstall(org.jboss.dependency.spi.ControllerContext context, org.jboss.dependency.spi.ControllerState fromState, org.jboss.dependency.spi.ControllerState toState)
           
protected  void unregisterMBean(DeploymentContext context)
          Unregister a deployment context's mbean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeployersImpl

public DeployersImpl(org.jboss.dependency.spi.Controller controller)
Create a new DeployersImpl.

Parameters:
controller - the controller
Throws:
IllegalArgumentException - for a null controller

DeployersImpl

public DeployersImpl(org.jboss.dependency.spi.Controller controller,
                     Set<Deployer> deployers)
Create a new DeployersImpl.

Parameters:
controller - the controller
deployers - the deployers
Throws:
IllegalArgumentException - for a null controller
Method Detail

shutdown

public void shutdown()
Description copied from interface: Deployers
Shutdown. Stops any further deployment

Specified by:
shutdown in interface Deployers

checkShutdown

protected void checkShutdown()
Check whether we are shutdown


isCollectStats

public boolean isCollectStats()
Get the collectStats.

Returns:
the collectStats.

setCollectStats

public void setCollectStats(boolean collectStats)
Set the collectStats.

Parameters:
collectStats - the collectStats.

getDeployerWrappers

public Set<DeployerWrapper> getDeployerWrappers()
Get the deployers.

Returns:
the deployers.

setDeployers

public void setDeployers(Set<Deployer> deployers)
Set the deployers.

Parameters:
deployers - the deployers.
Throws:
IllegalArgumentException - for null deployers

addDeployer

public void addDeployer(Deployer deployer)
Add a deployer

Parameters:
deployer - the deployer

removeDeployer

public void removeDeployer(Deployer deployer)
Remove a deployer

Parameters:
deployer - the deployer

addDeploymentStage

protected void addDeploymentStage(DeploymentStage stage)
Add a deployment stage

Parameters:
stage - the deployment stage

getScopeBuilder

public ScopeBuilder getScopeBuilder()
Get the scopeBuilder.

Returns:
the scopeBuilder.

setScopeBuilder

public void setScopeBuilder(ScopeBuilder scopeBuilder)
Set the scopeBuilder.

Parameters:
scopeBuilder - the scopeBuilder.

getMgtObjectCreator

public ManagedObjectCreator getMgtObjectCreator()

setMgtObjectCreator

public void setMgtObjectCreator(ManagedObjectCreator mgtObjectCreator)

getRepository

public org.jboss.metadata.spi.repository.MutableMetaDataRepository getRepository()
Get the repository.

Returns:
the repository.

setRepository

public void setRepository(org.jboss.metadata.spi.repository.MutableMetaDataRepository repository)
Set the repository.

Parameters:
repository - the repository.

isRegisterMBeans

public boolean isRegisterMBeans()
Get whether to register mbeans

Returns:
true to register mbeans

setRegisterMBeans

public void setRegisterMBeans(boolean registerMBeans)
Set whether to register mbeans

Parameters:
registerMBeans - true to register mbeans

start

public void start()

getManagedObjects

public Map<String,org.jboss.managed.api.ManagedObject> getManagedObjects(DeploymentContext context)
                                                                  throws DeploymentException
Description copied from interface: Deployers
Get the managed objects for a deployer

Specified by:
getManagedObjects in interface Deployers
Parameters:
context - the context
Returns:
the managed objects
Throws:
DeploymentException - for any error

getDeployerManagedObjectBuilder

public ManagedObjectCreator getDeployerManagedObjectBuilder(Deployer deployer)
Get the ManagedObjectBuilder for a deployer.

Parameters:
deployer - - the deployer to set the ManagedObjectBuilder for.
Returns:
managedObjectBuilder for deployer, may be null
Throws:
IllegalArgumentException - for a null deployer

setDeployerManagedObjectBuilder

public void setDeployerManagedObjectBuilder(Deployer deployer,
                                            ManagedObjectCreator managedObjectCreator)
Set the ManagedObjectBuilder for a deployer. This allows one to override the given deployer ManagedObjectBuilder or assign one when the deployer does not provide a ManagedObjectBuilder.

Parameters:
deployer - - the deployer to set the ManagedObjectBuilder for.
managedObjectCreator - the managed object builder to set to the deployer
Throws:
IllegalArgumentException - for a null deployer

listDeployerTimes

public String listDeployerTimes(boolean details)
Description copied from interface: DeployersImplMBean
List the deployer times

Specified by:
listDeployerTimes in interface DeployersImplMBean
Parameters:
details - whether to show details
Returns:
the deployer times

listDeployers

public String listDeployers(String stageName)
Description copied from interface: DeployersImplMBean
List the deployers for each stage in order

Specified by:
listDeployers in interface DeployersImplMBean
Parameters:
stageName - the stage name or null for all stages
Returns:
an html formatted table

listDeployersByAttachment

public String listDeployersByAttachment(String attachment)
Description copied from interface: DeployersImplMBean
List the deployers for a given attachment

Specified by:
listDeployersByAttachment in interface DeployersImplMBean
Parameters:
attachment - the attachment name
Returns:
an html formatted table

internalListDeployers

protected void internalListDeployers(String stageName,
                                     String attachment,
                                     StringBuilder builder)
List the deployers for a stage

Parameters:
stageName - the stage
attachment - the attachment
builder - the builder

getDeploymentStage

public DeploymentStage getDeploymentStage(DeploymentContext context)
                                   throws DeploymentException
Description copied from interface: Deployers
Get the deployment stage for a deployment

Specified by:
getDeploymentStage in interface Deployers
Parameters:
context - the context
Returns:
the stage or null if not deployed
Throws:
DeploymentException - for any error

change

public void change(DeploymentContext context,
                   DeploymentStage stage)
            throws DeploymentException
Description copied from interface: Deployers
Change the state of a deployment

Specified by:
change in interface Deployers
Parameters:
context - the context
stage - the stage
Throws:
DeploymentException - for any error

process

public void process(List<DeploymentContext> deploy,
                    List<DeploymentContext> undeploy)
Description copied from interface: Deployers
Process deployment

Specified by:
process in interface Deployers
Parameters:
deploy - the deployments to deploy
undeploy - the deployments to remove

checkComplete

public void checkComplete(Collection<DeploymentContext> errors,
                          Collection<Deployment> missingDeployer)
                   throws DeploymentException
Description copied from interface: Deployers
Check all the deployments are complete

Specified by:
checkComplete in interface Deployers
Parameters:
errors - the contexts in error
missingDeployer - the deployments missing a deployer
Throws:
DeploymentException - when some deployment is not complete

checkControllerContext

protected final void checkControllerContext(org.jboss.dependency.spi.ControllerContext context,
                                            Map<String,Throwable> contextsInError,
                                            Map<String,Set<MissingDependency>> contextsMissingDependencies,
                                            org.jboss.dependency.spi.ControllerStateModel states)
Check controller context.

Parameters:
context - the controller context
contextsInError - contexts in error map
contextsMissingDependencies - contexts missing dependecies map
states - controller states

checkComplete

public void checkComplete(DeploymentContext... contexts)
                   throws DeploymentException
Description copied from interface: Deployers
Check if deployments are complete

Specified by:
checkComplete in interface Deployers
Parameters:
contexts - the deployments
Throws:
DeploymentException - when the deployment is not complete

checkStructureComplete

public void checkStructureComplete(DeploymentContext... contexts)
                            throws DeploymentException
Description copied from interface: Deployers
Check if deployments are structurally complete

Specified by:
checkStructureComplete in interface Deployers
Parameters:
contexts - the deployments
Throws:
DeploymentException - when the deployment is not complete

checkComplete

protected void checkComplete(boolean checkContexts,
                             DeploymentContext... contexts)
                      throws DeploymentException
Check if deployments are complete.

Parameters:
contexts - the deployment contexts
checkContexts - do we check contexts
Throws:
DeploymentException - throw error if deployment is incomplete

isDeployed

protected boolean isDeployed(DeploymentContext context)
Is context deployed.

Parameters:
context - the deployment context
Returns:
true if context deployed, false otherwise

checkComplete

protected final void checkComplete(DeploymentContext context,
                                   Map<String,Throwable> contextsInError,
                                   Map<String,Set<MissingDependency>> contextsMissingDependencies,
                                   Set<org.jboss.dependency.spi.ControllerContext> notInstalled,
                                   org.jboss.dependency.spi.ControllerStateModel states)
Check complete on deployment context.

Parameters:
context - the deployment context
contextsInError - contexts in error map
contextsMissingDependencies - contexts missing dependecies map
notInstalled - the not installed contexts
states - controller states

checkControllerContext

protected void checkControllerContext(org.jboss.dependency.spi.ControllerContext context,
                                      Map<String,Throwable> contextsInError,
                                      Map<String,Set<MissingDependency>> contextsMissingDependencies,
                                      Set<org.jboss.dependency.spi.ControllerContext> notInstalled,
                                      org.jboss.dependency.spi.ControllerStateModel states)
Check complete on deployment context.

Parameters:
context - the deployment context
contextsInError - contexts in error map
contextsMissingDependencies - contexts missing dependecies map
notInstalled - the not installed contexts
states - controller states

install

public void install(org.jboss.dependency.spi.ControllerContext context,
                    org.jboss.dependency.spi.ControllerState fromState,
                    org.jboss.dependency.spi.ControllerState toState)
             throws Throwable
Specified by:
install in interface org.jboss.dependency.spi.ControllerContextActions
Throws:
Throwable

doInstallParentFirst

protected void doInstallParentFirst(Deployer deployer,
                                    DeploymentContext context)
                             throws Throwable
Do the install parent first

Parameters:
deployer - the deployer
context - the context
Throws:
Throwable - for any problem

doInstallParentLast

protected void doInstallParentLast(Deployer deployer,
                                   DeploymentContext context)
                            throws Throwable
Do the install parent last

Parameters:
deployer - the deployer
context - the context
Throws:
Throwable - for any problem

uninstall

public void uninstall(org.jboss.dependency.spi.ControllerContext context,
                      org.jboss.dependency.spi.ControllerState fromState,
                      org.jboss.dependency.spi.ControllerState toState)
Specified by:
uninstall in interface org.jboss.dependency.spi.ControllerContextActions

doUninstallParentLast

protected void doUninstallParentLast(Deployer deployer,
                                     DeploymentContext context,
                                     boolean doChildren,
                                     boolean doComponents)
Do the uninstall parent last

Parameters:
deployer - the deployer
context - the context
doChildren - whether to do children
doComponents - whether to do components

doUninstallParentFirst

protected void doUninstallParentFirst(Deployer deployer,
                                      DeploymentContext context,
                                      boolean doContext,
                                      boolean doComponents)
Do the uninstall parent first

Parameters:
deployer - the deployer
context - the context
doContext - whether to do context
doComponents - whether to do components

doDeploy

protected void doDeploy(Deployer deployer,
                        DeploymentUnit unit)
                 throws DeploymentException
Do a deployment

Parameters:
deployer - the deployer
unit - the deployment unit
Throws:
DeploymentException - for any error

doUndeploy

protected void doUndeploy(Deployer deployer,
                          DeploymentUnit unit)
Do an undeployment

Parameters:
deployer - the deployer
unit - the deployment unit

getDeployersList

protected List<Deployer> getDeployersList(String stageName)
Build a list of deployers for this stage

Parameters:
stageName - the stage name
Returns:
the deployers

isRelevant

protected boolean isRelevant(Deployer deployer,
                             DeploymentUnit unit,
                             boolean isTopLevel,
                             boolean isComponent)
Test whether a deployer is relevant

Parameters:
deployer - deployer
unit - the deployment unit
isTopLevel - whether this is a top level deployment
isComponent - whether this is a component
Returns:
the deployers

insert

protected List<Deployer> insert(List<Deployer> original,
                                Deployer newDeployer)
Insert the new Deployer.

Parameters:
original - the original deployers
newDeployer - the new deployer
Returns:
the sorted deployers

registerMBean

protected void registerMBean(DeploymentContext context)
Register a deployment context's mbean

Parameters:
context - the context

unregisterMBean

protected void unregisterMBean(DeploymentContext context)
Unregister a deployment context's mbean

Parameters:
context - the context

preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface MBeanRegistration
Throws:
Exception

postRegister

public void postRegister(Boolean registrationDone)
Specified by:
postRegister in interface MBeanRegistration

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface MBeanRegistration


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.