Methods Summary |
---|
public void | addAppRole(SecurityRoleDescriptor descriptor)
Role role = new Role(descriptor.getName());
role.setDescription(descriptor.getDescription());
getAppRoles().add(role);
|
public void | addApplication(com.sun.enterprise.deployment.Application application)Add all the deployment information about the given application to me.
for (Iterator itr = application.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) itr.next();
this.addEjbBundleDescriptor(ejbBundleDescriptor);
}
for (Iterator itr = application.getWebBundleDescriptors().iterator(); itr.hasNext();) {
WebBundleDescriptor webBundleDescriptor = (WebBundleDescriptor) itr.next();
this.addWebBundleDescriptor(webBundleDescriptor);
}
for (Iterator itr = application.getApplicationClientDescriptors().iterator(); itr.hasNext();) {
ApplicationClientDescriptor acd = (ApplicationClientDescriptor) itr.next();
this.addApplicationClientDescriptor(acd);
}
for (Iterator itr = application.getRarDescriptors().iterator(); itr.hasNext();) {
ConnectorDescriptor rarDescriptor = (ConnectorDescriptor) itr.next();
this.addRarDescriptor(rarDescriptor);
}
|
public void | addApplicationClientDescriptor(ApplicationClientDescriptor applicationClientDescriptor)Add deplyoment information about an application client.
addBundleDescriptor(applicationClientDescriptor);
|
private void | addBundleDescriptor(BundleDescriptor bundleDescriptor)
ModuleDescriptor newModule = bundleDescriptor.getModuleDescriptor();
addModule(newModule);
|
public void | addDescriptor(java.lang.Object descriptor)
if (descriptor instanceof EjbBundleDescriptor) {
addEjbBundleDescriptor((EjbBundleDescriptor) descriptor);
}
if (descriptor instanceof WebBundleDescriptor) {
addWebBundleDescriptor((WebBundleDescriptor) descriptor);
}
if (descriptor instanceof ConnectorDescriptor) {
addRarDescriptor((ConnectorDescriptor) descriptor);
}
|
public void | addEjbBundleDescriptor(EjbBundleDescriptor ejbBundleDescriptor)Adds a new Enterprise bean to me.
addBundleDescriptor(ejbBundleDescriptor);
|
public void | addEntityManagerFactory(java.lang.String unitName, java.lang.String persistenceRootUri, javax.persistence.EntityManagerFactory emf)Set the physical entity manager factory for a persistence unit
within this application.
This method takes a parameter called persistenceRootUri to support for
fully-qualified persistence-unit-name syntax within
persistence-unit-refs and persistence-context-refs. The syntax is similar
to ejb-link and messge-destination-link. See (EJB 3 core spec: 15.10.2)
String fullyQualifiedUnitName = persistenceRootUri +
PERSISTENCE_UNIT_NAME_SEPARATOR + unitName;
// Always allow fully qualified lookup.
entityManagerFactories.put(fullyQualifiedUnitName, emf);
// Allow unqualified lookup, unless there are multiple .ear level
// persistence units declaring the same persistence unit name. In that
// case, only a fully-qualified lookup will work. Note that even
// though the entity manager factory map might contain more than one
// key pointing to the same entity manager factory, the behavior
// of getEntityManagerFactories() is not affected since it returns a Set.
if( entityManagerFactoryUnitNames.contains(unitName) ) {
entityManagerFactories.remove(unitName);
} else {
entityManagerFactories.put(unitName, emf);
entityManagerFactoryUnitNames.add(unitName);
}
|
public void | addModule(com.sun.enterprise.deployment.util.ModuleDescriptor descriptor)
modules.add(descriptor);
if (descriptor.getDescriptor()!=null) {
descriptor.getDescriptor().addNotificationListener(this);
descriptor.getDescriptor().setApplication(this);
}
this.changed(true);
|
public void | addRarDescriptor(ConnectorDescriptor rarDescriptor)Add a RAR descriptor to this application.
addBundleDescriptor(rarDescriptor);
|
public void | addRole(com.sun.enterprise.deployment.Role role)Adds a new abstract role
for (Iterator itr = this.getWebBundleDescriptors().iterator(); itr.hasNext();){
WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next();
wbd.addRole(role);
}
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();){
EjbBundleDescriptor ejbd = (EjbBundleDescriptor) itr.next();
ejbd.addRole(role);
}
changed();
|
public void | addSecurityRoleMapping(com.sun.enterprise.deployment.runtime.common.SecurityRoleMapping roleMapping)
roleMaps.add(roleMapping);
|
public void | addWebBundleDescriptor(WebBundleDescriptor webBundleDescriptor)Add a web bundle descriptor to this application.
addBundleDescriptor(webBundleDescriptor);
|
public void | changed(boolean dirtyChange)Calls changed() and sets the dirty flag.
if (dirtyChange) {
this.isDirty = true;
}
super.changed();
|
public void | changed()Called when my data changes and causes notification.
NotificationEvent ne = new NotificationEvent(this, DESCRIPTOR_CHANGED, this);
Vector listenersClone = null;
synchronized (listeners) {
listenersClone = (Vector) listeners.clone();
}
for (Enumeration e = listenersClone.elements(); e.hasMoreElements();) {
NotificationListener nl = (NotificationListener) e.nextElement();
nl.notification(ne);
}
|
public boolean | containsCMPEntity()
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
if (((EjbBundleDescriptor) itr.next()).containsCMPEntity())
return true;
}
return false;
|
public static com.sun.enterprise.deployment.Application | createApplication(java.lang.String name, com.sun.enterprise.deployment.util.ModuleDescriptor newModule)Creates a new application to hold a standalone module
// create a new empty application
Application application = new Application();
application.setVirtual(true);
if (name==null && newModule.getDescriptor()!=null) {
name = newModule.getDescriptor().getDisplayName();
}
if (name!=null) {
application.setDisplayName(name);
application.setName(name);
}
// add the module to it
newModule.setStandalone(true);
newModule.setArchiveUri(name);
if (newModule.getDescriptor()!=null) {
newModule.getDescriptor().setApplication(application);
}
application.addModule(newModule);
return application;
|
public static com.sun.enterprise.deployment.Application | createApplication(com.sun.enterprise.deployment.deploy.shared.AbstractArchive archive, boolean introspect)This method creates a top level Application object for an ear.
return createApplication(archive, introspect, false);
|
public static com.sun.enterprise.deployment.Application | createApplication(com.sun.enterprise.deployment.deploy.shared.AbstractArchive archive, boolean introspect, boolean directory)This method creates a top level Application object for an ear.
if (introspect) {
return getApplicationFromIntrospection(archive, directory);
} else {
return getApplicationFromAppXml(archive);
}
|
private static java.lang.String | deriveArchiveUri(java.lang.String appRoot, java.io.File subModule, boolean deploydir)
//if deploydir, revert the name of the directory to
//the format of foo/bar/voodoo.ext (where ext is war/rar/jar)
if (deploydir) {
return FileUtils.revertFriendlyFilename(subModule.getName());
}
//if archive deploy, need to make sure all of the directory
//structure is correctly included
String uri = subModule.getAbsolutePath().substring(appRoot.length()+1);
return uri.replace(File.separatorChar, '/");
|
public void | doneOpening()Called when I have just been opened
this.isDirty = false;
this.changed(false);
|
void | doneSaving()
this.isDirty = false;
this.changed(false);
|
public java.util.Set | getAppRoles()Return the set of com.sun.enterprise.deployment.Role objects
I have (the ones defined in application xml).
if (this.appRoles == null) {
this.appRoles = new OrderedSet();
}
return this.appRoles;
|
public ApplicationClientDescriptor | getApplicationClientByName(java.lang.String name)Obtain the application client in this application of the given display name. If the application client is not
present, throw an IllegalArgumentException.
for (Iterator itr = this.getApplicationClientDescriptors().iterator(); itr.hasNext();) {
ApplicationClientDescriptor next = (ApplicationClientDescriptor) itr.next();
if (next.getDisplayName().equals(name)) {
return next;
}
}
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.exceptionapphasnoappclientname",
"This application has no application clients of name {0}", new Object []{name}));
|
public ApplicationClientDescriptor | getApplicationClientByUri(java.lang.String name)Obtain an application client descriptor in this application of the given URI. If the appclient is not
present, throw an IllegalArgumentException.
Descriptor desc = getModuleByTypeAndUri(ModuleType.CAR, name);
if (desc!=null && desc instanceof ApplicationClientDescriptor) {
return (ApplicationClientDescriptor) desc;
}
throw new IllegalArgumentException(name);
|
public java.util.Set | getApplicationClientDescriptors()Return the Set of app client deploymenbt objects.
return getBundleDescriptors(ModuleType.CAR);
|
private static com.sun.enterprise.deployment.Application | getApplicationFromAppXml(com.sun.enterprise.deployment.deploy.shared.AbstractArchive archive)
ApplicationArchivist archivist = new ApplicationArchivist();
archivist.setXMLValidation(false);
// read the standard deployment descriptors
Application application = null;
try {
application =
(Application) archivist.readStandardDeploymentDescriptor(archive);
} catch (Exception ex) {
//@@@ i18n
_logger.log(Level.SEVERE,
"Error loading application.xml from " + archive.getArchiveUri());
_logger.log(Level.SEVERE, ex.getMessage());
}
return application;
|
private static com.sun.enterprise.deployment.Application | getApplicationFromIntrospection(com.sun.enterprise.deployment.deploy.shared.AbstractArchive archive, boolean directory)This method introspect an ear file and populate the Application object.
We follow the Java EE platform specification, Section EE.8.4.2
to determine the type of the modules included in this application.
String appRoot = archive.getArchiveUri(); //archive is a directory
Application app = new Application();
app.setLoadedFromApplicationXml(false);
app.setVirtual(false);
//name of the file without its extension
String appName = appRoot.substring(
appRoot.lastIndexOf(File.separatorChar)+1);
app.setName(appName);
List<AbstractArchive> unknowns = new ArrayList();
File[] files = getEligibleEntries(new File(appRoot), directory);
for (File subModule : files) {
AbstractArchive subArchive = null;
try {
try {
if (!directory) {
subArchive = new InputJarArchive();
((InputJarArchive)subArchive).open(subModule.getAbsolutePath());
} else {
subArchive = new FileArchive();
((FileArchive)subArchive).open(subModule.getAbsolutePath());
}
} catch (IOException ex) {
_logger.log(Level.WARNING, ex.getMessage());
}
//for archive deployment, we check the sub archives by its
//file extension; for directory deployment, we check the sub
//directories by its name. We are now supporting directory
//names with both "_suffix" and ".suffix".
//Section EE.8.4.2.1.a
String name = subModule.getName();
String uri = deriveArchiveUri(appRoot, subModule, directory);
if ( (!directory && name.endsWith(".war"))
|| (directory &&
(name.endsWith("_war") ||
name.endsWith(".war"))) ) {
String contextRoot =
uri.substring(uri.lastIndexOf('/")+1, uri.lastIndexOf('."));
ModuleDescriptor md = new ModuleDescriptor();
md.setArchiveUri(uri);
md.setModuleType(ModuleType.WAR);
md.setContextRoot(contextRoot);
app.addModule(md);
}
//Section EE.8.4.2.1.b
else if ( (!directory && name.endsWith(".rar"))
|| (directory &&
(name.endsWith("_rar") ||
name.endsWith(".rar"))) ) {
ModuleDescriptor md = new ModuleDescriptor();
md.setArchiveUri(uri);
md.setModuleType(ModuleType.RAR);
app.addModule(md);
}
else if ( (!directory && name.endsWith(".jar"))
|| (directory &&
(name.endsWith("_jar") ||
name.endsWith(".jar"))) ) {
try {
//Section EE.8.4.2.1.d.i
AppClientArchivist acArchivist = new AppClientArchivist();
if (acArchivist.hasStandardDeploymentDescriptor(subArchive)
|| acArchivist.hasRuntimeDeploymentDescriptor(subArchive)
|| acArchivist.getMainClassName(subArchive.getManifest()) != null) {
ModuleDescriptor md = new ModuleDescriptor();
md.setArchiveUri(uri);
md.setModuleType(ModuleType.CAR);
md.setManifest(subArchive.getManifest());
app.addModule(md);
continue;
}
//Section EE.8.4.2.1.d.ii
EjbArchivist ejbArchivist = new EjbArchivist();
if (ejbArchivist.hasStandardDeploymentDescriptor(subArchive)
|| ejbArchivist.hasRuntimeDeploymentDescriptor(subArchive)) {
ModuleDescriptor md = new ModuleDescriptor();
md.setArchiveUri(uri);
md.setModuleType(ModuleType.EJB);
app.addModule(md);
continue;
}
} catch (IOException ex) {
_logger.log(Level.WARNING, ex.getMessage());
}
//Still could not decide between an ejb and a library
unknowns.add(subArchive);
} else {
//ignored
}
} finally {
if (subArchive != null) {
try {
subArchive.close();
} catch (IOException ioe) {
_logger.log(Level.WARNING, localStrings.getLocalString("enterprise.deployment.errorClosingSubArch", "Error closing subarchive {0}", new Object[] {subModule.getAbsolutePath()}), ioe);
}
}
}
}
if (unknowns.size() > 0) {
EjbComponentAnnotationDetector detector =
new EjbComponentAnnotationDetector();
for (int i = 0; i < unknowns.size(); i++) {
File jarFile = new File(unknowns.get(i).getArchiveUri());
try {
if (detector.hasAnnotationInArchive(unknowns.get(i))) {
String uri = deriveArchiveUri(appRoot, jarFile, directory);
//Section EE.8.4.2.1.d.ii, alas EJB
ModuleDescriptor md = new ModuleDescriptor();
md.setArchiveUri(uri);
md.setModuleType(ModuleType.EJB);
app.addModule(md);
}
} catch (IOException ex) {
_logger.log(Level.WARNING, ex.getMessage());
}
}
}
return app;
|
public java.util.Set | getArchivableDescriptors()Return all my subcomponents that have a file format (EJB, WAR and
AppCLient JAR).
Set archivableDescriptors = new HashSet();
archivableDescriptors.addAll(this.getEjbBundleDescriptors());
archivableDescriptors.addAll(this.getWebBundleDescriptors());
archivableDescriptors.addAll(this.getApplicationClientDescriptors());
archivableDescriptors.addAll(this.getRarDescriptors());
return archivableDescriptors;
|
public java.util.Set | getBundleDescriptors(javax.enterprise.deploy.shared.ModuleType type)Obtain a full set of bundle descriptors for a particular type
if (type==null) {
return null;
}
Set bundleSet = new HashSet();
for (Iterator bundles = getModules();bundles.hasNext();) {
ModuleDescriptor aModule = (ModuleDescriptor) bundles.next();
if (type.equals(aModule.getModuleType())) {
if (aModule.getDescriptor()!=null) {
bundleSet.add(aModule.getDescriptor());
} else {
DOLUtils.getDefaultLogger().fine("Null descriptor for module " + aModule.getArchiveUri());
}
}
}
return bundleSet;
|
public java.util.Set | getBundleDescriptors()Obtain a set of all bundle descriptors, regardless of type
Set bundleSet = new HashSet();
for (Iterator bundles = getModules();bundles.hasNext();) {
ModuleDescriptor aModule = (ModuleDescriptor) bundles.next();
if (aModule.getDescriptor()!=null) {
bundleSet.add(aModule.getDescriptor());
} else {
DOLUtils.getDefaultLogger().fine("Null descriptor for module " + aModule.getArchiveUri());
}
}
return bundleSet;
|
public EjbCMPEntityDescriptor | getCMPDescriptorFor(java.lang.String className)Return the EjbCMPEntityDescriptor for a bean
for the given classname.
It is assumed that there is a 1-to-1 mapping
from class to descriptor.
This is called at runtime from the Persistence Manager.
if ( cmpDescriptors == null ) {
cmpDescriptors = new Hashtable();
Iterator ejbBundles = getEjbBundleDescriptors().iterator();
while ( ejbBundles.hasNext() ) {
EjbBundleDescriptor bundle = (EjbBundleDescriptor)ejbBundles.next();
Iterator ejbs = bundle.getEjbs().iterator();
while ( ejbs.hasNext() ) {
EjbDescriptor ejb = (EjbDescriptor)ejbs.next();
if ( ejb instanceof EjbCMPEntityDescriptor )
cmpDescriptors.put(ejb.getEjbImplClassName(), ejb);
}
}
}
return (EjbCMPEntityDescriptor)cmpDescriptors.get(className);
|
public java.lang.ClassLoader | getClassLoader()
if (classLoader==null) {
throw new RuntimeException("No class loader associated with application " + getName());
}
return classLoader;
|
public java.lang.String | getDefaultSpecVersion()
return ApplicationNode.SPEC_VERSION;
|
public EjbBundleDescriptor | getEjbBundleByName(java.lang.String name)Obtain the EJB-JAR in this application of the given name.
If the JAR is not
present, throw an IllegalArgumentException.
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) itr.next();
if (ejbBundleDescriptor.getDisplayName().equals(name))
return ejbBundleDescriptor;
}
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.exceptionapphasnoejbjarnamed",
"This application has no ejb jars of name {0}",
new Object []{name}));
|
public EjbBundleDescriptor | getEjbBundleByUri(java.lang.String name)Get EJB-JAR of the given URI (filename within EAR)
Descriptor desc = getModuleByTypeAndUri(ModuleType.EJB, name);
if (desc!=null && desc instanceof EjbBundleDescriptor) {
return (EjbBundleDescriptor) desc;
}
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.exceptionapphasnoejbjarnamed",
"This application has no ejb jars of name {0}",
new Object []{name}));
|
public java.util.Set | getEjbBundleDescriptors()Obtain the full set of all the Ejb JAR deployment information in this application.
return getBundleDescriptors(ModuleType.EJB);
|
public EjbDescriptor | getEjbByName(java.lang.String ejbName)Obtain the EJB in this application of the given display name. If the EJB is not
present, throw an IllegalArgumentException.
EjbDescriptor ejbDescriptor = null;
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) itr.next();
if (ejbBundleDescriptor.hasEjbByName(ejbName)) {
return ejbBundleDescriptor.getEjbByName(ejbName);
}
}
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.exceptionapphasnobeannamed",
"This application has no beans of name {0}", new Object []{ejbName}));
|
public int | getEjbComponentCount()The number of EJB JARs in this application.
int count = 0;
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbd = (EjbBundleDescriptor) itr.next();
count = count + ejbd.getEjbs().size();
}
return count;
|
public java.util.Vector | getEjbDescriptors()Return the Vector of ejb deployment objects.
Vector ejbDescriptors = new Vector();
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) itr.next();
ejbDescriptors.addAll(ejbBundleDescriptor.getEjbs());
}
return ejbDescriptors;
|
public java.util.Vector | getEjbReferenceDescriptors()The Vector of EJB references in all subcomponents of this application.
Vector ejbReferenceDescriptors = new Vector();
for (Iterator itr = this.getNamedDescriptors().iterator(); itr.hasNext();) {
Object next = itr.next();
if (next instanceof EjbReferenceDescriptor) {
ejbReferenceDescriptors.addElement(next);
}
}
return ejbReferenceDescriptors;
|
private static java.io.File[] | getEligibleEntries(java.io.File appRoot, boolean deploydir)
//For deploydir, all modules are exploded at the top of application root
if (deploydir) {
return appRoot.listFiles(new DirectoryIntrospectionFilter());
}
//For archive deploy, recursively search the entire package
Vector files = new Vector();
getListOfFiles(appRoot, files,
new ArchiveIntrospectionFilter(appRoot.getAbsolutePath()));
return (File[]) files.toArray(new File[files.size()]);
|
public java.util.Set | getEntityManagerFactories()Returns the set of physical entity manager factories associated with
persistence units in this application.
return new HashSet<EntityManagerFactory>
(entityManagerFactories.values());
|
public javax.persistence.EntityManagerFactory | getEntityManagerFactory(java.lang.String unitName, BundleDescriptor declaringModule)Retrieve the physical entity manager factory associated with the
unitName of an application-level persistence unit. Returns null if
no matching entry is found.
String lookupString = unitName;
int separatorIndex =
unitName.lastIndexOf(PERSISTENCE_UNIT_NAME_SEPARATOR);
if( separatorIndex != -1 ) {
String unqualifiedUnitName =
unitName.substring(separatorIndex + 1);
String path = unitName.substring(0, separatorIndex);
String persistenceRootUri = getTargetUri(declaringModule, path);
lookupString = persistenceRootUri +
PERSISTENCE_UNIT_NAME_SEPARATOR + unqualifiedUnitName;
}
return entityManagerFactories.get(lookupString);
|
public java.lang.String | getGeneratedXMLDirectory()Returns the generated XML directory for this app
return generatedXMLDir;
|
public java.util.Set | getJndiNameEnvironments()Obtain the full set of all the subcomponents of this application that use
a JNDI name environment..
Set jndiNameEnvironments = new HashSet();
jndiNameEnvironments.addAll(this.getWebBundleDescriptors());
jndiNameEnvironments.addAll(this.getApplicationClientDescriptors());
jndiNameEnvironments.addAll(this.getEjbDescriptors());
return jndiNameEnvironments;
|
public java.lang.String | getLibraryDirectory()Returns an "intelligent" value for the library directory setting, meaning
the current value if it has been set to a non-null, non-empty value;
the default value if the value has never been set, and null if the value
has been set to empty.
if (libraryDirectory != null) {
return (libraryDirectory.length() == 0) ? null : libraryDirectory;
} else {
return LIBRARY_DIRECTORY_DEFAULT_VALUE;
}
|
public java.lang.String | getLibraryDirectoryRawValue()
return libraryDirectory;
|
private static void | getListOfFiles(java.io.File directory, java.util.Vector files, java.io.FilenameFilter filter)
File[] list = directory.listFiles(filter);
for (int i=0;i<list.length;i++) {
if (!list[i].isDirectory()) {
files.add(list[i]);
} else {
getListOfFiles(list[i], files, filter);
}
}
|
public Descriptor | getModuleByTypeAndUri(javax.enterprise.deploy.shared.ModuleType type, java.lang.String uri)
for (Iterator itr = getModules();itr.hasNext();) {
ModuleDescriptor aModule = (ModuleDescriptor) itr.next();
if (aModule.getModuleType().equals(type)) {
if (aModule.getArchiveUri().equals(uri)) {
return aModule.getDescriptor();
}
}
}
return null;
|
public Descriptor | getModuleByUri(java.lang.String uri)Lookup module by uri.
ModuleDescriptor md = getModuleDescriptorByUri(uri);
if (md!=null) {
return md.getDescriptor();
}
return null;
|
public com.sun.enterprise.deployment.util.ModuleDescriptor | getModuleDescriptorByUri(java.lang.String uri)Lookup module by uri.
for (Iterator itr = getModules();itr.hasNext();) {
ModuleDescriptor aModule = (ModuleDescriptor) itr.next();
if (aModule.getArchiveUri().equals(uri)) {
return aModule;
}
}
return null;
|
public java.lang.String | getModuleID()
return moduleID;
|
public javax.enterprise.deploy.shared.ModuleType | getModuleType()
return ModuleType.EAR;
|
public java.util.Iterator | getModules()Obtain a full set of module descriptors
return modules.iterator();
|
public java.util.Iterator | getModulesByType(javax.enterprise.deploy.shared.ModuleType type)Obtain a full set of module descriptors for a particular type
if (type==null) {
return null;
}
Set moduleSet = new HashSet();
for (Iterator bundles = getModules();bundles.hasNext();) {
ModuleDescriptor aModule = (ModuleDescriptor) bundles.next();
if (type.equals(aModule.getModuleType())) {
moduleSet.add(aModule);
}
}
return moduleSet.iterator();
|
public java.util.Collection | getNamedDescriptors()return the set of descriptors with jndi names.
Collection namedDescriptors = new Vector();
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) itr.next();
namedDescriptors.addAll(ejbBundleDescriptor.getNamedDescriptors());
}
for (Iterator itr = this.getWebBundleDescriptors().iterator(); itr.hasNext();) {
WebBundleDescriptor webBundleDescriptor = (WebBundleDescriptor) itr.next();
namedDescriptors.addAll(webBundleDescriptor.getNamedDescriptors());
}
for (Iterator itr = this.getApplicationClientDescriptors().iterator(); itr.hasNext();) {
ApplicationClientDescriptor applicationClientDescriptor = (ApplicationClientDescriptor) itr.next();
namedDescriptors.addAll(applicationClientDescriptor.getNamedDescriptors());
}
return namedDescriptors;
|
public java.util.Vector | getNamedReferencePairs()Return all the Named reference pairs I have. This is a Vector of NamedReferenceDescriptors - essentially a mapping of
components to the Named Objects they reference. E.g.:
ejb -> ejb
ejb - resource reference
ejb - ejb ref
ejb1 - ejb ref
Vector pairs = new Vector();
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) itr.next();
pairs.addAll(ejbBundleDescriptor.getNamedReferencePairs());
}
for (Iterator itr = this.getWebBundleDescriptors().iterator(); itr.hasNext();) {
WebBundleDescriptor webBundleDescriptor = (WebBundleDescriptor) itr.next();
pairs.addAll(webBundleDescriptor.getNamedReferencePairs());
}
for (Iterator itr = this.getApplicationClientDescriptors().iterator(); itr.hasNext();) {
ApplicationClientDescriptor applicationClientDescriptor = (ApplicationClientDescriptor) itr.next();
pairs.addAll(applicationClientDescriptor.getNamedReferencePairs());
}
return pairs;
|
public boolean | getPassByReference()Gets the value of pass-by-reference property for this application
Checks to see if the pass-by-reference property is defined. If
this application's pass-by-reference property is defined, this method
returns the value of the application's pass-by-reference property.
Otherwise, if the application's pass-by-reference property is undefined,
this method returns a default value of false.
boolean passByReference = false;
if (this.isPassByReferenceDefined()) {
passByReference = this.passByReference.booleanValue();
}
return passByReference;
|
public int | getRarComponentCount()
return this.getRarDescriptors().size();
|
public ConnectorDescriptor | getRarDescriptorByUri(java.lang.String name)Obtain the RAR in this application of the given URI. If the RAR is not
present, throw an IllegalArgumentException.
Descriptor desc = getModuleByTypeAndUri(ModuleType.RAR, name);
if (desc!=null && desc instanceof ConnectorDescriptor) {
return (ConnectorDescriptor) desc;
}
throw new IllegalArgumentException(name);
|
public java.util.Set | getRarDescriptors()Obtain the full set of all the RARs in this application.
return getBundleDescriptors(ModuleType.RAR);
|
public java.lang.String | getRealm()
return realm;
|
public java.lang.String | getRegistrationName()Returns the registration name of this application.
if (registrationName!=null) {
return registrationName;
} else {
return getName();
}
|
public BundleDescriptor | getRelativeBundle(BundleDescriptor origin, java.lang.String relativeTargetUri)Get a target bundle descriptor based on an input bundle descriptor and
a relative uri from the perspective of the input bundle descriptor.
String targetBundleUri = getTargetUri(origin, relativeTargetUri);
BundleDescriptor targetBundle = null;
if( targetBundleUri != null ) {
Descriptor module = getModuleByUri(targetBundleUri);
targetBundle = (module instanceof BundleDescriptor) ?
(BundleDescriptor) module : null;
}
return targetBundle;
|
public java.lang.String | getRelativeUri(BundleDescriptor origin, BundleDescriptor target)Return the relative uri between two modules, from the perspective
of the first bundle.
String originUri = origin.getModuleDescriptor().getArchiveUri();
String targetUri = target.getModuleDescriptor().getArchiveUri();
StringTokenizer tokenizer = new StringTokenizer(originUri, "/");
int numTokens = tokenizer.countTokens();
int numSeparators = (numTokens > 0) ? (numTokens - 1) : 0;
StringBuffer relativeUri = new StringBuffer();
// The simplest way to compute a relative uri is to add one "../"
// for each sub-path in the origin URI, then add the target URI.
// It's possible for the result to not be normalized if the origin
// and target have at least one common root, but that shouldn't
// matter as long as when the relative URI is resolved against the
// origin it produces the target.
for(int i = 0; i < numSeparators; i++) {
relativeUri.append("../");
}
relativeUri.append(targetUri);
return relativeUri.toString();
|
public java.util.List | getResourceList()
return resourceList;
|
public java.util.Set | getResourceReferenceDescriptors()Return the Set of all reource references that my components have.
Set resourceReferences = new HashSet();
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbd = (EjbBundleDescriptor) itr.next();
resourceReferences.addAll(ejbd.getResourceReferenceDescriptors());
}
return resourceReferences;
|
public com.sun.enterprise.deployment.interfaces.SecurityRoleMapper | getRoleMapper()Return my mapping of rolename to users and groups on a particular
server.
if (this.roleMapper == null) {
SecurityRoleMapperFactory factory = SecurityRoleMapperFactoryMgr.getFactory();
if (factory==null) {
_logger.log(Level.FINE, "SecurityRoleMapperFactory NOT set.");
} else {
this.roleMapper = factory.getRoleMapper(this.getName());
}
}
return this.roleMapper;
|
public java.util.Set | getRoles()Return the set of roles used in this application. Currently, for release 1.0, it is an
aggregation of all the roles in the sub-modules of the application.
Set roles = new HashSet();
for (Iterator itr = this.getWebBundleDescriptors().iterator(); itr.hasNext();) {
WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next();
if (wbd!=null) {
roles.addAll(wbd.getRoles());
}
}
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbd = (EjbBundleDescriptor) itr.next();
if (ejbd != null) {
roles.addAll(ejbd.getRoles());
}
}
return roles;
|
public java.util.List | getSecurityRoleMappings()
return roleMaps;
|
public java.util.Set | getServiceReferenceDescriptors()Obtain the set of all service reference descriptors for
components in this application.
Set serviceRefs = new HashSet();
Set jndiNameEnvironments = this.getJndiNameEnvironments();
for(Iterator iter = jndiNameEnvironments.iterator(); iter.hasNext();) {
JndiNameEnvironment next = (JndiNameEnvironment) iter.next();
serviceRefs.addAll(next.getServiceReferenceDescriptors());
}
return serviceRefs;
|
public EjbDescriptor[] | getSortedEjbDescriptors()Returns all the ejb descriptor in this application in ordered form.
The comparison is done based on the descriptor's name.
Vector ejbDesc = getEjbDescriptors();
EjbDescriptor[] descs = (EjbDescriptor[])ejbDesc.toArray(
new EjbDescriptor[ejbDesc.size()]);
// The sorting algorithm used by this api is a modified mergesort.
// This algorithm offers guaranteed n*log(n) performance, and
// can approach linear performance on nearly sorted lists.
// since ejb name is only unique within a module, add the module uri
// as the additional piece of information for comparison
Arrays.sort(descs,
new Comparator() {
public int compare(Object o1, Object o2) {
EjbDescriptor desc1 = (EjbDescriptor)o1;
EjbDescriptor desc2 = (EjbDescriptor)o2;
String moduleUri1 = desc1.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri();
String moduleUri2 = desc2.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri();
return (moduleUri1 + desc1.getName()).compareTo(
moduleUri2 + desc2.getName());
}
}
);
return descs;
|
public BundleDescriptor | getStandaloneBundleDescriptor()if this application object is virtual, return the standalone
bundle descriptor it is wrapping otherwise return null
if (isVirtual()) {
Iterator modules = getModules();
if (modules.hasNext()) {
ModuleDescriptor module = (ModuleDescriptor) modules.next();
if (modules.hasNext()) {
// this is an error, the application is virtual,
// which mean a wrapper for a standalone module and
// it seems I have more than one module in my list...
throw new IllegalStateException("Virtual application contains more than one module");
}
return module.getDescriptor();
}
return null;
} else {
return null;
}
|
public java.lang.String | getTargetUri(BundleDescriptor origin, java.lang.String relativeTargetUri)Get the uri of a target based on a source module and a
a relative uri from the perspective of that source module.
String targetUri = null;
try {
String archiveUri = origin.getModuleDescriptor().getArchiveUri();
URI originUri = new URI(archiveUri);
URI resolvedUri = originUri.resolve(relativeTargetUri);
targetUri = resolvedUri.getPath();
} catch(URISyntaxException use) {
_logger.log(Level.FINE, "origin " + origin + " has invalid syntax",
use);
}
return targetUri;
|
public long | getUniqueId()Returns the unique id used for this application.
return this.uniqueId;
|
public WebBundleDescriptor | getWebBundleDescriptorByName(java.lang.String name)Obtain the WAR in this application of the given display name. If the WAR is not
present, throw an IllegalArgumentException.
for (Iterator itr = this.getWebBundleDescriptors().iterator(); itr.hasNext();) {
WebBundleDescriptor next = (WebBundleDescriptor) itr.next();
if (next.getDisplayName().equals(name)) {
return next;
}
}
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.exceptionapphasnowebappname",
"This application has no web app of name {0}", new Object []{name}));
|
public WebBundleDescriptor | getWebBundleDescriptorByUri(java.lang.String name)Get WAR of a given URI (filename within EAR)
Descriptor desc = getModuleByTypeAndUri(ModuleType.WAR, name);
if (desc!=null && desc instanceof WebBundleDescriptor) {
return (WebBundleDescriptor) desc;
}
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.exceptionapphasnowebappname",
"This application has no web app of name {0}", new Object []{name}));
|
public java.util.Set | getWebBundleDescriptors()Obtain the full set of all the WARs in this application.
return getBundleDescriptors(ModuleType.WAR);
|
public int | getWebComponentCount()The number of Web Components in this application.
Current implementation only return the number of servlets
inside the application, and not the JSPs since we cannot
get that information from deployment descriptors.
int count = 0;
for (Iterator itr = this.getWebBundleDescriptors().iterator(); itr.hasNext();) {
WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next();
count = count + wbd.getWebDescriptors().size();
}
return count;
|
public java.util.Set | getWebServiceDescriptors()Return a set of all com.sun.enterprise.deployment.WebService
descriptors in the application.
Set webServiceDescriptors = new HashSet();
Set bundles = new HashSet();
bundles.addAll(getEjbBundleDescriptors());
bundles.addAll(getWebBundleDescriptors());
for(Iterator iter = bundles.iterator(); iter.hasNext();) {
BundleDescriptor next = (BundleDescriptor) iter.next();
WebServicesDescriptor webServicesDesc =
next.getWebServices();
webServiceDescriptors.addAll(webServicesDesc.getWebServices());
}
return webServiceDescriptors;
|
public boolean | hasEjbByName(java.lang.String ejbName)Return whether the application contains the given ejb by name..
EjbDescriptor ejbDescriptor = null;
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();) {
EjbBundleDescriptor ejbBundleDescriptor = (EjbBundleDescriptor) itr.next();
if (ejbBundleDescriptor.hasEjbByName(ejbName)) {
return true;
}
}
return false;
|
public boolean | hasRuntimeInformation()Return true if I have information to do with deployment on a
particular operational environment.
return true;
|
public boolean | isApplication()
return true;
|
public boolean | isDirty()A flag to indicate that my data has changed since the last save.
return this.isDirty;
|
public boolean | isLoadedFromApplicationXml()
return loadedFromApplicationXml;
|
public boolean | isPassByReferenceDefined()
boolean passByReferenceDefined = false;
if (this.passByReference != null) {
passByReferenceDefined = true;
}
return passByReferenceDefined;
|
public boolean | isVirtual()Returns the virtual status of this application.
return this.virtual;
|
public void | notification(com.sun.enterprise.util.NotificationEvent ne)I listen to my subcomponents for state changes..
// so one of my descriptors is telling me it changed....
// I actually pretend that its me that changed...
this.changed(true);
|
public void | print(java.lang.StringBuffer toStringBuffer)A formatted String representing my state.
toStringBuffer.append("Application");
toStringBuffer.append("\n");
super.print(toStringBuffer);
toStringBuffer.append("\n smallIcon ").append(super.getSmallIconUri());
for (Iterator itr = getModules();itr.hasNext();) {
toStringBuffer.append("\n Module : ");
((Descriptor)itr.next()).print(toStringBuffer);
}
toStringBuffer.append("\n EjbBundles: \n");
if(this.getEjbBundleDescriptors() != null)
printDescriptorSet(this.getEjbBundleDescriptors(),toStringBuffer);
toStringBuffer.append("\n WebBundleDescriptors ");
if(this.getWebBundleDescriptors() != null)
printDescriptorSet(this.getWebBundleDescriptors(),toStringBuffer);
toStringBuffer.append("\n applicationClientDescriptors ");
if(this.getApplicationClientDescriptors() != null)
printDescriptorSet(this.getApplicationClientDescriptors(),toStringBuffer);
toStringBuffer.append("\n roles ").append(getRoles());
toStringBuffer.append("\n RoleMapper ").append(this.getRoleMapper());
toStringBuffer.append("\n Realm ").append(realm);
|
private void | printDescriptorSet(java.util.Set descSet, java.lang.StringBuffer sbuf)
for(Iterator itr = descSet.iterator(); itr.hasNext();){
Object obj = itr.next();
if(obj instanceof Descriptor)
((Descriptor)obj).print(sbuf);
else
sbuf.append(obj);
}
|
public void | removeApplicationClientDescriptor(ApplicationClientDescriptor applicationClientDescriptor)Remove deplyoment information about an application client.
this.getApplicationClientDescriptors().remove(applicationClientDescriptor);
applicationClientDescriptor.removeNotificationListener(this);
applicationClientDescriptor.setApplication(null);
this.changed(true);
|
public void | removeEjbBundleDescriptor(EjbBundleDescriptor ejbBundleDescriptor)Remove the deployment information about an Enterprise Bean.
this.getEjbBundleDescriptors().remove(ejbBundleDescriptor);
ejbBundleDescriptor.removeNotificationListener(this);
ejbBundleDescriptor.setApplication(null);
this.changed(true);
|
public void | removeModule(com.sun.enterprise.deployment.util.ModuleDescriptor descriptor)
if (modules.contains(descriptor)) {
if (descriptor.getDescriptor() != null) {
descriptor.getDescriptor().removeNotificationListener(this);
descriptor.getDescriptor().setApplication(null);
}
modules.remove(descriptor);
this.changed(true);
}
|
public void | removeRarDescriptor(ConnectorDescriptor rarDescriptor)Remove a rar descriptor from this application.
rarDescriptor.removeNotificationListener(this);
rarDescriptor.setApplication(null);
this.getRarDescriptors().remove(rarDescriptor);
this.changed(true);
|
public void | removeRole(com.sun.enterprise.deployment.Role role)Removes the given role.
getAppRoles().remove(role);
for (Iterator itr = this.getWebBundleDescriptors().iterator(); itr.hasNext();){
WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next();
wbd.removeRole(role);
}
for (Iterator itr = this.getEjbBundleDescriptors().iterator(); itr.hasNext();){
EjbBundleDescriptor ejbd = (EjbBundleDescriptor) itr.next();
ejbd.removeRole(role);
}
changed();
|
public void | removeWebBundleDescriptor(WebBundleDescriptor webBundleDescriptor)Remove a web bundle descriptor from this application.
webBundleDescriptor.removeNotificationListener(this);
webBundleDescriptor.setApplication(null);
this.getWebBundleDescriptors().remove(webBundleDescriptor);
this.changed(true);
|
public void | setDescription(java.lang.String description)
setDirty(true);
super.setDescription(description);
|
private void | setDirty(boolean dirty)
this.isDirty = dirty;
|
public void | setGeneratedXMLDirectory(java.lang.String xmlDir)
generatedXMLDir = xmlDir;
|
public void | setLargeIconUri(java.lang.String largeIconUri)
setDirty(true);
super.setLargeIconUri(largeIconUri);
|
public void | setLibraryDirectory(java.lang.String value)
libraryDirectory = value;
|
public void | setLoadedFromApplicationXml(boolean bool)This method records how this Application object is constructed. We
keep this information to avoid additional disk access in
DescriptorArchivist.write() when deciding if the application.xml
should be copied or written to the generated/xml directory.
loadedFromApplicationXml = bool;
|
public void | setName(java.lang.String name)Reset the display name of this application.
name = name.replace('/", '-");
name = name.replace('\\", '-"); // for deploying from NT to solaris & vice versa. This will
// need to be cleaned when we clean up the backend for registering apps
setDirty(true);
super.setName(name);
if (this.getRoleMapper() != null) {
this.getRoleMapper().setName(name);
}
|
public void | setPassByReference(boolean passByReference)Sets the pass-by-reference property for this application.
EJB spec requires pass-by-value (false) which is the default.
This can be set to true for non-compliant operation and possibly
higher performance. For a stand-alone server, this can be used.
By setting pass-by-reference in sun-application.xml, it can apply to
all the enclosed ejb modules.
this.passByReference = Boolean.valueOf(passByReference);
|
public void | setRealm(java.lang.String realm)Sets the realm for this application
this.realm=realm;
|
public void | setRegistrationName(java.lang.String appId)Sets the registration name for this application. This name is used
while deploying the application. The deployment process gurantees
that this name is unique.
// at his point we need to swap our RoleMapper, if we have one...
SecurityRoleMapper roleMapper=null;
try {
roleMapper = getRoleMapper();
} catch(IllegalArgumentException ignore) {};
if (roleMapper!=null) {
SecurityRoleMapperFactory factory = SecurityRoleMapperFactoryMgr.getFactory();
if (factory==null) {
throw new IllegalArgumentException(localStrings.getLocalString(
"enterprise.deployment.norolemapperfactorydefine",
"This application has no role mapper factory defined"));
}
factory.removeRoleMapper(getName());
roleMapper.setName(appId);
factory.setRoleMapper(appId, roleMapper);
}
this.registrationName = appId;
|
public void | setResourceList(java.util.List rList)
resourceList = rList;
|
public void | setRoleMapper(com.sun.enterprise.deployment.interfaces.SecurityRoleMapper roleMapper)Sets the mapping of rolename to users and groups on a particular server.
// should verify against the roles
this.roleMapper = roleMapper;
this.changed(true);
|
public void | setSmallIconUri(java.lang.String smallIconUri)
setDirty(true);
super.setSmallIconUri(smallIconUri);
|
public void | setUniqueId(long id)Sets the unique id for this application. It traverses through all
the ejbs in the application and sets the unique id for each of them.
The traversal is done in ascending element order.
_logger.log(Level.FINE,"[Application]uid: " + id);
this.uniqueId = id;
EjbDescriptor[] descs = getSortedEjbDescriptors();
for (int i=0; i<descs.length; i++)
{
// 2^16 beans max per stand alone module
descs[i].setUniqueId( (id | i) );
if(_logger.isLoggable(Level.FINE)){
_logger.log(Level.FINE,"[Application]desc name: " + descs[i].getName());
_logger.log(Level.FINE,"[Application]desc id: "+descs[i].getUniqueId());
}
}
|
public void | setVirtual(boolean virtual)Sets the virtual status of this application.
If this application object represents a stand alone module,
virtaul status should be true; else false.
this.virtual = virtual;
|
public void | visit(com.sun.enterprise.deployment.util.DescriptorVisitor aVisitor)visit the descriptor and all sub descriptors with a DOL visitor implementation
if (aVisitor instanceof ApplicationVisitor) {
visit((ApplicationVisitor) aVisitor);
} else {
super.visit(aVisitor);
}
|
public void | visit(com.sun.enterprise.deployment.util.ApplicationVisitor aVisitor)visit the descriptor and all sub descriptors with a DOL visitor implementation
aVisitor.accept(this);
EjbBundleVisitor ejbBundleVisitor = aVisitor.getEjbBundleVisitor();
if (ejbBundleVisitor != null) {
for (Iterator ejbBundles = getEjbBundleDescriptors().iterator();ejbBundles.hasNext();) {
EjbBundleDescriptor anEjbBundle = (EjbBundleDescriptor) ejbBundles.next();
anEjbBundle.visit(ejbBundleVisitor);
}
}
WebBundleVisitor webVisitor = aVisitor.getWebBundleVisitor();
if (webVisitor != null) {
for (Iterator webBundles = getWebBundleDescriptors().iterator();webBundles.hasNext();) {
WebBundleDescriptor aWebBundle = (WebBundleDescriptor) webBundles.next();
// This might be null in the case of an appclient
// processing a client stubs .jar whose original .ear contained
// a .war. This will be fixed correctly in the deployment
// stage but until then adding a non-null check will prevent
// the validation step from bombing.
if( aWebBundle != null ) {
aWebBundle.visit(webVisitor);
}
}
}
ConnectorVisitor connectorVisitor = aVisitor.getConnectorVisitor();
if (connectorVisitor != null) {
for (Iterator connectors = getRarDescriptors().iterator();connectors.hasNext();) {
ConnectorDescriptor aConnector = (ConnectorDescriptor) connectors.next();
aConnector.visit(connectorVisitor);
}
}
AppClientVisitor appclientVisitor = aVisitor.getAppClientVisitor();
if (appclientVisitor != null) {
for (Iterator appclients = getApplicationClientDescriptors().iterator();appclients.hasNext();) {
ApplicationClientDescriptor appclient = (ApplicationClientDescriptor) appclients.next();
appclient.visit(appclientVisitor);
}
}
|