/** * Gets the application to which this ejb descriptor belongs. */ public Application getApplication() { if (getEjbBundleDescriptor() != null) { return getEjbBundleDescriptor().getApplication(); } return null; }
/** * Return the fully-qualified portable JNDI name for a given * client view (Remote, Local, or no-interface). */ public String getPortableJndiName(String clientViewType) { String appName = null; Application app = getEjbBundleDescriptor().getApplication(); if ( ! app.isVirtual() ) { appName = app.getAppName(); } String modName = getEjbBundleDescriptor().getModuleDescriptor().getModuleName(); StringBuffer javaGlobalPrefix = new StringBuffer("java:global/"); if (appName != null) { javaGlobalPrefix.append(appName); javaGlobalPrefix.append("/"); } javaGlobalPrefix.append(modName); javaGlobalPrefix.append("/"); javaGlobalPrefix.append(getName()); javaGlobalPrefix.append("!"); javaGlobalPrefix.append(clientViewType); return javaGlobalPrefix.toString(); }
/** Calculate module name from a bundle. * @return module name. */ public static String getModuleName(EjbBundleDescriptor bundle) { String moduleName = null; Application application = bundle.getApplication(); if (application.isVirtual()) { // Stand-alone module is deployed. moduleName = application.getRegistrationName(); } else { // Module is deployed as a part of an Application. String jarName = bundle.getModuleDescriptor().getArchiveUri(); int l = jarName.length(); // Remove ".jar" from the bundle's jar name. moduleName = jarName.substring(0, l - 4); } return moduleName; }
/** * Create GeneratorException for this message key. * @param key the message key in the bundle. * @param bundle the ejb bundle. * @param e the Exception to use for the message. * @return GeneratorException. */ public static GeneratorException createGeneratorException( String key, EjbBundleDescriptor bundle, Exception e) { return new GeneratorException(I18NHelper.getMessage( messages, key, bundle.getApplication().getRegistrationName(), getModuleName(bundle), e.getMessage())); }
/** * Create GeneratorException for this message key. * @param key the message key in the bundle. * @param bundle the ejb bundle. * @return GeneratorException. */ public static GeneratorException createGeneratorException( String key, EjbBundleDescriptor bundle) { return new GeneratorException(I18NHelper.getMessage( messages, key, bundle.getApplication().getRegistrationName(), getModuleName(bundle))); }
/** * Create GeneratorException for this message key and bean name. * @param key the message key in the bundle. * @param bundle the ejb bundle. * @return GeneratorException. */ public static GeneratorException createGeneratorException( String key, String beanName, EjbBundleDescriptor bundle) { return new GeneratorException(I18NHelper.getMessage( messages, key, beanName, bundle.getApplication().getRegistrationName(), getModuleName(bundle))); }
private String normalizeSingletonName(String origName, EjbSessionDescriptor sessionDesc) { String normalizedName = origName; boolean fullyQualified = origName.contains("#"); Application app = sessionDesc.getEjbBundleDescriptor().getApplication(); if (fullyQualified) { int indexOfHash = origName.indexOf("#"); String ejbName = origName.substring(indexOfHash + 1); String relativeJarPath = origName.substring(0, indexOfHash); BundleDescriptor bundle = app.getRelativeBundle(sessionDesc.getEjbBundleDescriptor(), relativeJarPath); if (bundle == null) { throw new IllegalStateException("Invalid @DependOn value = " + origName + " for Singleton " + sessionDesc.getName()); } normalizedName = bundle.getModuleDescriptor().getArchiveUri() + "#" + ejbName; } else { normalizedName = sessionDesc.getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri() + "#" + origName; } return normalizedName; }
public EjbApplication( EjbBundleDescriptor bundle, DeploymentContext dc, ClassLoader cl, Habitat habitat, EJBSecurityManagerFactory ejbSecMgrFactory) { this.ejbBundle = bundle; this.ejbs = bundle.getEjbs(); this.ejbAppClassLoader = cl; this.dc = dc; this.habitat = habitat; this.ejbContainerFactory = habitat.getByContract(ContainerFactory.class); this.ejbSMF = ejbSecMgrFactory; this.policyLoader = habitat.getComponent(PolicyLoader.class); Application app = ejbBundle.getApplication(); initializeInOrder = (app != null) && (app.isInitializeInOrder()); }
/** * Create GeneratorException for this message key and bean name. * @param key the message key in the bundle. * @param beanName the CMP bean name that caused the exception. * @param bundle the ejb bundle. * @param msg the message text to append. * @return GeneratorException. */ public static GeneratorException createGeneratorException( String key, String beanName, EjbBundleDescriptor bundle, String msg) { return new GeneratorException(I18NHelper.getMessage( messages, key, new Object[] { beanName, bundle.getApplication().getRegistrationName(), getModuleName(bundle), msg} )); } }
EjbInvocation(String compEnvId, Container container) { super.componentId = compEnvId; super.container = container; super.setComponentInvocationType(ComponentInvocation.ComponentInvocationType.EJB_INVOCATION); EjbBundleDescriptor ejbBundleDesc = container.getEjbDescriptor().getEjbBundleDescriptor(); moduleName = ejbBundleDesc.getModuleName(); appName = ejbBundleDesc.getApplication().getAppName(); //By default we enable TransactionOperationsManager checks. But EjbInvocation.clone() // clears transactionOperationsManager so that, be default, cloned invocations // doesn't enforce Transaction Operations checks. transactionOperationsManager = this; }
Application app = bundleDesc.getApplication(); keepState = app.getKeepState();
public static Application getApplicationFromEnv(JndiNameEnvironment env) { Application app = null; if (env instanceof EjbDescriptor) { // EJB component EjbDescriptor ejbEnv = (EjbDescriptor) env; app = ejbEnv.getApplication(); } else if (env instanceof EjbBundleDescriptor) { EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env; app = ejbBundle.getApplication(); } else if (env instanceof WebBundleDescriptor) { WebBundleDescriptor webEnv = (WebBundleDescriptor) env; app = webEnv.getApplication(); } else if (env instanceof ApplicationClientDescriptor) { ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env; app = appEnv.getApplication(); } else if (env instanceof ManagedBeanDescriptor) { ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env; app = mb.getBundle().getApplication(); } else if (env instanceof Application) { app = ((Application) env); } else { throw new IllegalArgumentException("IllegalJndiNameEnvironment : env"); } return app; }
private Application getApplicationFromEnv(JndiNameEnvironment env) { Application app = null; if (env instanceof EjbDescriptor) { // EJB component EjbDescriptor ejbEnv = (EjbDescriptor) env; app = ejbEnv.getApplication(); } else if ( env instanceof EjbBundleDescriptor ) { EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor) env; app = ejbBundle.getApplication(); } else if (env instanceof WebBundleDescriptor) { WebBundleDescriptor webEnv = (WebBundleDescriptor) env; app = webEnv.getApplication(); } else if (env instanceof ApplicationClientDescriptor) { ApplicationClientDescriptor appEnv = (ApplicationClientDescriptor) env; app= appEnv.getApplication(); } else if ( env instanceof ManagedBeanDescriptor ) { ManagedBeanDescriptor mb = (ManagedBeanDescriptor) env; app = mb.getBundle().getApplication(); } else if ( env instanceof Application ) { app = ((Application)env); } else { throw new IllegalArgumentException("IllegalJndiNameEnvironment : env"); } return app; }
@Override public void accept(com.sun.enterprise.deployment.EjbBundleDescriptor bundleDesc) { this.application = bundleDesc.getApplication(); EjbBundleDescriptorImpl bundleDescriptor = (EjbBundleDescriptorImpl) bundleDesc; if (bundleDescriptor.getEjbs().size() == 0) {
private ComponentInvocation createComponentInvocation() { EjbBundleDescriptor ejbBundleDesc = getEjbDescriptor().getEjbBundleDescriptor(); ComponentInvocation newInv = new ComponentInvocation( getComponentId(), ComponentInvocation.ComponentInvocationType.SERVLET_INVOCATION, this, ejbBundleDesc.getApplication().getAppName(), ejbBundleDesc.getModuleName() ); //newInv.setJNDIEnvironment(getJNDIEnvironment()); ??? return newInv; }
/** * Adds a new DOL descriptor instance to the descriptor instance associated with * this XMLNode * * @param descriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { if (newDescriptor instanceof SecurityRoleMapping) { SecurityRoleMapping roleMap = (SecurityRoleMapping)newDescriptor; descriptor.addSecurityRoleMapping(roleMap); Application app = descriptor.getApplication(); if (app!=null) { Role role = new Role(roleMap.getRoleName()); SecurityRoleMapper rm = app.getRoleMapper(); if (rm != null) { List<PrincipalNameDescriptor> principals = roleMap.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { rm.assignRole(principals.get(i).getPrincipal(), role, descriptor); } List<String> groups = roleMap.getGroupNames(); for (int i = 0; i < groups.size(); i++) { rm.assignRole(new Group(groups.get(i)), role, descriptor); } } } } }
Application app = ejbDesc.getApplication(); Collection<WebBundleDescriptor> webModules = app.getBundleDescriptors(WebBundleDescriptor.class); Collection<EjbBundleDescriptor> ejbModules = app.getBundleDescriptors(EjbBundleDescriptor.class);
public void accept(EjbBundleDescriptor bundleDescriptor) { this.bundleDescriptor = bundleDescriptor; application = bundleDescriptor.getApplication(); super.accept(bundleDescriptor); /** set the realm name on each ejb to match the ones on this application * this is required right now to pass the stringent CSIv2 criteria * whereby the realm-name for the ejb being authenticated on * has to match the one on the application. We look at the IORConfigurator * descriptor * @todo: change the csiv2 layer so that it does not look at * IORConfiguratorDescriptor. * @see iiop/security/SecurityMechanismSelector.evaluateClientConformance. */ String rlm = application.getRealm(); if (rlm != null) { for(EjbDescriptor ejb : bundleDescriptor.getEjbs()) { for (EjbIORConfigurationDescriptor desc : ejb.getIORConfigurationDescriptors()) { desc.setRealmName(rlm); } } } }
public static String getContextID(EjbBundleDescriptor ejbBundleDesc) { String cid = null; if (ejbBundleDesc != null) { /* detect special case of EJBs embedded in a war, * and make sure psuedo policy context id is unique within app */ Object root = ejbBundleDesc.getModuleDescriptor().getDescriptor(); if( (root != ejbBundleDesc) && (root instanceof WebBundleDescriptor ) ) { cid = createUniquePseudoModuleID(ejbBundleDesc); } else { cid = VersioningUtils.getRepositoryName(ejbBundleDesc.getApplication().getRegistrationName()) + '/' + ejbBundleDesc.getUniqueFriendlyId(); } } return cid; } public static String getContextID(WebBundleDescriptor wbd) {
public static String getContextID(EjbBundleDescriptor ejbBundleDesc) { String cid = null; if (ejbBundleDesc != null) { /* detect special case of EJBs embedded in a war, * and make sure psuedo policy context id is unique within app */ Object root = ejbBundleDesc.getModuleDescriptor().getDescriptor(); if( (root != ejbBundleDesc) && (root instanceof WebBundleDescriptor ) ) { cid = createUniquePseudoModuleID(ejbBundleDesc); } else { cid = VersioningUtils.getRepositoryName(ejbBundleDesc.getApplication().getRegistrationName()) + '/' + ejbBundleDesc.getUniqueFriendlyId(); } } return cid; } public static String getContextID(WebBundleDescriptor wbd) {