* @see DeploymentProperties.java
*/
public com.sun.enterprise.deployment.backend.DeploymentStatus deploy(Properties props)
throws DeploymentException
{
DeploymentProperties dProps = new DeploymentProperties(props);
String archiveName = dProps.getArchiveName();
String name = dProps.getName(archiveName);
DeployableObjectType type = getTypeFromFile(name, archiveName);
if(archiveName == null)
throw new IllegalArgumentException("archiveName not specified");
sLogger.log(Level.FINE, "mbean.begin_deploy", archiveName);
java.io.File deployFile = new java.io.File(archiveName);
int actionCode = BaseDeployEvent.APPLICATION_DEPLOYED;
try {
InstanceEnvironment env = new InstanceEnvironment(getInstanceName());
DeploymentRequest req = new DeploymentRequest(
env,
type,
DeploymentCommand.DEPLOY);
/* If app exists & forceDeploy is false it's an error.
* It should be detected by the deployment backend.
*/
boolean isRegistered = false ; //isRegistered(name, type);
ObjectName componentON =
getRegisteredComponentObjectName(name, type);
if(componentON != null)
isRegistered = true;
if(isRegistered)
validate(componentON, REDEPLOY_ACTION);
if(type.isAPP())
{
actionCode = BaseDeployEvent.APPLICATION_DEPLOYED;
}
else
{
actionCode = BaseDeployEvent.MODULE_DEPLOYED;
}
req.setFileSource(deployFile);
req.setName(name);
req.setForced(dProps.getForce());
// for redeployment
req.setCascade(true);
if(type.isWEB() || req.isExtensionModule()) {
req.setDefaultContextRoot(dProps.getDefaultContextRoot(
archiveName));
req.setContextRoot(dProps.getContextRoot());
}
req.setVerifying(dProps.getVerify());
req.setPrecompileJSP(dProps.getPrecompileJSP());
req.setGenerateRMIStubs(dProps.getGenerateRMIStubs());
req.setAvailabilityEnabled(dProps.getAvailabilityEnabled());
req.setStartOnDeploy(dProps.getEnable());
req.setDescription(dProps.getDescription());
req.setLibraries(dProps.getLibraries());
req.setJavaWebStartEnabled(dProps.getJavaWebStartEnabled());
req.setExternallyManagedPath(dProps.getExternallyManaged());
req.setActionCode(actionCode);
DeploymentServiceUtils.setResourceOptionsInRequest(req, dProps);
final DeploymentTarget target = getAndValidateDeploymentTarget(dProps.getTarget(),
name, isRegistered);
req.setTarget(target);
Properties optionalAttributes = new Properties();
//optionalAttributes.put(ServerTags.ENABLED, String.valueOf(bEnabled));
String virtualServers = dProps.getVirtualServers();
if(virtualServers!=null)
optionalAttributes.put(ServerTags.VIRTUAL_SERVERS, dProps.getVirtualServers());
req.setOptionalAttributes(optionalAttributes);
if(props == null)
props = new Properties();
else
props = dProps.prune();
req.addOptionalArguments(props);
setHostAndPort(req);
return getDeploymentService().deploy(req);
}