Methods Summary |
---|
static com.sun.enterprise.deployment.Application | getAppDescriptor(java.lang.String appDir)Returns the deployment descriptor object for the application.
Turn off the annotation processing during undeployment. Note that
this method is called *only* during the undeployment phase right now.
return getAppDescriptor(appDir, false);
|
static com.sun.enterprise.deployment.Application | getAppDescriptor(java.lang.String appDir, boolean annotationProcessing)Returns the deployment descriptor object for the application.
try {
FileArchive archive = new FileArchive();
archive.open(appDir);
ApplicationArchivist archivist = new ApplicationArchivist();
archivist.setAnnotationProcessingRequested(annotationProcessing);
archivist.setXMLValidation(false);
return (Application) archivist.open(archive);
} catch(Throwable t) {
throw new IASDeploymentException(t);
}
|
static com.sun.enterprise.loader.EJBClassLoader | getClassLoader(java.util.List paths, java.lang.ClassLoader parent, java.io.File other)Returns the class loader to be used for deployment. It contains all the
urls for the given application.
EJBClassLoader ejbCl = null;
if (parent != null) {
ejbCl = new EJBClassLoader(parent);
} else {
ejbCl = new EJBClassLoader();
}
final int LIST_SZ = paths.size();
for (int i=0; i<LIST_SZ; i++) {
String path = (String) paths.get(i);
ejbCl.appendURL(new File(path));
}
if (other != null) {
ejbCl.appendURL(other);
}
return ejbCl;
|
static java.util.List | getCommonClasspath(com.sun.enterprise.instance.BaseManager mgr)Returns the common class loader paths, if any, or an empty list.
InstanceEnvironment env = mgr.getInstanceEnvironment();
String dir = env.getLibClassesPath();
String jarDir = env.getLibPath();
return ClassLoaderUtils.getUrlList(new File[] {new File(dir)},
new File[] {new File(jarDir)});
|
public static com.sun.enterprise.deployment.RootDeploymentDescriptor | getDescriptor(java.lang.String appId, com.sun.enterprise.instance.BaseManager manager)This method returns a fully populated top level descriptor object.
It does so by first checking the cache in the instance manager.
If the descriptor object does not exist in cache, it then proceeds
to read off of the disk. Note that reading from the disk is an
expensive operation. So please use this method with caution. In
addition, this method does not cache the read Descriptor object
in the instance manager so that query for Descriptors from cli and
gui would not (and should not) meddle with the cache management for
descriptors.
Application application = manager.getRegisteredDescriptor(appId);
if (application != null) {
if (application.isVirtual()) {
return application.getStandaloneBundleDescriptor();
} else {
return application;
}
}
//Now, load from disk
FileArchive in = new FileArchive();
try {
String appDir = manager.getLocation(appId);
// if is system predeployed app, load from original app dir
// else load from generated/xml dir
// print a warning if generated/xml dir is not there
// and load from original dir (upgrade scenario)
if (manager.isSystemAdmin(appId)) {
in.open(appDir);
} else {
String xmlDir = manager.getGeneratedXMLLocation(appId);
if (FileUtils.safeIsDirectory(xmlDir)) {
in.open(xmlDir);
} else {
// log a warning message in the server log
_logger.log(Level.WARNING,
"enterprise.deployment.backend.no_generated_xmldir",
new Object[]{appId, xmlDir, appDir});
in.open(appDir);
}
}
Archivist archivist = null;
if (manager instanceof AppsManager) {
archivist = new ApplicationArchivist();
} else if (manager instanceof EjbModulesManager) {
archivist = new EjbArchivist();
} else if (manager instanceof WebModulesManager) {
archivist = new WebArchivist();
} else if (manager instanceof AppclientModulesManager) {
archivist = new AppClientArchivist();
} else if (manager instanceof ConnectorModulesManager) {
archivist = new ConnectorArchivist();
}
archivist.setAnnotationProcessingRequested(false);
archivist.setXMLValidation(false);
Application desc = ApplicationArchivist.openArchive(
appId, archivist, in, true);
//note: we are not reading back the persistence information here
//we could, if ever the tools need it.
if (!desc.isVirtual()) {
archivist.setHandleRuntimeInfo(false);
((ApplicationArchivist)
archivist).readModulesDescriptors(desc, in);
// now process runtime DDs
archivist.setHandleRuntimeInfo(true);
archivist.readRuntimeDeploymentDescriptor(in, desc);
} else {
return (BundleDescriptor)
desc.getBundleDescriptors().iterator().next();
}
return desc;
} catch (Exception ex) {
_logger.log(Level.SEVERE,
"enterprise.deployment.backend.get_descriptor_failed",
new Object[]{appId});
IASDeploymentException de = new IASDeploymentException(ex.getMessage());
de.initCause(ex);
throw de;
} finally {
try {
in.close();
} catch (Exception ex) {}
}
|
public static java.lang.String | getEmbeddedModulePath(java.lang.String appRootPath, java.lang.String moduleUri)This method returns the file path of an embedded module.
For example, if the module is expanded/located at
$domain_dir/applications/j2ee-apps/foo/fooEJB_jar,
this method will return
$domain_dir/applications/j2ee-apps/foo/fooEJB_jar
return appRootPath + File.separator + getRelativeEmbeddedModulePath(appRootPath, moduleUri) ;
|
static com.sun.enterprise.deployment.Application | getModuleDescriptor(java.lang.String appDir)Turn off the annotation processing during undeployment. Note that
this method is called *only* during the undeployment phase right now.
return getModuleDescriptor(appDir, false);
|
static com.sun.enterprise.deployment.Application | getModuleDescriptor(java.lang.String appDir, boolean annotationProcessing)
try {
FileArchive archive = new FileArchive();
archive.open(appDir);
Archivist archivist =
ArchivistFactory.getArchivistForArchive(archive);
archivist.setAnnotationProcessingRequested(annotationProcessing);
archivist.setXMLValidation(false);
return (Application) ApplicationArchivist.openArchive(archivist, archive, true);
} catch(Throwable t) {
throw new IASDeploymentException(t);
}
|
public static java.lang.String | getRelativeEmbeddedModulePath(java.lang.String appRootPath, java.lang.String moduleUri)This method returns the relative file path of an embedded module to
the application root.
For example, if the module is expanded/located at
$domain_dir/applications/j2ee-apps/foo/fooEJB_jar,
this method will return fooEJB_jar
moduleUri = FileUtils.makeLegalNoBlankFileName(moduleUri);
if (FileUtils.safeIsDirectory(new File(appRootPath, moduleUri))) {
return moduleUri;
} else {
return FileUtils.makeFriendlyFilename(moduleUri);
}
|
protected static java.lang.String | getSystemPropertyIgnoreCase(java.lang.String key)
Properties p = System.getProperties();
Set set = p.entrySet();
for(Iterator it = set.iterator(); it.hasNext(); )
{
Map.Entry me = (Map.Entry)it.next();
String propKey = (String)me.getKey();
if(key.compareToIgnoreCase(propKey) == 0)
return (String)me.getValue();
}
return null;
|
static void | setParentClassLoader(java.lang.ClassLoader bootStrap, com.sun.enterprise.instance.BaseManager baseMgr, DeploymentRequest req)Sets the parent class loader for the given deployment request.
List allClassPaths = new ArrayList();
// system class loader
List systemClasspath = baseMgr.getSystemCPathPrefixNSuffix();
if (systemClasspath.size() > 0) {
allClassPaths.addAll(systemClasspath);
}
// common class loader
List commonClassPath = getCommonClasspath(baseMgr);
if (commonClassPath.size() > 0) {
allClassPaths.addAll(commonClassPath);
}
// shared class loader
// Some explanation on the special handling below:
// Per the platform specification, connector classes are to be availble
// to all applications, i.e. a connector deployed to target foo should
// be available to apps deployed on foo (and not target bar). In that
// case, we will need to figure out all connector module deployed to
// the target on which the application is deployed. Resolving the
// classpath accordlingly.
String targetString = req.getResourceTargetList();
List<String> targets = null;
if (targetString != null) {
// get the accurate list of targets from client
targets = DeploymentServiceUtils.getTargetNamesFromTargetString(
targetString);
} else {
// get all the targets of this domain
targets = new ArrayList<String>();
ConfigContext configContext = AdminService.getAdminService(
).getAdminContext().getAdminConfigContext();
Server[] servers = ServerHelper.getServersInDomain(configContext);
for (Server server: servers) {
targets.add(server.getName());
}
Cluster[] clusters = ClusterHelper.getClustersInDomain(
configContext);
for (Cluster cluster: clusters) {
targets.add(cluster.getName());
}
}
for (String target: targets) {
List sharedClassPath =
baseMgr.getSharedClasspath(true, target);
if (sharedClassPath.size() > 0) {
allClassPaths.addAll(sharedClassPath);
}
}
ClassLoader parentClassLoader =
getClassLoader(allClassPaths, bootStrap, null);
// sets the parent class loader
req.setParentClassLoader(parentClassLoader);
// sets the class path for the class loader
req.setParentClasspath(allClassPaths);
|