public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
if(deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT) != null) {
return;
}
final ServerDeploymentRepository serverDeploymentRepository = deploymentUnit.getAttachment(Attachments.SERVER_DEPLOYMENT_REPOSITORY);
if(serverDeploymentRepository == null) {
throw new DeploymentUnitProcessingException("No deployment repository available.");
}
final String deploymentName = deploymentUnit.getName();
final VirtualFile deploymentContents = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_CONTENTS);
// internal deployments do not have any contents, so there is nothing to mount
if (deploymentContents == null)
return;
final VirtualFile deploymentRoot;
final MountHandle mountHandle;
if (deploymentContents.isDirectory()) {
// use the contents directly
deploymentRoot = deploymentContents;
// nothing was mounted
mountHandle = null;
} else {
// The mount point we will use for the repository file
deploymentRoot = VFS.getChild("content/" + deploymentName);
boolean failed = false;
Closeable handle = null;
try {
final boolean mountExploded = MountExplodedMarker.isMountExploded(deploymentUnit);
handle = serverDeploymentRepository.mountDeploymentContent(deploymentContents, deploymentRoot, mountExploded);
mountHandle = new MountHandle(handle);
} catch (IOException e) {
failed = true;
throw new DeploymentUnitProcessingException("Failed to mount deployment content", e);
} finally {