DeploymentEventListenerImplpublic class DeploymentEventListenerImpl extends Object implements com.sun.jdo.spi.persistence.utility.database.DatabaseConstants, com.sun.enterprise.deployment.backend.DeploymentEventListenerImplementation of the DeploymentEventListener interface for
creating and dropping database schema definitions at the appropriate
deployment/undeployment events. |
Fields Summary |
---|
private static final ResourceBundle | messagesI18N message handler | private static com.sun.jdo.spi.persistence.utility.logging.Logger | loggerThe logger |
Constructors Summary |
---|
DeploymentEventListenerImpl()Default constructor should not be public
DeploymentEventManager.addListener (new DeploymentEventListenerImpl());
|
Methods Summary |
---|
private boolean | isDeploy(com.sun.enterprise.deployment.backend.DeploymentRequest request)This method returns a boolean value that determines if we are
trying to do a deployment of an existing application but doesn't
throw an exception.
boolean deploy = false;
try {
if (request != null) {
deploy = request.isDeploy();
}
} catch (IASDeploymentException e) {
// Ignore? This is a strange exception.
}
return deploy;
| private boolean | isRedeploy(com.sun.enterprise.deployment.backend.DeploymentRequest request)This method returns a boolean value that determines if we are
trying to do a redeployment of an existing application but doesn't
throw an exception.
boolean redeploy = false;
try {
if (request != null) {
redeploy = request.isReDeploy();
}
} catch (IASDeploymentException e) {
// Ignore? This is a strange exception.
}
return redeploy;
| public void | notifyDeploymentEvent(com.sun.enterprise.deployment.backend.DeploymentEvent event)This method is called when a DeploymentEventManager
needs to deliver a code>DeploymentEvent event.
int type = event.getEventType();
switch (type) {
case DeploymentEvent.POST_DEPLOY:
processEvent(event.getEventInfo(), true);
break;
case DeploymentEvent.PRE_UNDEPLOY:
case DeploymentEvent.PRE_DEPLOY:
processEvent(event.getEventInfo(), false);
break;
default:
break;
}
| private void | processApplication(com.sun.enterprise.deployment.backend.DeploymentRequest request, com.sun.enterprise.deployment.backend.DeploymentEventInfo info, boolean create, java.lang.String cliCreateTables, java.lang.String cliDropAndCreateTables, java.lang.String cliDropTables)This is the method that does the actual processing of the deployment event.
For each application process the cmp 2.x beans if any followed by processing
the ejb 3.0 beans.
if (logger.isLoggable(logger.FINE)) {
logger.fine("ejb.DeploymentEventListenerImpl.processingevent", //NOI18N
(isRedeploy(request)? "redeploy" : ((create)? "deploy" : "undeploy")), //NOI18N
info.getApplicationDescriptor().getRegistrationName());
}
// Get status value for our use and initialize it.
DeploymentStatus status = request.getCurrentDeploymentStatus();
status.setStageStatus(DeploymentStatus.SUCCESS);
status.setStageStatusMessage("");
BaseProcessor processor =
new CMPProcessor(info, create, cliCreateTables,
cliDropAndCreateTables, cliDropTables);
processor.processApplication();
processor =
new PersistenceProcessor(info, create, cliCreateTables,
cliDropAndCreateTables, cliDropTables);
processor.processApplication();
| private void | processEvent(com.sun.enterprise.deployment.backend.DeploymentEventInfo info, boolean create)Event handling.
// Get the CLI overrides.
String cliCreateTables = null;
String cliDropTables = null;
DeploymentRequest request = info.getDeploymentRequest();
// Do nothing for drop tables on the deploy
if (isDeploy(request) && !create) {
return;
}
Properties cliOverrides = request.getOptionalArguments();
String cliDropAndCreateTables = cliOverrides.getProperty(
Constants.CMP_DROP_AND_CREATE_TABLES, Constants.UNDEFINED);
if (create) {
cliCreateTables = cliOverrides.getProperty(
Constants.CMP_CREATE_TABLES, Constants.UNDEFINED);
if (cliCreateTables.equals(Constants.UNDEFINED)) {
// It might have been specified as CMP_DROP_AND_CREATE_TABLES.
cliCreateTables = cliDropAndCreateTables;
}
} else {
cliDropTables = cliOverrides.getProperty(
Constants.CMP_DROP_TABLES, Constants.UNDEFINED);
}
Application application = info.getApplicationDescriptor();
if ( application == null) {
return;
}
processApplication(request, info, create, cliCreateTables,
cliDropAndCreateTables, cliDropTables);
|
|