try {
long startTime = System.currentTimeMillis();
DeployableObjectType type =
DeploymentServiceUtils.getRegisteredType(referenceName);
DeploymentProperties dProps = new DeploymentProperties(options);
/*
*A preexisting reference is allowed to exist if a redeployment
*is underway and the reference's attributes are not changing
*during the redeployment, so long as a
*preceding disassociation phase has recorded this fact.
*/
boolean enforceValidation = true;
if (dProps.getRedeploy()) {
/*
*Make sure this app ref was saved during an earlier disassociation.
*/
DeploymentContext.SavedApplicationRefInfo info =
deploymentContext.getSavedAppRef(referenceName, targetName);
enforceValidation = (info == null);
}
/*
* Force enabled to true for app client modules to address temporarily
* issue 3248.
*/
if (type.isCAR()) {
dProps.setEnable(true);
}
final DeploymentTarget target = enforceValidation ?
DeploymentServiceUtils.getAndValidateDeploymentTarget(
targetName, referenceName, false) :
DeploymentServiceUtils.getDeploymentTarget(targetName);
InstanceEnvironment env =
ApplicationServer.getServerContext().getInstanceEnvironment();
DeploymentRequest req = new DeploymentRequest(
env,
type,
DeploymentCommand.DEPLOY);
String virtualServers = dProps.getVirtualServers();
boolean enabled = dProps.getEnable();
req.setName(referenceName);
req.setStartOnDeploy(enabled);
req.setTarget(target);
req.setIsRedeployInProgress(dProps.getRedeploy());
DeploymentServiceUtils.setResourceOptionsInRequest(req, dProps);
Properties optionalAttributes = new Properties();
if(virtualServers!=null) {
optionalAttributes.put(ServerTags.VIRTUAL_SERVERS,