*/
public boolean multicastEvent(int eventType, String entityName,
String moduleType , boolean cascade, boolean forceDeploy, String targetName) throws DeploymentException
{
String name = getInstanceName();
AdminEvent event = null;
EventBuilder builder = new EventBuilder();
//XXX Can we put the following 4 lines be done in the EventBuilder?
EventStack stack = EventContext.getEventStackFromThreadLocal();
ConfigContext ctx = stack.getConfigContext();
stack.setTarget(targetName);
stack.setConfigChangeList(ctx.getConfigChangeList());
try{
if (eventType == BaseDeployEvent.APPLICATION_DEPLOYED)
{
event = builder.createApplicationDeployEvent(
BaseDeployEvent.DEPLOY, entityName, false, forceDeploy);
}
else if (eventType == BaseDeployEvent.APPLICATION_UNDEPLOYED)
{
event = builder.createApplicationDeployEvent(
BaseDeployEvent.UNDEPLOY, entityName, cascade, forceDeploy);
}
else if (eventType == BaseDeployEvent.APPLICATION_REDEPLOYED)
{
event = builder.createApplicationDeployEvent(
BaseDeployEvent.REDEPLOY, entityName, false, forceDeploy);
}
else if (eventType == BaseDeployEvent.MODULE_DEPLOYED)
{
event = builder.createModuleDeployEvent(
BaseDeployEvent.DEPLOY, entityName, moduleType, cascade, forceDeploy);
}
else if (eventType == BaseDeployEvent.MODULE_UNDEPLOYED)
{
event = builder.createModuleDeployEvent(
BaseDeployEvent.UNDEPLOY, entityName, moduleType, cascade, forceDeploy);
}
else if (eventType == BaseDeployEvent.MODULE_REDEPLOYED)
{
event = builder.createModuleDeployEvent(
BaseDeployEvent.REDEPLOY, entityName, moduleType);
}
else if (eventType == BaseDeployEvent.APPLICATION_ENABLE)
{
event = builder.createApplicationDeployEvent(
BaseDeployEvent.ENABLE, entityName, false, forceDeploy);
}
else if (eventType == BaseDeployEvent.APPLICATION_DISABLE)
{
event = builder.createApplicationDeployEvent(
BaseDeployEvent.DISABLE, entityName, false, forceDeploy);
}
else if(eventType == BaseDeployEvent.MODULE_ENABLE)
{
event = builder.createModuleDeployEvent(
BaseDeployEvent.ENABLE, entityName, moduleType, false, forceDeploy);
}
else if(eventType == BaseDeployEvent.MODULE_DISABLE)
{
event = builder.createModuleDeployEvent(
BaseDeployEvent.DISABLE, entityName, moduleType, false, forceDeploy);
}
else if(eventType == BaseDeployEvent.APPLICATION_REFERENCED)
{
event = builder.createApplicationDeployEvent(
BaseDeployEvent.ADD_REFERENCE, entityName, false, forceDeploy);
}
else if(eventType == BaseDeployEvent.APPLICATION_UNREFERENCED)
{
event = builder.createApplicationDeployEvent(
BaseDeployEvent.REMOVE_REFERENCE, entityName, false, forceDeploy);
}
else if (eventType == CONFIG_CHANGED)
{
event = builder.createConfigChangeEvent(targetName, null);
}
else
{
String msg =
localStrings.getString( "admin.server.core.mbean.config.no_such_event",
new Integer(eventType) );
throw new RuntimeException( msg );
}
} catch (ConfigException ex) {
DeploymentException de = new DeploymentException(ex.getMessage());
de.initCause(ex);
throw de;
}
//set target destination for the event
if (targetName != null) {
event.setTargetDestination(targetName);
}
/* New for 8.0 - temporary */
this.transform(new InstanceEnvironment(name));
/* New for 8.0 - temporary */
if (event instanceof ApplicationDeployEvent
|| event instanceof ModuleDeployEvent) {
AdminEventCache.populateConfigChange(getConfigContext(), event);
}
int statusCode = getInstanceStatusCode();
if (statusCode == Status.kInstanceStoppingCode || statusCode == Status.kInstanceNotRunningCode) {
sLogger.log(Level.INFO, "mbean.inst_down_skip_event", mInstanceName);
return true;
}
if (sLogger.isLoggable(Level.FINEST)) {
sLogger.log(Level.FINEST, "mbean.event_sent", event.getEventInfo());
} else {
sLogger.log(Level.INFO, "mbean.send_event", event.toString());
}
AdminEventResult multicastResult =
AdminEventMulticaster.multicastEvent(event);
sLogger.log(Level.FINE, "mbean.event_res",