/** * The number of EJB JARs in this application. * * @return the number of EJB JARS */ public int getEjbComponentCount() { int count = 0; for (EjbBundleDescriptor ejbd : this.getEjbBundleDescriptors()) { count = count + ejbd.getEjbs().size(); } return count; }
/** * Set the DOL descriptor for this Archivist, used by super classes */ public void setDescriptor(Application descriptor) { // this is acceptable if the application actually represents // a standalone module Set ejbBundles = ((Application) descriptor).getEjbBundleDescriptors(); if (ejbBundles.size()>0) { this.descriptor = (EjbBundleDescriptor) ejbBundles.iterator().next(); if (this.descriptor.getModuleDescriptor().isStandalone()) return; else this.descriptor=null; } }
/** * Obtain the EJB-JAR in this application of the given name. * If the JAR is not * present, throw an IllegalArgumentException. * * @return the EjbBundleDescriptor object with the given name */ public EjbBundleDescriptor getEjbBundleByName(String name) { for (EjbBundleDescriptor ejbd : getEjbBundleDescriptors()) { if (ejbd.getDisplayName().equals(name)) return ejbd; } throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionapphasnoejbjarnamed", "This application has no ejb jars of name {0}", name)); }
/** * Return a set of all com.sun.enterprise.deployment.WebService * descriptors in the application. */ public Set<WebService> getWebServiceDescriptors() { Set<WebService> webServiceDescriptors = new HashSet<WebService>(); Set<BundleDescriptor> bundles = new HashSet<BundleDescriptor>(); bundles.addAll(getEjbBundleDescriptors()); bundles.addAll(getWebBundleDescriptors()); for (BundleDescriptor next : bundles) { WebServicesDescriptor webServicesDesc = next.getWebServices(); webServiceDescriptors.addAll(webServicesDesc.getWebServices()); } return webServiceDescriptors; }
/** * 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. * * @return the Set of roles in the application. */ public Set<Role> getRoles() { Set<Role> roles = new HashSet<Role>(); for (WebBundleDescriptor wbd : getWebBundleDescriptors()) { if (wbd != null) { roles.addAll(wbd.getRoles()); } } for (EjbBundleDescriptor ejbd : getEjbBundleDescriptors()) { if (ejbd != null) { roles.addAll(ejbd.getRoles()); } } return roles; }
/** * Adds a new abstract role */ public void addRole(Role role) { for (WebBundleDescriptor wbd : getWebBundleDescriptors()) { wbd.addRole(role); } for (EjbBundleDescriptor ejbd : getEjbBundleDescriptors()) { ejbd.addRole(role); } }
/** * Obtain the EJB in this application of the given display name. If the EJB is not * present, throw an IllegalArgumentException. * * @param ejbName the name of the bean * @return the EjbDescriptor object with the given display name */ public EjbDescriptor getEjbByName(String ejbName) { for (EjbBundleDescriptor ejbd : getEjbBundleDescriptors()) { if (ejbd.hasEjbByName(ejbName)) { return ejbd.getEjbByName(ejbName); } } throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptionapphasnobeannamed", "This application has no beans of name {0}", ejbName)); }
/** * Removes the given role. */ public void removeRole(Role role) { getAppRoles().remove(role); for (WebBundleDescriptor wbd : getWebBundleDescriptors()) { wbd.removeRole(role); } for (EjbBundleDescriptor ejbd : getEjbBundleDescriptors()) { ejbd.removeRole(role); } }
/** * A formatted String representing my state. */ public void print(StringBuffer toStringBuffer) { toStringBuffer.append("Application"); toStringBuffer.append("\n"); super.print(toStringBuffer); toStringBuffer.append("\n smallIcon ").append(super.getSmallIconUri()); for (ModuleDescriptor<BundleDescriptor> aModule : getModules()) { toStringBuffer.append("\n Module : "); aModule.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); }
Set ejbDescriptorSet = app.getEjbBundleDescriptors() ;
Collection<EjbBundleDescriptor> ejbModules = app.getEjbBundleDescriptors();
/** * Links the policy contexts of the application * * @param app * @param webs */ private void linkPolicies(Application app, Collection<WebBundleDescriptor> webs) throws DeploymentException { try { String linkName = null; boolean lastInService = false; for (WebBundleDescriptor wbd : webs) { String name = SecurityUtil.getContextID(wbd); lastInService = SecurityUtil.linkPolicyFile(name, linkName, lastInService); linkName = name; } Set<EjbBundleDescriptor> ejbs = app.getEjbBundleDescriptors(); for (EjbBundleDescriptor ejbd : ejbs) { String name = SecurityUtil.getContextID(ejbd); lastInService = SecurityUtil.linkPolicyFile(name, linkName, lastInService); linkName = name; } // extra commit (see above) } catch (IASSecurityException se) { String msg = "Error in linking security policy for " + app.getRegistrationName(); throw new DeploymentException(msg, se); } }
for (EjbBundleDescriptor ejbBundle : app.getEjbBundleDescriptors()) { if (checkEjbBundleForTimers(ejbBundle, createTimers, target)) { isTimedApp = true;
/** * commits ejb policy contexts. * This should occur in EjbApplication, being done here until * issue with ejb-ejb31-singleton-multimoduleApp.ear is resolved * @param ejbs */ private void commitEjbs(Application app) throws DeploymentException { Set<EjbBundleDescriptor> ejbDescriptors = app.getEjbBundleDescriptors(); try { for (EjbBundleDescriptor ejbBD : ejbDescriptors) { String pcid = SecurityUtil.getContextID(ejbBD); ejbProbeProvider.policyCreationStartedEvent(pcid); SecurityUtil.generatePolicyFile(pcid); ejbProbeProvider.policyCreationEndedEvent(pcid); ejbProbeProvider.policyCreationEvent(pcid); } } catch (Exception se) { String msg = "Error in committing security policy for ejbs of " + app.getRegistrationName(); throw new DeploymentException(msg, se); } }