Methods Summary |
---|
public java.lang.String | getDescription(java.lang.String modId)
return getEjbModule(modId).getDescription();
|
public com.sun.enterprise.deployment.Application | getDescriptor(java.lang.String moduleID, java.lang.ClassLoader parentClassLoader)This method is called only by ResourcesUtil during server start up.
We need to construct the application classloader before calling into
other getDescriptor method to fully populate the application object.
ClassLoader cl = new EJBClassLoader(parentClassLoader);
String[] classPaths = (String[]) EJBClassPathUtils.getModuleClasspath(
moduleID, null, this).toArray(new String[0]);
if (classPaths != null) {
int classPathSize = classPaths.length;
for (int i=0; i<classPathSize; i++) {
try {
((EJBClassLoader) cl).appendURL(new File(classPaths[i]));
} catch (IOException ioe) {
//@@ i18n
_logger.log(Level.WARNING, "Cannot convert path to URL: " + classPaths[i]);
}
}
}
return getDescriptor(moduleID, cl, false);
|
public com.sun.enterprise.deployment.Application | getDescriptor(java.lang.String modId, java.lang.ClassLoader cl, java.lang.String loc, boolean validateXML)Returns the deployment descriptor object for this ejb module.
return getDescriptor(modId, cl, validateXML);
|
public com.sun.enterprise.deployment.Application | getDescriptor(java.lang.String modId, java.lang.ClassLoader cl, boolean validateXml)Returns the deployment descriptor object for this ejb module. This
method gets called when deployment backend is running verification
during deployment.
Application application = getRegisteredDescriptor(modId);
if (application!=null) {
application.setClassLoader(cl);
return application;
}
try {
String moduleDir = getLocation(modId);
EjbArchivist ejbArchivist = new EjbArchivist();
ejbArchivist.setXMLValidation(validateXml);
// 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
ClassLoader tcl = (cl instanceof InstrumentableClassLoader) ?
InstrumentableClassLoader.class.cast(cl).copy() : cl;
ejbArchivist.setClassLoader(tcl);
FileArchive archive = openDDArchive(modId, moduleDir);
// Try to load the app from the serialized descriptor file.
SerializedDescriptorHelper.Loader sdLoader =
SerializedDescriptorHelper.load(modId, this);
Application deserializedApplication = sdLoader.getApplication();
if (deserializedApplication != null) {
application = deserializedApplication;
} else {
application = ApplicationArchivist.openArchive(modId, ejbArchivist, archive, true);
if(!isSystemAdmin(modId) && !isSystem(modId)) {
// we need to read persistence descriptors separately
// because they are read from appDir as oppsed to xmlDir.
readPersistenceDeploymentDescriptors(moduleDir, application);
}
}
// We need to use a temp CL until the end of this method...
// see https://glassfish.dev.java.net/issues/show_bug.cgi?id=223
application.setClassLoader(tcl);
// set it in all the bundles as well,
for (BundleDescriptor bd : (Collection<BundleDescriptor>)
application.getBundleDescriptors()) {
bd.setClassLoader(tcl);
}
application.setGeneratedXMLDirectory(getGeneratedXMLLocation(modId));
if (!application.getWebServiceDescriptors().isEmpty()) {
ModuleContentLinker visitor = new ModuleContentLinker(archive, true);
application.visit((com.sun.enterprise.deployment.util.ApplicationVisitor) visitor);
}
// Now, let's set the actual class loader
application.setClassLoader(cl);
// set it in all the bundles as well,
for (BundleDescriptor bd : (Collection<BundleDescriptor>)
application.getBundleDescriptors()) {
bd.setClassLoader(cl);
}
registerDescriptor(modId, application);
// If needed, save this app in serialized form for faster loading next time.
sdLoader.store(application);
return application;
} catch (ConfigException ce) {
throw ce;
} catch (IOException ioe) {
throw new ConfigException(Localizer.getValue(
ExceptionType.IO_ERROR_LOADING_DD, modId), ioe);
} catch (Throwable t) {
throw new ConfigException(Localizer.getValue(
ExceptionType.FAIL_DD_LOAD, modId), t);
}
|
private EjbModule | getEjbModule(java.lang.String modId)
EjbModule mod = (EjbModule)
((Applications)this.configBean).getEjbModuleByName(modId);
if(mod == null)
throw new ConfigException(Localizer.getValue(ExceptionType.NO_SUCH_EJB_MOD));
return mod;
|
public java.lang.String | getGeneratedXMLLocation(java.lang.String name)
ModuleEnvironment menv = instanceEnvironment.getModuleEnvironment(name,
DeployableObjectType.EJB);
return menv.getModuleGeneratedXMLPath();
|
public java.lang.String | getLocation(java.lang.String name)
EjbModule ejbModule = (EjbModule)
((Applications)this.configBean).getEjbModuleByName(name);
String location = ejbModule.getLocation();
return resolvePath(location);
|
public javax.enterprise.deploy.shared.ModuleType | getModuleType()
return ModuleType.EJB;
|
public java.lang.String | getStubLocation(java.lang.String name)
ModuleEnvironment menv = instanceEnvironment.getModuleEnvironment(name,
DeployableObjectType.EJB);
return menv.getModuleStubPath();
|
public boolean | isEnabled(java.lang.String modId)
return getEjbModule(modId).isEnabled();
|
protected boolean | isRegistered(java.lang.String appId, com.sun.enterprise.config.ConfigBean bean)
ConfigBean cb = null;
try {
cb = ((Applications)bean).getEjbModuleByName(appId);
} catch(Exception cn) {
}
if(cb != null) return true;
return false;
|
public boolean | isShared(java.lang.String modId)
//FIXME NYI
return false; //getEjbModule(modId).isShared();
|
public boolean | isSystem(java.lang.String modId)Checks whether this module is a systemmodule
ResourceType in domain.xml should start with "system-"
EjbModule em = getEjbModule(modId);
String resourceType = em.getObjectType();
if(resourceType.startsWith(SYSTEM_PREFIX))
return true;
else
return false;
|
public boolean | isSystemAdmin(java.lang.String modId)Checks whether this module is a system admin module
ResourceType in domain.xml should start with "system-admin"
EjbModule em = getEjbModule(modId);
String resourceType = em.getObjectType();
if(resourceType.startsWith(SYSTEM_ADMIN_PREFIX))
return true;
else
return false;
|
public boolean | isSystemPredeployed(java.lang.String modId)Checks whether this module is a pre-deployed system module
ResourceType in domain.xml should start with "system"
Also it should be directory deployed.
EjbModule em = getEjbModule(modId);
String resourceType = em.getObjectType();
boolean isDirectoryDeployed = em.isDirectoryDeployed();
if (resourceType.startsWith(SYSTEM_PREFIX) && isDirectoryDeployed) {
return true;
} else {
return false;
}
|
public EjbModule[] | listEjbModules()Returns an array of all ejb modules deployed with the server.
EjbModule[] mods = ((Applications)this.configBean).getEjbModule();
if(mods == null) return new EjbModule[0];
ArrayList list = new ArrayList();
for (int i=0; i<mods.length; i++) {
// add the modules to the list if it is referenced
// by this server
if ( isReferenced(mods[i].getName()) ) {
list.add(mods[i]);
}
}
// returns an array of modules referenced by this server
EjbModule[] refList = new EjbModule[list.size()];
return ( (EjbModule[]) list.toArray(refList) );
|
public java.util.List | listIds()Returns a list of all ejb modules deployed with the server.
ArrayList arr = new ArrayList();
EjbModule[] mods = ((Applications)this.configBean).getEjbModule();
if(mods == null) return arr;
for (int i=0;i<mods.length;i++) {
String name = mods[i].getName();
// adds the web module to the list if
// it is referenced by this server
if ( isReferenced(name) ) {
arr.add(name);
}
}
return arr;
|
public void | remove(java.lang.String modID)
removeEjbModule(modID);
|
private void | removeEjbModule(java.lang.String modId)
EjbModule backEm = (EjbModule)
((Applications)configBean).getEjbModuleByName(modId);
((Applications)configBean).removeEjbModule(backEm);
|
public void | setDescription(java.lang.String modId, java.lang.String desc)
getEjbModule(modId).setDescription(desc);
|
public void | setEnable(java.lang.String modId, boolean enable)
getEjbModule(modId).setEnabled(enable);
|
public void | setLocation(java.lang.String modId, java.lang.String location)Set the location for an EJB Module
getEjbModule(modId).setLocation(location);
|
public void | setOptionalAttributes(java.lang.String modId, java.util.Properties optionalAttributes)Set the optional attributes for an module
if(optionalAttributes!=null) {
EjbModule em = getEjbModule(modId);
Enumeration tags = optionalAttributes.keys();
while(tags.hasMoreElements())
{
String tag = (String)tags.nextElement();
String value = optionalAttributes.getProperty(tag);
em.setAttributeValue(tag, value);
}
}
|
public void | setShared(java.lang.String modId, boolean shared)
//FIXME NYI
//getEjbModule(modId).setShared(shared);
|