org.jboss.deployers.structure.spi.helpers
Class ComponentDeploymentContext

java.lang.Object
  extended by org.jboss.deployers.structure.spi.helpers.ComponentDeploymentContext
All Implemented Interfaces:
Serializable, MBeanRegistration, ManagedObjectAttachments, ManagedObjectsWithTransientAttachments, PredeterminedManagedObjectAttachments, DeploymentContext, DeploymentMBean, ComponentDeploymentContextMBean

public class ComponentDeploymentContext
extends Object
implements DeploymentContext, ComponentDeploymentContextMBean, MBeanRegistration

AbstractDeploymentContext.

Version:
$Revision: 59630 $
Author:
Adrian Brock, Scott.Stark@jboss.org, Ales Justin
See Also:
Serialized Form

Field Summary
protected  org.jboss.logging.Logger log
          The log
 
Constructor Summary
ComponentDeploymentContext()
          For serialization
ComponentDeploymentContext(String name, DeploymentContext parent)
          Create a new ComponentDeploymentContext.
 
Method Summary
 void addChild(DeploymentContext child)
          Add a child
 void addComponent(DeploymentContext component)
          Add a component
 void addControllerContextName(Object name)
          Add controller context name.
 void cleanup()
          Cleanup the deployment context
 boolean createClassLoader(ClassLoaderFactory factory)
          Create a classloader
 void deployed()
          Touch the context to say it is deployed
 List<ObjectName> getChildNames()
          The children
 List<DeploymentContext> getChildren()
          The children
 ClassLoader getClassLoader()
          Gets the classloader for this deployment unit
 ObjectName getClassLoaderName()
          Gets the classloader for this deployment unit
 Comparator<DeploymentContext> getComparator()
          Get the comparator.
 List<ObjectName> getComponentNames()
          The components
 List<DeploymentContext> getComponents()
          The components
 Object getControllerContextName()
          Get underlying controller context name.
 Set<Object> getControllerContextNames()
          Get the controller context names.
 org.jboss.dependency.spi.DependencyInfo getDependencyInfo()
          Get the dependency info
 Deployment getDeployment()
          Get the deployment (if this is a top level context)
 DeploymentUnit getDeploymentUnit()
          Get the deployment unit
 org.jboss.metadata.spi.MetaData getMetaData()
          Get the metadata for this deployment context
 org.jboss.metadata.spi.MutableMetaData getMutableMetaData()
          Get the mutable metadata for this deployment context
 org.jboss.metadata.spi.scope.ScopeKey getMutableScope()
          Get the mutable scope
 String getName()
          Get the deployment name
 ObjectName getObjectName()
          Get the object name
 DeploymentContext getParent()
          The parent
 ObjectName getParentName()
          The parent
 Attachments getPredeterminedManagedObjects()
          Get the predetermined managed objects
 Throwable getProblem()
          Get the problem for this context
 int getRelativeOrder()
          Get the relative order
 String getRelativePath()
          Get the path of this deployment relative to the top of the deployment vfs path ------------------- relative path deploy/some.ear "" deploy/some.ear/x.ejb "/x.ejb" deploy/some.ear/y.sar "/y.sar" deploy/some.ear/y.sar/z.rar "/y.sar/z.rar"
 ClassLoader getResourceClassLoader()
          Get a resource classloader
 DeploymentResourceLoader getResourceLoader()
          Get a resource loader
 org.jboss.metadata.spi.scope.ScopeKey getScope()
          Get the scope
 String getSimpleName()
          Get the simple vfs name of the deployment unit.
 DeploymentState getState()
          Get the deployment state
 DeploymentContext getTopLevel()
          Get the top level deployment
 ObjectName getTopLevelName()
          Get the top level deployment
 MutableAttachments getTransientAttachments()
          Get the transient attachments
 MutableAttachments getTransientManagedObjects()
          Get the transient managed objects
 boolean isComponent()
          Whether this is a component
 boolean isDeployed()
          Whether the deployment was processed
 boolean isTopLevel()
          Whether this is a top level deployment
 String listAttachments(boolean detail)
          List the attachments as an html table
protected static void listAttachments(StringBuilder builder, Attachments attachments, boolean detail, Set<String> processed)
           
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
           
 void preDeregister()
           
 ObjectName preRegister(MBeanServer server, ObjectName name)
           
protected  void registerMBeans(DeploymentContext context, boolean registerContext, boolean registerSubDeployments)
          Register mbeans
 boolean removeChild(DeploymentContext child)
          Remove a child
 void removeClassLoader()
          Remove the classloader created by the factory
 void removeClassLoader(ClassLoaderFactory factory)
          Remove the classloader
 boolean removeComponent(DeploymentContext component)
          Remove a component
 void removeControllerContextName(Object name)
          Remove controller context name.
 void setClassLoader(ClassLoader classLoader)
          Set the class loader
 void setComparator(Comparator<DeploymentContext> comparator)
          Set the comparator.
 void setDeployment(Deployment deployment)
          Set the deployment
 void setDeploymentUnit(DeploymentUnit unit)
          Set the deployment unit
 void setMetaDataPath(String path)
           
 void setMutableScope(org.jboss.metadata.spi.scope.ScopeKey mutableScope)
          Set the mutable scope
 void setParent(DeploymentContext parent)
          Set the parent
 void setPredeterminedManagedObjects(Attachments objects)
          Set the predetermined managed objects
 void setProblem(Throwable problem)
          Set the problem for this context
 void setRelativeOrder(int relativeOrder)
          Set the relative order
 void setRequiredStage(DeploymentStage stage)
          Set the required stage.
 void setScope(org.jboss.metadata.spi.scope.ScopeKey scope)
          Set the scope
 void setState(DeploymentState state)
          Set the deployment state
 String toString()
           
protected  void unregisterMBeans(DeploymentContext context, boolean unregisterContext, boolean unregisterSubDeployments)
          Unregister mbeans
 void visit(DeploymentContextVisitor visitor)
          Visit the context and the children
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected org.jboss.logging.Logger log
The log

Constructor Detail

ComponentDeploymentContext

public ComponentDeploymentContext()
For serialization


ComponentDeploymentContext

public ComponentDeploymentContext(String name,
                                  DeploymentContext parent)
Create a new ComponentDeploymentContext.

Parameters:
name - the name
parent - the parent
Throws:
IllegalArgumentException - if the name or parent is null
Method Detail

getName

public String getName()
Description copied from interface: DeploymentContext
Get the deployment name

Specified by:
getName in interface DeploymentContext
Specified by:
getName in interface DeploymentMBean
Returns:
the name

getObjectName

public ObjectName getObjectName()
Description copied from interface: DeploymentMBean
Get the object name

Specified by:
getObjectName in interface DeploymentMBean
Returns:
the object name

getControllerContextNames

public Set<Object> getControllerContextNames()
Description copied from interface: DeploymentContext
Get the controller context names.

Specified by:
getControllerContextNames in interface DeploymentContext
Specified by:
getControllerContextNames in interface DeploymentMBean
Returns:
the names

addControllerContextName

public void addControllerContextName(Object name)
Description copied from interface: DeploymentContext
Add controller context name.

Specified by:
addControllerContextName in interface DeploymentContext
Parameters:
name - the controller context name

removeControllerContextName

public void removeControllerContextName(Object name)
Description copied from interface: DeploymentContext
Remove controller context name.

Specified by:
removeControllerContextName in interface DeploymentContext
Parameters:
name - the controller context name

getSimpleName

public String getSimpleName()
Description copied from interface: DeploymentContext
Get the simple vfs name of the deployment unit. This is the simple name of the virtual file . vfs path ------------------- relative path deploy/some.ear "some.ear" deploy/some.ear/x.ejb "x.ejb" deploy/some.ear/y.sar "y.sar" deploy/some.ear/y.sar/z.rar "z.rar"

Specified by:
getSimpleName in interface DeploymentContext
Specified by:
getSimpleName in interface DeploymentMBean
Returns:
the deployment unit simple path

getRelativePath

public String getRelativePath()
Description copied from interface: DeploymentContext
Get the path of this deployment relative to the top of the deployment vfs path ------------------- relative path deploy/some.ear "" deploy/some.ear/x.ejb "/x.ejb" deploy/some.ear/y.sar "/y.sar" deploy/some.ear/y.sar/z.rar "/y.sar/z.rar"

Specified by:
getRelativePath in interface DeploymentContext
Specified by:
getRelativePath in interface DeploymentMBean
Returns:
the top-level deployment relative path

getRelativeOrder

public int getRelativeOrder()
Description copied from interface: DeploymentContext
Get the relative order

Specified by:
getRelativeOrder in interface DeploymentContext
Specified by:
getRelativeOrder in interface DeploymentMBean
Returns:
the relative order

setRelativeOrder

public void setRelativeOrder(int relativeOrder)
Description copied from interface: DeploymentContext
Set the relative order

Specified by:
setRelativeOrder in interface DeploymentContext
Parameters:
relativeOrder - the relativeOrder

getComparator

public Comparator<DeploymentContext> getComparator()
Description copied from interface: DeploymentContext
Get the comparator.

Specified by:
getComparator in interface DeploymentContext
Specified by:
getComparator in interface DeploymentMBean
Returns:
the comparator.

setComparator

public void setComparator(Comparator<DeploymentContext> comparator)
Description copied from interface: DeploymentContext
Set the comparator.

Specified by:
setComparator in interface DeploymentContext
Parameters:
comparator - the comparator.

getScope

public org.jboss.metadata.spi.scope.ScopeKey getScope()
Description copied from interface: DeploymentContext
Get the scope

Specified by:
getScope in interface DeploymentContext
Specified by:
getScope in interface DeploymentMBean
Returns:
the scope

setScope

public void setScope(org.jboss.metadata.spi.scope.ScopeKey scope)
Description copied from interface: DeploymentContext
Set the scope

Specified by:
setScope in interface DeploymentContext
Parameters:
scope - the scope key

getMutableScope

public org.jboss.metadata.spi.scope.ScopeKey getMutableScope()
Description copied from interface: DeploymentContext
Get the mutable scope

Specified by:
getMutableScope in interface DeploymentContext
Specified by:
getMutableScope in interface DeploymentMBean
Returns:
the mutable scope

setMutableScope

public void setMutableScope(org.jboss.metadata.spi.scope.ScopeKey mutableScope)
Description copied from interface: DeploymentContext
Set the mutable scope

Specified by:
setMutableScope in interface DeploymentContext
Parameters:
mutableScope - the mutable scope key

getMetaData

public org.jboss.metadata.spi.MetaData getMetaData()
Description copied from interface: DeploymentContext
Get the metadata for this deployment context

Specified by:
getMetaData in interface DeploymentContext
Returns:
the metadata

getMutableMetaData

public org.jboss.metadata.spi.MutableMetaData getMutableMetaData()
Description copied from interface: DeploymentContext
Get the mutable metadata for this deployment context

Specified by:
getMutableMetaData in interface DeploymentContext
Returns:
the metadata

getState

public DeploymentState getState()
Description copied from interface: DeploymentContext
Get the deployment state

Specified by:
getState in interface DeploymentContext
Specified by:
getState in interface DeploymentMBean
Returns:
the state

setState

public void setState(DeploymentState state)
Description copied from interface: DeploymentContext
Set the deployment state

Specified by:
setState in interface DeploymentContext
Parameters:
state - the state

getDeploymentUnit

public DeploymentUnit getDeploymentUnit()
Description copied from interface: DeploymentContext
Get the deployment unit

Specified by:
getDeploymentUnit in interface DeploymentContext
Returns:
the deployment

setDeploymentUnit

public void setDeploymentUnit(DeploymentUnit unit)
Description copied from interface: DeploymentContext
Set the deployment unit

Specified by:
setDeploymentUnit in interface DeploymentContext
Parameters:
unit - the deployment unit

setMetaDataPath

public void setMetaDataPath(String path)

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: DeploymentContext
Gets the classloader for this deployment unit

Specified by:
getClassLoader in interface DeploymentContext
Returns:
the classloader

getClassLoaderName

public ObjectName getClassLoaderName()
Description copied from interface: DeploymentMBean
Gets the classloader for this deployment unit

Specified by:
getClassLoaderName in interface DeploymentMBean
Returns:
the classloader

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Description copied from interface: DeploymentContext
Set the class loader

Specified by:
setClassLoader in interface DeploymentContext
Parameters:
classLoader - the new classloader

createClassLoader

public boolean createClassLoader(ClassLoaderFactory factory)
                          throws DeploymentException
Description copied from interface: DeploymentContext
Create a classloader

Specified by:
createClassLoader in interface DeploymentContext
Parameters:
factory - the factory
Returns:
false if there is already is a classloader
Throws:
DeploymentException - for any error

removeClassLoader

public void removeClassLoader()
Description copied from interface: DeploymentContext
Remove the classloader created by the factory

Specified by:
removeClassLoader in interface DeploymentContext

removeClassLoader

public void removeClassLoader(ClassLoaderFactory factory)
Description copied from interface: DeploymentContext
Remove the classloader

Specified by:
removeClassLoader in interface DeploymentContext
Parameters:
factory - the original factory used to create the classloader

isTopLevel

public boolean isTopLevel()
Description copied from interface: DeploymentContext
Whether this is a top level deployment

Specified by:
isTopLevel in interface DeploymentContext
Specified by:
isTopLevel in interface DeploymentMBean
Returns:
true when top level

getTopLevel

public DeploymentContext getTopLevel()
Description copied from interface: DeploymentContext
Get the top level deployment

Specified by:
getTopLevel in interface DeploymentContext
Returns:
the top level deployment

getTopLevelName

public ObjectName getTopLevelName()
Description copied from interface: DeploymentMBean
Get the top level deployment

Specified by:
getTopLevelName in interface DeploymentMBean
Returns:
the top level deployment

getParent

public DeploymentContext getParent()
Description copied from interface: DeploymentContext
The parent

Specified by:
getParent in interface DeploymentContext
Returns:
the parent

getParentName

public ObjectName getParentName()
Description copied from interface: DeploymentMBean
The parent

Specified by:
getParentName in interface DeploymentMBean
Returns:
the parent

setParent

public void setParent(DeploymentContext parent)
Description copied from interface: DeploymentContext
Set the parent

Specified by:
setParent in interface DeploymentContext
Parameters:
parent - the parent

getChildren

public List<DeploymentContext> getChildren()
Description copied from interface: DeploymentContext
The children

Specified by:
getChildren in interface DeploymentContext
Returns:
the children

getChildNames

public List<ObjectName> getChildNames()
Description copied from interface: DeploymentMBean
The children

Specified by:
getChildNames in interface DeploymentMBean
Returns:
the children

addChild

public void addChild(DeploymentContext child)
Description copied from interface: DeploymentContext
Add a child

Specified by:
addChild in interface DeploymentContext
Parameters:
child - the child to add

removeChild

public boolean removeChild(DeploymentContext child)
Description copied from interface: DeploymentContext
Remove a child

Specified by:
removeChild in interface DeploymentContext
Parameters:
child - the child to remove
Returns:
whether it was removed

getDeployment

public Deployment getDeployment()
Description copied from interface: DeploymentContext
Get the deployment (if this is a top level context)

Specified by:
getDeployment in interface DeploymentContext
Returns:
the deployment

setDeployment

public void setDeployment(Deployment deployment)
Description copied from interface: DeploymentContext
Set the deployment

Specified by:
setDeployment in interface DeploymentContext
Parameters:
deployment - the deployment

isComponent

public boolean isComponent()
Description copied from interface: DeploymentContext
Whether this is a component

Specified by:
isComponent in interface DeploymentContext
Specified by:
isComponent in interface DeploymentMBean
Returns:
true when a component

getComponents

public List<DeploymentContext> getComponents()
Description copied from interface: DeploymentContext
The components

Specified by:
getComponents in interface DeploymentContext
Returns:
the components

getComponentNames

public List<ObjectName> getComponentNames()
Description copied from interface: DeploymentMBean
The components

Specified by:
getComponentNames in interface DeploymentMBean
Returns:
the components

addComponent

public void addComponent(DeploymentContext component)
Description copied from interface: DeploymentContext
Add a component

Specified by:
addComponent in interface DeploymentContext
Parameters:
component - the componnet to add

removeComponent

public boolean removeComponent(DeploymentContext component)
Description copied from interface: DeploymentContext
Remove a component

Specified by:
removeComponent in interface DeploymentContext
Parameters:
component - the component to remove
Returns:
whether it was removed

getResourceClassLoader

public ClassLoader getResourceClassLoader()
Description copied from interface: DeploymentContext
Get a resource classloader

Specified by:
getResourceClassLoader in interface DeploymentContext
Returns:
the resource classloader loader

getResourceLoader

public DeploymentResourceLoader getResourceLoader()
Description copied from interface: DeploymentContext
Get a resource loader

Specified by:
getResourceLoader in interface DeploymentContext
Returns:
the resource loader

getControllerContextName

public Object getControllerContextName()
Description copied from interface: DeploymentContext
Get underlying controller context name.

Specified by:
getControllerContextName in interface DeploymentContext
Returns:
the controller context name

setRequiredStage

public void setRequiredStage(DeploymentStage stage)
Description copied from interface: DeploymentContext
Set the required stage.

Specified by:
setRequiredStage in interface DeploymentContext
Parameters:
stage - the required stage

getDependencyInfo

public org.jboss.dependency.spi.DependencyInfo getDependencyInfo()
Description copied from interface: DeploymentContext
Get the dependency info

Specified by:
getDependencyInfo in interface DeploymentContext
Specified by:
getDependencyInfo in interface DeploymentMBean
Returns:
the dependency

listAttachments

public String listAttachments(boolean detail)
Description copied from interface: ComponentDeploymentContextMBean
List the attachments as an html table

Specified by:
listAttachments in interface ComponentDeploymentContextMBean
Parameters:
detail - whether to show the attachment
Returns:
the html formatted string

listAttachments

protected static void listAttachments(StringBuilder builder,
                                      Attachments attachments,
                                      boolean detail,
                                      Set<String> processed)

visit

public void visit(DeploymentContextVisitor visitor)
           throws DeploymentException
Description copied from interface: DeploymentContext
Visit the context and the children

Specified by:
visit in interface DeploymentContext
Parameters:
visitor - the visitor
Throws:
DeploymentException - for any error in the visitor

getPredeterminedManagedObjects

public Attachments getPredeterminedManagedObjects()
Description copied from interface: PredeterminedManagedObjectAttachments
Get the predetermined managed objects

Specified by:
getPredeterminedManagedObjects in interface PredeterminedManagedObjectAttachments
Returns:
the predetermined managed objects

setPredeterminedManagedObjects

public void setPredeterminedManagedObjects(Attachments objects)
Description copied from interface: PredeterminedManagedObjectAttachments
Set the predetermined managed objects

Specified by:
setPredeterminedManagedObjects in interface PredeterminedManagedObjectAttachments
Parameters:
objects - the predetermined managed objects

getTransientManagedObjects

public MutableAttachments getTransientManagedObjects()
Description copied from interface: ManagedObjectAttachments
Get the transient managed objects

Specified by:
getTransientManagedObjects in interface ManagedObjectAttachments
Returns:
the managed objects

getTransientAttachments

public MutableAttachments getTransientAttachments()
Description copied from interface: ManagedObjectsWithTransientAttachments
Get the transient attachments

Specified by:
getTransientAttachments in interface ManagedObjectsWithTransientAttachments
Returns:
the managed objects

getProblem

public Throwable getProblem()
Description copied from interface: DeploymentContext
Get the problem for this context

Specified by:
getProblem in interface DeploymentContext
Specified by:
getProblem in interface DeploymentMBean
Returns:
the problem

setProblem

public void setProblem(Throwable problem)
Description copied from interface: DeploymentContext
Set the problem for this context

Specified by:
setProblem in interface DeploymentContext
Parameters:
problem - the problem

deployed

public void deployed()
Description copied from interface: DeploymentContext
Touch the context to say it is deployed

Specified by:
deployed in interface DeploymentContext

isDeployed

public boolean isDeployed()
Description copied from interface: DeploymentContext
Whether the deployment was processed

Specified by:
isDeployed in interface DeploymentContext
Specified by:
isDeployed in interface DeploymentMBean
Returns:
true when processed

cleanup

public void cleanup()
Description copied from interface: DeploymentContext
Cleanup the deployment context

Specified by:
cleanup in interface DeploymentContext

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

registerMBeans

protected void registerMBeans(DeploymentContext context,
                              boolean registerContext,
                              boolean registerSubDeployments)
Register mbeans

Parameters:
context - the context
registerContext - whether to register the context or just its children and components
registerSubDeployments - whether to register subdeployments

unregisterMBeans

protected void unregisterMBeans(DeploymentContext context,
                                boolean unregisterContext,
                                boolean unregisterSubDeployments)
Unregister mbeans

Parameters:
context - the context
unregisterContext - whether to unregister the context or just its children and components
unregisterSubDeployments - whether to unregister subdeployments

toString

public String toString()
Overrides:
toString in class Object


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