TomcatApplicationLoaderpublic class TomcatApplicationLoader extends ApplicationLoader This class extends ApplicationLoader to handle
per application loading/unloading of web module. |
Fields Summary |
---|
static Logger | _loggerlogger to log loader messages | private com.sun.enterprise.instance.AppsManager | appsManagerThe AppsManager for this VS
save for unload() since super.unload() calls done()
and clears this.configManager | private com.sun.enterprise.web.PEWebContainer | webContainerThe WebContainer instance. |
Constructors Summary |
---|
public TomcatApplicationLoader(String appID, ClassLoader parentClassLoader, com.sun.enterprise.instance.AppsManager appsManager)TomcatApplicationLoader loads one application.
// ------------------------------------------------------------ Constructor
super(appID, parentClassLoader, appsManager);
_logger.log(Level.FINEST, "[TomcatApplicationLoader] " + appID);
this.appsManager = appsManager;
// get the instance of WebContainer
webContainer = PEWebContainer.getPEWebContainer();
_logger.log(Level.FINEST, "PEWebContainer " + webContainer);
|
Methods Summary |
---|
protected boolean | doLoad(boolean jsr77)Called from ApplicationManager. Called to load an application.
This loads the web modules of this application on top of
its super loader creating the EJB and MDB container.
_logger.log(Level.FINEST, "[TomcatApplicationLoader] load " + jsr77);
boolean deployed = super.doLoad(jsr77);
if (loadUnloadAction == Constants.LOAD_RAR || ! deployed) {
return deployed;
}
_logger.log(Level.FINEST, "deployed "+deployed);
if (webContainer == null) {
webContainer = PEWebContainer.getPEWebContainer();
}
if (deployed) {
J2eeApplication[] j2eeAppBeans = appsManager.getAllApps();
if (j2eeAppBeans != null) {
for (int i = 0; i < j2eeAppBeans.length; i++) {
if (j2eeAppBeans[i].getName().equals(id) && webContainer != null) {
_logger.log(Level.FINEST,
"[TomcatApplicationLoader] loadJ2EEAppWebModule with "+j2eeAppBeans[i]);
webContainer.loadJ2EEApplicationWebModules(j2eeAppBeans[i]);
}
}
}
}
return deployed;
| protected boolean | unload(boolean jsr77)Unloads this application.
if (loadUnloadAction == Constants.UNLOAD_RAR) {
return super.unload(jsr77);
}
super.unloadWebserviceEndpoints(jsr77);
Set wbds = null;
J2eeApplication[] j2eeAppBeans = appsManager.getAllApps();
if (j2eeAppBeans != null) {
for (int i = 0; i < j2eeAppBeans.length; i++) {
if (j2eeAppBeans[i].getName().equals(id)) {
String virtualServers = null;
try {
virtualServers = appsManager.
getVirtualServersByAppName(j2eeAppBeans[i].getName());
} catch(ConfigException ce) {
_logger.log(Level.FINEST, "[TomcatApplicationLoader] unload "
+ id + ". error getting virtualServers", ce);
}
_logger.log(Level.FINEST, "[TomcatApplicationLoader] unload "
+id);
wbds = application.getWebBundleDescriptors();
WebBundleDescriptor wbd = null;
if ( wbds == null) continue;
Iterator itr = wbds.iterator();
while (itr.hasNext()){
wbd = (WebBundleDescriptor) itr.next();
String appName = wbd.getApplication().getRegistrationName();
try {
webContainer.unloadWebModule(wbd.getContextRoot(),
appName,
virtualServers,
wbd);
} finally {
try {
Switch.getSwitch().
getNamingManager().unbindObjects(wbd);
} catch (javax.naming.NamingException nameEx) {
_logger.log(Level.FINEST, "[TomcatApplicationLoader] "
+ " Exception during namingManager.unbindObject",
nameEx);
}
}
}
}
}
}
return super.unload(jsr77);
|
|