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 String deploymentRuntimeName = deploymentUnit.getAttachment(Attachments.RUNTIME_NAME);
final byte[] deploymentHash = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_HASH);
// The mount point we will use for the repository file
final VirtualFile deploymentRoot = VFS.getChild("content/" + deploymentRuntimeName);
boolean failed = false;
Closeable handle = null;
final MountHandle mountHandle;
try {
final boolean mountExploded = deploymentName.endsWith("war");
handle = serverDeploymentRepository.mountDeploymentContent(deploymentName, deploymentRuntimeName, deploymentHash, deploymentRoot, mountExploded);
mountHandle = new MountHandle(handle);
} catch (IOException e) {
failed = true;
throw new DeploymentUnitProcessingException("Failed to mount deployment content", e);
} finally {