JBoss.org Community Documentation
By default the DeployersImpl class creates the following deployment stages on construction:
NOT_INSTALLED - the deployment is ready to be installed or has been uninstalled
PARSE - deployment descriptors are parsed into deployment metadata
DESCRIBE - dependencies on other deployments or runtime components are determined
CLASSLOADER - a classloader for the deployment is created
POST_CLASSLOADER -
REAL - components are deployed into the runtime
INSTALLED - the deployment is fully deployed
Each DeploymentStage has a name and indicates which stages it comes before and after:
public class DeploymentStage
{
private String name;
private String after;
private String before;
...
}
This allows a new ControllerState to be created for each DeploymentStage which can then be added in the correct place to the list of ControllerStates associated with the controller:
public class DeployersImpl implements Deployers, ControllerContextActions
{
...
public DeployersImpl(AbstractController controller, Set<Deployer> deployers)
{
if (controller == null)
throw new IllegalArgumentException("Null controller");
this.controller = controller;
// Add the standard stages
addDeploymentStage(DeploymentStages.NOT_INSTALLED);
addDeploymentStage(DeploymentStages.PARSE);
addDeploymentStage(DeploymentStages.DESCRIBE);
addDeploymentStage(DeploymentStages.CLASSLOADER);
addDeploymentStage(DeploymentStages.POST_CLASSLOADER);
addDeploymentStage(DeploymentStages.REAL);
addDeploymentStage(DeploymentStages.INSTALLED);
...
}
...
protected synchronized void addDeploymentStage(DeploymentStage stage)
{
if (stage == null)
throw new IllegalArgumentException("Null stage");
// Already done?
String stageName = stage.getName();
if (stages.containsKey(stageName))
return;
ControllerState preceeds = null;
String before = stage.getBefore();
String after = stage.getAfter();
if (before != null || after != null)
{
// Determine where to put the stage
List<ControllerState> states = controller.getStates();
for (int i = 0; i < states.size(); ++i)
{
ControllerState state = states.get(i);
String stateName = state.getStateString();
if (before != null && before.equals(stateName))
{
preceeds = state;
break;
}
if (after != null && after.equals(stateName))
{
if (i < states.size()-1)
{
preceeds = states.get(i+1);
break;
}
}
}
}
controller.addState(new ControllerState(stageName), preceeds);
stages.put(stageName, stage);
...
}
...
}
The DeploymentStages are also stored in a map, using the stage name as a key, to prevent duplicate stages from being added.