String deploymentName = getDeploymentName();
// in case there is already a deployment, lock the contents.
// TODO this might should not be done here ?
if(getProfile().hasDeployment(deploymentName))
{
ProfileDeployment deployment = getProfile().getDeployment(deploymentName);
deployment.getDeploymentInfo().setFlag(ProfileDeploymentFlag.LOCKED);
}
String repositoryName = deploymentRepository.addDeploymentContent(deploymentName, contentIS, getDeploymentID().getDeploymentOptions());
// FIXME make deployment visible to management view
VirtualFile vf = deploymentRepository.getDeploymentContent(repositoryName);
// FIXME
ProfileKey key = getProfile().getKey();
String profileName = key.getName();
String repoDeploymentName = createDeploymentName(vf);
deploymentRepository.lockDeploymentContent(repoDeploymentName);
// Don't try to re-mount
if(deploymentRepository.getDeploymentNames().contains(repoDeploymentName) == false)
{
ProfileDeployment deployment = createDeployment(profileName, repoDeploymentName, vf);
// Mark it as locked, so we can add contents after
deployment.getDeploymentInfo().setFlag(ProfileDeploymentFlag.LOCKED);
// Add deployment
deploymentRepository.addDeployment(deployment.getName(), deployment);
}
// Notify
response.fireModificationEvent(ProfileModificationEvent.create(ProfileModificationType.ADD, getProfile().getKey()));
}