Questo contenuto non è disponibile nella lingua selezionata.
10.2. Separation of Structure Recognition From Deployment lifecycle logic
my-jboss-beans.xml, web.xml, ejb-jar.xml. Classpaths are classloader roots, such as WEB-INF/classes or myapp.ear/lib.
A Typical Deployment Lifecycle
- The
MainDeployerpasses the deployment to the set ofStructuralDeployers for recognition, and receives back a Deployment context. - Next, the
MainDeployerpasses the resulting Deployment context to theDeployersfor handling by the appropriateDeployer.
Handling StructuredMetaData Information
- VFS-based deployments
- the structure recognition is forwarded to a set of StructureDeployers.
- JEE-specification-defined structures
- we have matching StructureDeployer implementations:
- EarStructure
- WarStructure
- JarStructure
- DeclarativeStructures
- looks for
META-INF/jboss-structure.xmlfile inside your deployment, and parses it to construct a properStructureMetaData. - FileStructures
- only recognizes known configuration files, such as files like
-jboss-beans.xmlor-service.xml.Example 10.1. An example of
jboss-structure.xml<structure> <context comparator="org.jboss.test.deployment.test.SomeDeploymentComparatorTop"> <path name=""/> <metaDataPath> <path name="META-INF"/> </metaDataPath> <classpath> <path name="lib" suffixes=".jar"/> </classpath> </context> </structure>
StructureDeployer with the help of the generic GroupingStructure class provided by the generic StructureDeployer interface.
DeploymentStage.
Example 10.2. Deployment Stages
public interface DeploymentStages {
/** The not installed stage - nothing is done here */
DeploymentStage NOT_INSTALLED = new DeploymentStage("Not Installed");
/** The pre parse stage - where pre parsing stuff can be prepared; altDD, ignore, ... */
DeploymentStage PRE_PARSE = new DeploymentStage("PreParse", NOT_INSTALLED);
/** The parse stage - where metadata is read */
DeploymentStage PARSE = new DeploymentStage("Parse", PRE_PARSE);
/** The post parse stage - where metadata can be fixed up */
DeploymentStage POST_PARSE = new DeploymentStage("PostParse", PARSE);
/** The pre describe stage - where default dependencies metadata can be created */
DeploymentStage PRE_DESCRIBE = new DeploymentStage("PreDescribe", POST_PARSE);
/** The describe stage - where dependencies are established */
DeploymentStage DESCRIBE = new DeploymentStage("Describe", PRE_DESCRIBE);
/** The classloader stage - where classloaders are created */
DeploymentStage CLASSLOADER = new DeploymentStage("ClassLoader", DESCRIBE);
/** The post classloader stage - e.g. aop */
DeploymentStage POST_CLASSLOADER = new DeploymentStage("PostClassLoader", CLASSLOADER);
/** The pre real stage - where before real deployments are done */
DeploymentStage PRE_REAL = new DeploymentStage("PreReal", POST_CLASSLOADER);
/** The real stage - where real deployment processing is done */
DeploymentStage REAL = new DeploymentStage("Real", PRE_REAL);
/** The installed stage - could be used to provide valve in future? */
DeploymentStage INSTALLED = new DeploymentStage("Installed", REAL);
}
DeploymentControllerContext. The Microcontainer's state machine handles dependencies.
parent-first property. This property is set to true by default.
all, top level, components only, or no components.
Warning
Example 10.3. Simple Deployer which Outputs Information About Its Deployment
public class StdioDeployer extends AbstractDeployer {
public void deploy(DeploymentUnit unit) throws DeploymentException
{
System.out.println("Deploying unit: " + unit);
}
@Override
public void undeploy(DeploymentUnit unit)
{
System.out.println("Undeploying unit: " + unit);
}
}
-jboss-beans.xml files in deployers/ directory in JBoss Application Server, and MainDeployerImpl bean will pick up this deployer via the Microcontainer's IoC callback handling.
Example 10.4. Simple Deployment Descriptor
<bean name="StdioDeployer" class="org.jboss.acme.StdioDeployer"/>