Methods Summary |
---|
private static com.sun.enterprise.config.serverbeans.Applications | getApplications()
ConfigContext serverConfigCtx = ApplicationServer.getServerContext().getConfigContext();
Domain domain = ((Domain)serverConfigCtx.getRootConfigBean());
return domain.getApplications();
|
public static java.net.URL[] | getLibraries(java.lang.String librariesStr)Utility method to obtain a resolved list of URLs representing the
libraries specified for an application using the libraries
application deploy-time attribute
if(librariesStr == null)
return null;
String [] librariesStrArray = librariesStr.split(",");
if(librariesStrArray == null)
return null;
final URL [] urls = new URL[librariesStrArray.length];
//Using the string from lib and applibs requires admin which is
//built after appserv-core.
final String appLibsDir = System.getProperty(
SystemPropertyConstants.INSTANCE_ROOT_PROPERTY)
+ File.separator + "lib"
+ File.separator + "applibs";
int i=0;
for(final String libraryStr:librariesStrArray){
try {
File f = new File(libraryStr);
if(!f.isAbsolute())
f = new File(appLibsDir, libraryStr);
URL url = f.toURL();
urls[i++] = url;
} catch (MalformedURLException malEx) {
_logger.log(Level.WARNING,
"loader.cannot_convert_classpath_into_url",
libraryStr);
_logger.log(Level.WARNING,"loader.exception", malEx);
}
}
return urls;
|
public static java.lang.String | getLibrariesForEJBJars(java.lang.String moduleId)Gets the deploy-time "libraries" attribute specified for an EJB module [EJB Jars]
EjbModule app = null;
try {
app = getApplications().getEjbModuleByName(moduleId);
if(app == null) return null;
} catch(ConfigException malEx) {
_logger.log(Level.WARNING, "loader.cannot_convert_classpath_into_url",
moduleId);
_logger.log(Level.WARNING,"loader.exception", malEx);
}
return app.getLibraries();
|
public static java.lang.String | getLibrariesForJ2EEApplication(java.lang.String moduleId)Gets the deploy-time "libraries" attribute specified for a J2EE application (.ear file)
J2eeApplication app = null;
try {
app = getApplications().getJ2eeApplicationByName(moduleId);
if(app == null) return null;
} catch(ConfigException malEx) {
_logger.log(Level.WARNING, "loader.cannot_convert_classpath_into_url",
moduleId);
_logger.log(Level.WARNING,"loader.exception", malEx);
}
return app.getLibraries();
|
public static java.lang.String | getLibrariesForWebModule(java.lang.String moduleId)Gets the deploy-time "libraries" attribute specified for a web module (.war file)
WebModule app = null;
try {
app = getApplications().getWebModuleByName(moduleId);
if(app == null) return null;
} catch(ConfigException malEx) {
_logger.log(Level.WARNING, "loader.cannot_convert_classpath_into_url",
moduleId);
_logger.log(Level.WARNING,"loader.exception", malEx);
}
String librariesStr = app.getLibraries();
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "app = " + app + " library = " + librariesStr);
}
return librariesStr;
|
public static synchronized java.lang.ClassLoader | getSharedClassLoader()Returns the shared class loader
return ApplicationServer.getServerContext().getSharedClassLoader();
|
public static java.lang.String | getWebModuleClassPath(java.lang.String moduleId)Gets the classpath associated with a web module, suffixing libraries defined
[if any] for the application
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "ASClassLoaderUtil.getWebModuleClassPath " +
"for module Id : " + moduleId);
}
synchronized(ASClassLoaderUtil.class) {
if (sharedClasspathForWebModule == null) {
final StringBuilder tmpString = new StringBuilder();
if (Boolean.getBoolean(PELaunch.USE_NEW_CLASSLOADER_PROPERTY)) {
final List<String> tmpList = new ArrayList<String>();
tmpList.addAll(PELaunch.getSharedClasspath());
//include addon jars as well now that they are not part of shared classpath.
tmpList.addAll(PELaunch.getAddOnsClasspath());
for(final String s:tmpList){
tmpString.append(s);
tmpString.append(File.pathSeparatorChar);
}
} else {
tmpString.append(System.getProperty("java.class.path"));
}
//set sharedClasspathForWebModule so that it doesn't need to be recomputed
//for every other invocation
sharedClasspathForWebModule = tmpString.toString();
}
}
StringBuilder classpath = new StringBuilder(sharedClasspathForWebModule);
if (moduleId != null) {
final String specifiedLibraries = getLibrariesForWebModule(moduleId);
final URL[] libs = getLibraries(specifiedLibraries);
if (libs == null) {
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "classpath: " + classpath.toString());
}
return classpath.toString();
}
for (final URL u : libs) {
classpath.append(u + File.pathSeparator);
}
}
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Final classpath: " + classpath.toString());
}
return classpath.toString();
|