* application object.
*/
public Application getAppDescriptor(String appID, ClassLoader parentClassLoader)
throws ConfigException {
Application application = getRegisteredDescriptor(appID);
if (application != null) {
return application;
}
Application deserializedApplication = null;
// Try to load the previously-serialized form of the descriptor.
SerializedDescriptorHelper.Loader sdLoader =
SerializedDescriptorHelper.load(appID, this);
try {
// partially load the deployment descriptor...
ApplicationArchivist archivist = new ApplicationArchivist();
FileArchive appArchive = new FileArchive();
appArchive.open(getLocation(appID));
//for upgrade senario, we still load from the original
//application repository for application.xml first
if (!archivist.hasStandardDeploymentDescriptor(appArchive)) {
//read from generated/xml location
appArchive.open(getGeneratedXMLLocation(appID));
}
deserializedApplication = sdLoader.getApplication();
if (deserializedApplication != null &&
sdLoader.lastModified() > DOLLoadingContext.defaultWebXMLLastModified()) {
application = deserializedApplication;
} else {
// There was no serialized descriptor file or it could not
// be loaded, so load the application info from the XML descriptors.
application = Application.createApplication(appArchive,false);
}
application.setRegistrationName(appID);
String moduleRoot = getLocation(application.getRegistrationName());
String[] classPaths = (String[]) EJBClassPathUtils.getAppClasspath(
application, this).toArray(new String[0]);
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "[AppsManager] :: appID " + appID + " classpaths "
+ classPaths + " moduleRoot " + moduleRoot
+ " parentClassLoader " + parentClassLoader);
}
ClassLoader cl = EJBClassPathUtils.createEJBClassLoader(classPaths,
moduleRoot , appID, parentClassLoader,
application.getModuleType());
application.setClassLoader(cl);
} catch (Exception confEx) {
_logger.log(Level.SEVERE,"loader.error_while_loading_app_desc", confEx);
throw new ConfigException(confEx);
}
Application fullyLoadedApp = getAppDescriptor(application);
// If needed, write out the new app into the serialized descriptor file.
sdLoader.store(fullyLoadedApp);
return fullyLoadedApp;