Methods Summary |
---|
public com.sun.enterprise.config.serverbeans.J2eeApplication[] | getAllApps()Returns an array of all applications deployed with the server.
J2eeApplication[] apps = ((Applications)this.configBean).getJ2eeApplication();
if(apps == null) return new J2eeApplication[0];
ArrayList list = new ArrayList();
for (int i=0; i<apps.length; i++) {
// add the application to the list if it is referenced
// by this server
if ( isReferenced(apps[i].getName()) ) {
list.add(apps[i]);
}
}
// returns an array of applications referenced by this server
J2eeApplication[] refList = new J2eeApplication[list.size()];
return ( (J2eeApplication[]) list.toArray(refList) );
|
public com.sun.enterprise.deployment.Application | getAppDescriptor(java.lang.String appID, java.lang.ClassLoader parentClassLoader)This method is called by ResourcesUtil during server start up
and by ApplicationLoader when the dd for this app is not registered.
We need to construct the top level application and its classloader
before calling getAppDescriptor(Application) to fully populate the
application object.
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) {
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;
|
public com.sun.enterprise.deployment.Application | getAppDescriptor(com.sun.enterprise.deployment.Application application)Returns the deployment descriptor object for the application DD.
Given the top level application object, this method populates
it with all the submodule information by loading from disc.
if (application == null) {
throw new ConfigException("Application object should not be null");
}
ClassLoader cl = application.getClassLoader();
// We need to use a temp CL until we are done with validate().
// See https://glassfish.dev.java.net/issues/show_bug.cgi?id=223
// for details.
if (cl instanceof InstrumentableClassLoader) {
ClassLoader tcl = InstrumentableClassLoader.class.cast(cl).copy();
application.setClassLoader(tcl);
// set it in all the bundles as well,
for (BundleDescriptor bd : (Collection<BundleDescriptor>)
application.getBundleDescriptors()) {
bd.setClassLoader(tcl);
}
}
String appId = application.getRegistrationName();
// we need to load this puppy, save it in the cache...
try {
String appDir = getLocation(appId);
FileArchive in = openDDArchive(appId, appDir);
ApplicationArchivist archivist = new ApplicationArchivist();
archivist.readModulesDescriptors(application, in);
archivist.readRuntimeDeploymentDescriptor(in, application);
if(!isSystemAdmin(appId) && !isSystem(appId)) {
// we need to read persistence descriptors separately
// because they are read from appDir as oppsed to xmlDir.
readPersistenceDeploymentDescriptors(appDir, application);
}
archivist.setDescriptor(application);
// use temp CL that is set in the application. For details,
// see https://glassfish.dev.java.net/issues/show_bug.cgi?id=223
archivist.validate(application.getClassLoader());
application.setGeneratedXMLDirectory(getGeneratedXMLLocation(appId));
if (!application.getWebServiceDescriptors().isEmpty()) {
ModuleContentLinker visitor = new ModuleContentLinker(in);
application.visit((com.sun.enterprise.deployment.util.ApplicationVisitor) visitor);
}
// Now that validate() is called, we can set the actual CL.
// See https://glassfish.dev.java.net/issues/show_bug.cgi?id=223
// for details.
application.setClassLoader(cl);
// set it in all the bundles as well,
for (BundleDescriptor bd : (Collection<BundleDescriptor>)
application.getBundleDescriptors()) {
bd.setClassLoader(cl);
}
registerDescriptor(appId, application);
return application;
} catch (ConfigException ce) {
throw ce;
} catch (Throwable t) {
throw new ConfigException(
Localizer.getValue(ExceptionType.FAIL_DD_LOAD, appId), t);
}
|
public java.lang.String | getDescription(java.lang.String id)
return getJ2eeApplication(id).getDescription();
|
public com.sun.enterprise.deployment.Application | getDescriptor(java.lang.String appID, java.lang.ClassLoader cl, java.lang.String loc, boolean validateXML)This method only returns from cache. To force the creation of
an application object, see getAppDescriptor method.
Only parameter appID is used. The rest of the params are kept for
backward compatibility purpose until we clean up the instance
managers completely.
return getRegisteredDescriptor(appID);
|
public java.lang.String | getGeneratedXMLLocation(java.lang.String name)
ApplicationEnvironment env = instanceEnvironment.getApplicationEnvironment(name);
return env.getAppGeneratedXMLPath();
|
private com.sun.enterprise.config.serverbeans.J2eeApplication | getJ2eeApplication(java.lang.String appId)
J2eeApplication app = (J2eeApplication)
((Applications)this.configBean).getJ2eeApplicationByName(appId);
if(app == null)
throw new ConfigException(
Localizer.getValue(ExceptionType.APP_NOT_EXIST));
return app;
|
public java.lang.String | getJSPLocation(java.lang.String appId)
ApplicationEnvironment env =
instanceEnvironment.getApplicationEnvironment(appId);
return env.getAppJSPPath();
|
public java.lang.String | getLocation(java.lang.String appId)
J2eeApplication app = (J2eeApplication) getJ2eeApplication(appId);
InstanceEnvironment instEnv;
if ((instEnv = getInstanceEnvironment()) == null) {
throw new ConfigException("instEnv was null");
}
PropertyResolver resolver = new PropertyResolver(super.configContext,
instEnv.getName());
String appLocation;
if ((appLocation = app.getLocation()) == null) {
throw new ConfigException("appLocation was null");
};
String resolvedPath = resolver.resolve(appLocation);
return resolvedPath;
|
public javax.enterprise.deploy.shared.ModuleType | getModuleType()
return ModuleType.EAR;
|
public java.util.Map | getRegisteredDescriptors()
if (apps==null) {
synchronized (AppsManager.class) {
if (apps==null) {
apps = new HashMap();
}
}
}
return apps;
|
public java.lang.String | getStubLocation(java.lang.String appId)
ApplicationEnvironment env =
instanceEnvironment.getApplicationEnvironment(appId);
return env.getAppStubPath();
|
public java.lang.String | getVirtualServersByAppName(java.lang.String appName)
return ServerBeansFactory.getVirtualServersByAppName(configContext, appName);
|
public boolean | isEnabled(java.lang.String appId)
return getJ2eeApplication(appId).isEnabled();
|
public boolean | isJavaWebStartEnabled(java.lang.String appId)Reports whether Java Web Start access is enabled for the app clients in
the specified application.
return getJ2eeApplication(appId).isJavaWebStartEnabled();
|
protected boolean | isRegistered(java.lang.String appId, com.sun.enterprise.config.ConfigBean bean)
ConfigBean cb = null;
try {
cb = ((Applications)bean).getJ2eeApplicationByName(appId);
} catch(Exception cn) {
}
if(cb != null) return true;
return false;
|
public boolean | isSystem(java.lang.String appId)Checks whether this application is a system app
ResourceType in domain.xml should start with "system-"
J2eeApplication ja = getJ2eeApplication(appId);
String resourceType = ja.getObjectType();
if(resourceType.startsWith(SYSTEM_PREFIX))
return true;
else
return false;
|
public boolean | isSystemAdmin(java.lang.String appId)Checks whether this application is a system admin app
ResourceType in domain.xml should start with "system-admin"
J2eeApplication ja = getJ2eeApplication(appId);
String resourceType = ja.getObjectType();
if(resourceType.startsWith(SYSTEM_ADMIN_PREFIX))
return true;
else
return false;
|
public boolean | isSystemPredeployed(java.lang.String appId)Checks whether this module is a pre-deployed system module
ResourceType in domain.xml should start with "system"
Also it should be directory deployed.
J2eeApplication ja = getJ2eeApplication(appId);
String resourceType = ja.getObjectType();
boolean isDirectoryDeployed = ja.isDirectoryDeployed();
if (resourceType.startsWith(SYSTEM_PREFIX) && isDirectoryDeployed) {
return true;
} else {
return false;
}
|
public java.util.List | listIds()Returns a list of all applications deployed with the server.
ArrayList arr = new ArrayList();
J2eeApplication[] apps = ((Applications)this.configBean).getJ2eeApplication();
if(apps == null) return arr;
for (int i=0;i<apps.length;i++) {
String name = apps[i].getName();
// adds the application to the list if
// it is referenced by this server
if ( isReferenced(name) ) {
arr.add(name);
}
}
return arr;
|
public void | remove(java.lang.String appId)Removes the application information from the configuration file.
J2eeApplication backJa = (J2eeApplication)
((Applications)configBean).getJ2eeApplicationByName(appId);
((Applications)configBean).removeJ2eeApplication(backJa);
|
public void | setDescription(java.lang.String id, java.lang.String desc)
getJ2eeApplication(id).setDescription(desc);
|
public void | setEnable(java.lang.String appId, boolean enabled)Identifies whether an application is enabled or disabled.
getJ2eeApplication(appId).setEnabled(enabled);
|
public void | setLocation(java.lang.String appId, java.lang.String location)Set the location for an App
getJ2eeApplication(appId).setLocation(location);
|
public void | setOptionalAttributes(java.lang.String appId, java.util.Properties optionalAttributes)Set the optional attributes for an App
if(optionalAttributes!=null) {
J2eeApplication ja = getJ2eeApplication(appId);
Enumeration tags = optionalAttributes.keys();
while(tags.hasMoreElements())
{
String tag = (String)tags.nextElement();
String value = optionalAttributes.getProperty(tag);
ja.setAttributeValue(tag, value);
}
}
|