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

java.lang.Object
  extended by org.jboss.deployers.spi.attachments.helpers.AbstractAttachments
      extended by org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments
          extended by org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit
All Implemented Interfaces:
Externalizable, Serializable, org.jboss.deployers.spi.attachments.Attachments, org.jboss.deployers.spi.attachments.MutableAttachments, DeploymentUnit

public class AbstractDeploymentUnit
extends org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments
implements DeploymentUnit

AbstractDeploymentUnit.

This is just a wrapper to the deployment context that restricts people from "poking" behind the scenes.

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

Constructor Summary
AbstractDeploymentUnit()
          For serialization
AbstractDeploymentUnit(DeploymentContext deploymentContext)
          Create a new AbstractDeploymentUnit.
 
Method Summary
 Object addAttachment(String name, Object attachment)
           
 DeploymentUnit addComponent(String name)
          Add a component
 void addControllerContextName(Object name)
          Add controller context name.
 void addIDependOn(org.jboss.dependency.spi.DependencyItem dependency)
          Add a dependency
 void clear()
           
 void clearChangeCount()
           
 boolean createClassLoader(ClassLoaderFactory factory)
          Create the classloader
protected  DeploymentContext createComponentDeploymentContext(String name, DeploymentContext parent)
          Create a component deployment context
protected  DeploymentUnit createComponentDeploymentUnit(DeploymentContext component)
          Create a component deployment unit
<T> Set<? extends T>
getAllMetaData(Class<T> type)
          Get all the metadata for the expected type
 Object getAttachment(String name)
           
 Map<String,Object> getAttachments()
           
 int getChangeCount()
           
 List<DeploymentUnit> getChildren()
          Get the children
 ClassLoader getClassLoader()
          Gets the classloader for this deployment unit
 List<DeploymentUnit> getComponents()
          Get the components
 Set<Object> getControllerContextNames()
          Get the controller context names.
 org.jboss.dependency.spi.DependencyInfo getDependencyInfo()
          Get the dependency info
protected  DeploymentContext getDeploymentContext()
          Get the deployment context
 org.jboss.metadata.spi.MetaData getMetaData()
          Get the metadata for this deployment unit
 org.jboss.metadata.spi.MutableMetaData getMutableMetaData()
          Get the mutable metadata for this deployment unit
 org.jboss.metadata.spi.scope.ScopeKey getMutableScope()
          Get the mutable scope
 String getName()
          Get the deployment units name
 DeploymentUnit getParent()
          Get the parent deployment unit
 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.
 DeploymentUnit getTopLevel()
          Get the top leve deployment unit
 org.jboss.deployers.spi.attachments.MutableAttachments getTransientManagedObjects()
          Get the transient managed objects
 Set<String> getTypes()
          Get the deployment types associated with this deployment.
 boolean hasAttachments()
           
 boolean isAttachmentPresent(String name)
           
 boolean isComponent()
          Whether this unit is a component
 void readExternal(ObjectInput in)
           
 Object removeAttachment(String name)
           
 void removeClassLoader(ClassLoaderFactory factory)
          Remove the classloader
 boolean removeComponent(String name)
          Remove a component
 void removeControllerContextName(Object name)
          Remove controller context name.
 void removeIDependOn(org.jboss.dependency.spi.DependencyItem dependency)
          Remove a dependency
 void setMutableScope(org.jboss.metadata.spi.scope.ScopeKey key)
          Set the mutable scope
 void setScope(org.jboss.metadata.spi.scope.ScopeKey key)
          Set the scope
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments
addAttachment, addAttachment, removeAttachment, removeAttachment, setAttachments
 
Methods inherited from class org.jboss.deployers.spi.attachments.helpers.AbstractAttachments
getAttachment, getAttachment, isAttachmentPresent, isAttachmentPresent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.deployers.spi.attachments.MutableAttachments
addAttachment, addAttachment, removeAttachment, removeAttachment, setAttachments
 
Methods inherited from interface org.jboss.deployers.spi.attachments.Attachments
getAttachment, getAttachment, isAttachmentPresent, isAttachmentPresent
 

Constructor Detail

AbstractDeploymentUnit

public AbstractDeploymentUnit()
For serialization


AbstractDeploymentUnit

public AbstractDeploymentUnit(DeploymentContext deploymentContext)
Create a new AbstractDeploymentUnit.

Parameters:
deploymentContext - the deployment context
Throws:
IllegalArgumentException - for a null deployment context
Method Detail

getName

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

Specified by:
getName in interface DeploymentUnit
Returns:
the name;

getControllerContextNames

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

Specified by:
getControllerContextNames in interface DeploymentUnit
Returns:
the names

addControllerContextName

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

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

removeControllerContextName

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

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

getSimpleName

public String getSimpleName()
Description copied from interface: DeploymentUnit
Get the simple vfs name of the deployment unit. This is the simple name of the virtual file . vfs path ------------------- simple name 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" deploy/complexwithappxml.ear/module-mbean1.sar/submbean.sar submbean.sar

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

getRelativePath

public String getRelativePath()
Description copied from interface: DeploymentUnit
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 DeploymentUnit
Returns:
the top-level deployment relative path

getTypes

public Set<String> getTypes()
Description copied from interface: DeploymentUnit
Get the deployment types associated with this deployment.

Specified by:
getTypes in interface DeploymentUnit
Returns:
set of deployment type names deployers have identified in this deployment.

getScope

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

Specified by:
getScope in interface DeploymentUnit
Returns:
the scope

setScope

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

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

getMutableScope

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

Specified by:
getMutableScope in interface DeploymentUnit
Returns:
the mutable scope

setMutableScope

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

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

getMetaData

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

Specified by:
getMetaData in interface DeploymentUnit
Returns:
the metadata

getMutableMetaData

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

Specified by:
getMutableMetaData in interface DeploymentUnit
Returns:
the metadata

getClassLoader

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

Specified by:
getClassLoader in interface DeploymentUnit
Returns:
the classloader

createClassLoader

public boolean createClassLoader(ClassLoaderFactory factory)
                          throws org.jboss.deployers.spi.DeploymentException
Description copied from interface: DeploymentUnit
Create the classloader

Specified by:
createClassLoader in interface DeploymentUnit
Parameters:
factory - the classloader factory
Returns:
false if the classloader already exists
Throws:
org.jboss.deployers.spi.DeploymentException - for any error

removeClassLoader

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

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

getTopLevel

public DeploymentUnit getTopLevel()
Description copied from interface: DeploymentUnit
Get the top leve deployment unit

Specified by:
getTopLevel in interface DeploymentUnit
Returns:
the top level deployment unit

getParent

public DeploymentUnit getParent()
Description copied from interface: DeploymentUnit
Get the parent deployment unit

Specified by:
getParent in interface DeploymentUnit
Returns:
the parent or null if there is no parent

getChildren

public List<DeploymentUnit> getChildren()
Description copied from interface: DeploymentUnit
Get the children

Specified by:
getChildren in interface DeploymentUnit
Returns:
the children

getComponents

public List<DeploymentUnit> getComponents()
Description copied from interface: DeploymentUnit
Get the components

Specified by:
getComponents in interface DeploymentUnit
Returns:
the components

createComponentDeploymentContext

protected DeploymentContext createComponentDeploymentContext(String name,
                                                             DeploymentContext parent)
Create a component deployment context

Parameters:
name - the name
parent - the parent
Returns:
the deployment context

createComponentDeploymentUnit

protected DeploymentUnit createComponentDeploymentUnit(DeploymentContext component)
Create a component deployment unit

Parameters:
component - the component contextr
Returns:
the deployment unit

isComponent

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

Specified by:
isComponent in interface DeploymentUnit
Returns:
true for a component

addComponent

public DeploymentUnit addComponent(String name)
Description copied from interface: DeploymentUnit
Add a component

Specified by:
addComponent in interface DeploymentUnit
Parameters:
name - the name
Returns:
the new deployment unit

removeComponent

public boolean removeComponent(String name)
Description copied from interface: DeploymentUnit
Remove a component

Specified by:
removeComponent in interface DeploymentUnit
Parameters:
name - the name
Returns:
true when removed

getAllMetaData

public <T> Set<? extends T> getAllMetaData(Class<T> type)
Description copied from interface: DeploymentUnit
Get all the metadata for the expected type

Specified by:
getAllMetaData in interface DeploymentUnit
Type Parameters:
T - the type to get
Parameters:
type - the type
Returns:
a set of metadata matching the type

getTransientManagedObjects

public org.jboss.deployers.spi.attachments.MutableAttachments getTransientManagedObjects()
Description copied from interface: DeploymentUnit
Get the transient managed objects

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

addAttachment

public Object addAttachment(String name,
                            Object attachment)
Specified by:
addAttachment in interface org.jboss.deployers.spi.attachments.MutableAttachments

clear

public void clear()
Specified by:
clear in interface org.jboss.deployers.spi.attachments.MutableAttachments

clearChangeCount

public void clearChangeCount()
Specified by:
clearChangeCount in interface org.jboss.deployers.spi.attachments.MutableAttachments

getChangeCount

public int getChangeCount()
Specified by:
getChangeCount in interface org.jboss.deployers.spi.attachments.MutableAttachments

removeAttachment

public Object removeAttachment(String name)
Specified by:
removeAttachment in interface org.jboss.deployers.spi.attachments.MutableAttachments

getAttachment

public Object getAttachment(String name)
Specified by:
getAttachment in interface org.jboss.deployers.spi.attachments.Attachments

getAttachments

public Map<String,Object> getAttachments()
Specified by:
getAttachments in interface org.jboss.deployers.spi.attachments.Attachments

hasAttachments

public boolean hasAttachments()
Specified by:
hasAttachments in interface org.jboss.deployers.spi.attachments.Attachments

isAttachmentPresent

public boolean isAttachmentPresent(String name)
Specified by:
isAttachmentPresent in interface org.jboss.deployers.spi.attachments.Attachments

getResourceClassLoader

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

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

getResourceLoader

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

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

addIDependOn

public void addIDependOn(org.jboss.dependency.spi.DependencyItem dependency)
Description copied from interface: DeploymentUnit
Add a dependency

Specified by:
addIDependOn in interface DeploymentUnit
Parameters:
dependency - the dependency to add

getDependencyInfo

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

Specified by:
getDependencyInfo in interface DeploymentUnit
Returns:
the dependency

removeIDependOn

public void removeIDependOn(org.jboss.dependency.spi.DependencyItem dependency)
Description copied from interface: DeploymentUnit
Remove a dependency

Specified by:
removeIDependOn in interface DeploymentUnit
Parameters:
dependency - the dependency to remove

getDeploymentContext

protected DeploymentContext getDeploymentContext()
Get the deployment context

Returns:
the deployment context

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class org.jboss.deployers.spi.attachments.helpers.AbstractAttachments
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class org.jboss.deployers.spi.attachments.helpers.AbstractAttachments
Parameters:
out - the output
Throws:
IOException - for any error

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008 JBoss Inc.. All Rights Reserved.