AutoDeployerpublic class AutoDeployer extends Object implements MonitorListenerThis class is a listener implementation of the auto deploy callbacks.
When auto deploy monitor detects a new archive under the auto deploy
directory, this class handles the callback from the monitor. |
Fields Summary |
---|
static Logger | _loggerlogger for this auto deployer |
Methods Summary |
---|
public boolean | deploy(MonitorableEntry entry, java.io.File archive)Handles the callbacks from the auto deploy monitor.
boolean status = false;
try {
DeploymentRequest req = deploy(archive);
// load/reload deployed application/stand alone module
// update the config context in server runtime
// notify admin server if necessary
status = true;
} catch (IASDeploymentException de) {
_logger.log(Level.WARNING, "core.exception", de);
status = false;
}
return status;
| private com.sun.enterprise.deployment.backend.DeploymentRequest | deploy(java.io.File archive)Deploys the given archive. If it is already been deployed, this
redeploys the application.
// instance environment for this server
InstanceEnvironment env =
ApplicationServer.getServerContext().getInstanceEnvironment();
// sets the type of the archive being deployed
DeployableObjectType type = null;
if ( FileUtils.isEar(archive) ) {
type = DeployableObjectType.APP;
} else if ( FileUtils.isJar(archive) ) {
type = DeployableObjectType.EJB;
} else if ( FileUtils.isWar(archive) ) {
type = DeployableObjectType.WEB;
} else if ( FileUtils.isRar(archive) ) {
type = DeployableObjectType.CONN;
}
// constructs a deploy request with the given type
DeploymentRequest req =
new DeploymentRequest(env, type, DeploymentCommand.DEPLOY);
// sets the archive that needs to be deployed
req.setFileSource(archive);
// application is registered with the name of the
// archive without extension
String fileName = archive.getName();
int dotIdx = fileName.indexOf(fileName);
String regName = fileName.substring(0, dotIdx);
req.setName(regName);
// sets the web context root
if (type.isWEB()) {
req.setContextRoot(regName);
}
// redeploys the app if already deployed
req.setForced(true);
// does the actual deployment
Deployer deployer = DeployerFactory.getDeployer(req);
deployer.doRequest();
// any clean up other than cleaner thread invocation
deployer.cleanup();
return req;
| public boolean | reload(MonitorableEntry entry)No-op.
// ---- START OF MonitorListener METHOD -----------------------------------
return false;
|
|