private void convertStyleCheckpointedMethods() { Set allMethods = ejbDescriptor.getMethodDescriptors(); for (Iterator mdItr = methodDescs.iterator(); mdItr.hasNext();) { MethodDescriptor methodDesc = (MethodDescriptor) mdItr.next(); // the ejb-name element defined in the method element will // be always ignored and overriden by the one defined in // ejb element methodDesc.setEjbName(ejbDescriptor.getName()); // Convert to style 3 method descriptors Vector mds = methodDesc.doStyleConversion(ejbDescriptor, allMethods); convertedMethodDescs.addAll(mds); } }
@SuppressWarnings("unchecked") public Class<T> getBeanClass() { @SuppressWarnings("rawtypes") Class beanClassType = null; try { beanClassType = ejbDesc.getEjbBundleDescriptor().getClassLoader().loadClass(ejbDesc.getEjbClassName()); } catch(ClassNotFoundException e) { throw new IllegalStateException(e); } return beanClassType; }
/** * Set runtime default value for EjbDescriptor. */ private void computeRuntimeDefault(EjbDescriptor ejb) { String intfName = null; if ((ejb.getJndiName() == null) || (ejb.getJndiName().length() == 0)) { if (ejb.isRemoteInterfacesSupported() && ejb.isRemoteBusinessInterfacesSupported()) { // can't use a default. } else if (ejb.isRemoteInterfacesSupported()) { // For 2.x view, use the Home as the basis for the default intfName = ejb.getHomeClassName(); } else if (ejb.isRemoteBusinessInterfacesSupported()) { Set<String> classNames = ejb.getRemoteBusinessClassNames(); if (classNames.size() == 1) { intfName = (String)classNames.iterator().next(); } } } if( intfName != null ) { String jndiName = getDefaultEjbJndiName(intfName); ejb.setJndiName(jndiName); } if (!ejb.getUsesCallerIdentity()) { computeRunAsPrincipalDefault( ejb.getRunAsIdentity(), ejb.getApplication()); } }
/** * Return the set of method objects on my home and remote interfaces. */ public Vector getMethods() { return getMethods(getEjbBundleDescriptor().getClassLoader()); }
/** * @return the collection of MethodDescriptors to which ContainerTransactions * may be assigned. */ public Collection getTransactionMethodDescriptors() { return getTransactionMethods(getEjbBundleDescriptor().getClassLoader()); }
public EjbDescriptorImpl(EjbDescriptor ejbDescriptor) { ejbDesc = ejbDescriptor; if ( ejbDesc.getType().equals(EjbSessionDescriptor.TYPE) || ejbDesc.getType().equals(EjbMessageBeanDescriptor.TYPE ) ) { // Before handling application-level interceptors that are defined using 299 metadata, // add the CDI impl-specific system-level interceptor that needs to be registered for ALL // EJB components. At runtime, this sets up the appropriate request context for invocations that // do not originate via the web tier. This interceptor must be registered *before* // any application-level interceptors in the chain, so add it in the framework interceptor // category within the ejb descriptor. EjbInterceptor systemLevelCDIInterceptor = createSystemLevelCDIInterceptor(); ejbDesc.addFrameworkInterceptor(systemLevelCDIInterceptor); } }
/** * visits an ejb descriptor * @param ejb descriptor */ public void accept(EjbDescriptor ejb) { DOLUtils.getDefaultLogger().info("=================="); DOLUtils.getDefaultLogger().info(ejb.getType() + " Bean " + ejb.getName()); DOLUtils.getDefaultLogger().info("\thomeClassName " + ejb.getHomeClassName()); DOLUtils.getDefaultLogger().info("\tremoteClassName " + ejb.getRemoteClassName()); DOLUtils.getDefaultLogger().info("\tlocalhomeClassName " +ejb.getLocalHomeClassName()); DOLUtils.getDefaultLogger().info("\tlocalClassName " + ejb.getLocalClassName()); DOLUtils.getDefaultLogger().info("\tremoteBusinessIntfs " + ejb.getRemoteBusinessClassNames()); DOLUtils.getDefaultLogger().info("\tlocalBusinessIntfs " + ejb.getLocalBusinessClassNames()); DOLUtils.getDefaultLogger().info("\tjndiName " + ejb.getJndiName()); DOLUtils.getDefaultLogger().info("\tejbClassName " + ejb.getEjbClassName()); DOLUtils.getDefaultLogger().info("\ttransactionType " + ejb.getTransactionType()); if (ejb.getUsesCallerIdentity() == false) { DOLUtils.getDefaultLogger().info("\trun-as role " + ejb.getRunAsIdentity()); } else { DOLUtils.getDefaultLogger().info("\tuse-caller-identity " + ejb.getUsesCallerIdentity()); } }
Boolean disableInDD = ejb.getEjbBundleDescriptor().getDisableNonportableJndiNames(); if(disableInDD != null) { // explicitly set in glassfish-ejb-jar.xml disableNonPortableJndiName = disableInDD; glassfishSpecificJndiName = ejb.getJndiName(); if (ejb.isRemoteInterfacesSupported()) { String intf = ejb.getHomeClassName(); String fullyQualifiedJavaGlobalName = javaGlobalName + "!" + intf; appResources.storeInNamespace(fullyQualifiedJavaGlobalName, ejb); if (ejb.isRemoteBusinessInterfacesSupported()) { int count = 0; for (String intf : ejb.getRemoteBusinessClassNames()) { count++; String fullyQualifiedJavaGlobalName = javaGlobalName + "!" + intf; if(glassfishSpecificJndiName != null && !ejb.isRemoteInterfacesSupported() && count == 1) { appResources.storeInNamespace(glassfishSpecificJndiName, ejb); if (ejb.isLocalInterfacesSupported()) { String intf = ejb.getLocalHomeClassName(); String fullyQualifiedJavaGlobalName = javaGlobalName + "!" + intf; appResources.storeInNamespace(fullyQualifiedJavaGlobalName, ejb); if (ejb.isLocalBusinessInterfacesSupported()) { for (String intf : ejb.getLocalBusinessClassNames()) { String fullyQualifiedJavaGlobalName = javaGlobalName + "!" + intf; appResources.storeInNamespace(fullyQualifiedJavaGlobalName, ejb);
if (ejbRef.getJndiName().equals(ejb.getJndiName())) { ejbRef.setEjbDescriptor(ejb); return; target.getEjbBundleDescriptor(); BundleDescriptor sourceModule = ejbRef.getReferringBundleDescriptor(); String ejbLinkName = target.getName(); if (!sourceModule.isPackagedAsSingleModule(targetModule)) { String relativeUri = null; ejbReferee = ejb.getEjbBundleDescriptor().getEjbByName(ejbRef.getLinkName()); } catch (IllegalArgumentException e) { if( !ejbReferee.getRemoteBusinessClassNames().contains (intfClassName) ) { String msg = "Target ejb " + ejbReferee.getName() + " for " + " remote ejb 3.0 reference " + ejbRef.getName() + " does not expose a remote business interface of type " + } else if(ejbReferee.getLocalBusinessClassNames(). contains(intfClassName)) { } else if(ejbReferee.getRemoteBusinessClassNames(). contains(intfClassName)) { if (ejbReferee.isLocalBean()) { ejbRef.setLocal(true);
String flattedJndiName = ejbEnv.getJndiName().replace('/', '.'); EjbBundleDescriptor ejbBundle = ejbEnv.getEjbBundleDescriptor(); Descriptor d = ejbBundle.getModuleDescriptor().getDescriptor(); id = ejbEnv.getApplication().getName() + ID_SEPARATOR + ejbBundle.getModuleDescriptor().getArchiveUri() + ID_SEPARATOR + ejbEnv.getName() + ID_SEPARATOR + flattedJndiName + ejbEnv.getUniqueId();
logger.finest("EJB: "+ejb.getEjbClassName()); if (!ejb.getUsesCallerIdentity()) { RunAsIdentityDescriptor runas = ejb.getRunAsIdentity(); if (runas == null) { logger.finest(" (ejb does not use caller "+ Set methods = ejb.getMethodDescriptors(); Iterator si = methods.iterator(); logger.finest(" "+md.getFormattedString()); Set perms = ejb.getMethodPermissionsFor(md); StringBuffer rbuf = new StringBuffer(); rbuf.append(" can only be invoked by: "); ejb.getEjbClassName() + "." + md.getFormattedString()); HashSet ram = (HashSet)allRoleMap.get(rksi.next()); ram.add(bundle.getName() + ":" + ejb.getEjbClassName() + "." + md.getFormattedString()); Set iors = ejb.getIORConfigurationDescriptors(); if (iors != null) { Iterator iorsi = iors.iterator();
public void addEjbDescriptor(EjbDescriptor other) { setEjbBundleDescriptor(other.bundleDescriptor); this.transactionType = other.transactionType; this.methodContainerTransactions = new Hashtable(other.getMethodContainerTransactions()); this.permissionedMethodsByPermission = new Hashtable(other.getPermissionedMethodsByPermission()); if (other.env == null) { this.getEnvironmentProperties().addAll(other.getEnvironmentProperties()); this.getEjbReferenceDescriptors().addAll(other.getEjbReferenceDescriptors()); this.getJmsDestinationReferenceDescriptors().addAll(other.getJmsDestinationReferenceDescriptors()); this.getMessageDestinationReferenceDescriptors().addAll(other.getMessageDestinationReferenceDescriptors()); this.getResourceReferenceDescriptors().addAll(other.getResourceReferenceDescriptors()); this.getServiceReferenceDescriptors().addAll(other.getServiceReferenceDescriptors()); Set<DataSourceDefinitionDescriptor> dataSourceDescriptors = other.getDataSourceDefinitionDescriptors(); if(dataSourceDescriptors.size() > 0){ for(DataSourceDefinitionDescriptor desc : dataSourceDescriptors){ this.addDataSourceDefinitionDescriptor(desc); this.getEntityManagerFactoryReferenceDescriptors().addAll(other.getEntityManagerFactoryReferenceDescriptors()); this.getEntityManagerReferenceDescriptors().addAll(other.getEntityManagerReferenceDescriptors()); this.getRoleReferences().addAll(other.getRoleReferences()); this.getIORConfigurationDescriptors().addAll(other.getIORConfigurationDescriptors()); this.transactionType = other.transactionType; this.ejbClassName = other.ejbClassName;
appendTextChild(ejbNode, RuntimeTagNames.EJB_NAME, ejbDescriptor.getName()); appendTextChild(ejbNode, RuntimeTagNames.JNDI_NAME, ejbDescriptor.getJndiName()); String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getPassByReference())); if ( Boolean.FALSE.equals(ejbDescriptor.getUsesCallerIdentity()) ) { RunAsIdentityDescriptor raid = ejbDescriptor.getRunAsIdentity(); if ( raid != null && raid.getPrincipal() != null ) { Node principalNode = appendChild(ejbNode, RuntimeTagNames.PRINCIPAL); if (ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory()!=null) { MDBConnectionFactoryNode mcfNode = new MDBConnectionFactoryNode(); mcfNode.writeDescriptor(ejbNode, RuntimeTagNames.MDB_CONNECTION_FACTORY, ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory()); String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getJmsMaxMessagesLoad())); for (Iterator iorIterator = ejbDescriptor.getIORConfigurationDescriptors().iterator(); iorIterator.hasNext();) { iorNode.writeDescriptor(ejbNode,RuntimeTagNames.IOR_CONFIG, (EjbIORConfigurationDescriptor) iorIterator.next()); String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().isIsReadOnlyBean())); appendTextChild(ejbNode, RuntimeTagNames.REFRESH_PERIOD_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getRefreshPeriodInSeconds())); appendTextChild(ejbNode, RuntimeTagNames.COMMIT_OPTION, ejbDescriptor.getIASEjbExtraDescriptors().getCommitOption()); appendTextChild(ejbNode, RuntimeTagNames.CMT_TIMEOUT_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getCmtTimeoutInSeconds())); appendTextChild(ejbNode, RuntimeTagNames.USE_THREAD_POOL_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. * * NOTE : assumption is that the id has already been left shifted 16 * bits to allow space for the component ids. * * @param id unique id for this application */ public void setUniqueId(long id) { _logger.log(Level.FINE, "[Application] " + getName() + " , uid: " + id); this.uniqueId = id; EjbDescriptor[] descs = getSortedEjbDescriptors(); for (int i = 0; i < descs.length; i++) { // Maximum of 2^16 beans max per application descs[i].setUniqueId((id | i)); if (_logger.isLoggable(Level.FINE)) { String module = descs[i].getEjbBundleDescriptor().getModuleDescriptor().getArchiveUri(); _logger.log(Level.FINE, "Ejb " + module + ":" + descs[i].getName() + " id = " + descs[i].getUniqueId()); } } uniqueIdSet = true; }
CallFlowInfoImpl(BaseContainer container, EjbDescriptor descriptor, ComponentType compType) { this.container = container; this.ejbDescriptor = descriptor; this.appName = (ejbDescriptor.getApplication().isVirtual()) ? null : ejbDescriptor.getApplication().getRegistrationName(); String archiveuri = ejbDescriptor.getEjbBundleDescriptor() .getModuleDescriptor().getArchiveUri(); this.modName = com.sun.enterprise.util.io.FileUtils .makeFriendlyFilename(archiveuri); this.ejbName = ejbDescriptor.getName(); this.componentType = compType; }
ejbDescriptor.getEjbBundleDescriptor(); WebServicesDescriptor webServices = bundle.getWebServices(); Collection myEndpoints = Boolean disableInDD = ejbDescriptor.getEjbBundleDescriptor().getDisableNonportableJndiNames(); if(disableInDD != null) { // explicitly set in glassfish-ejb-jar.xml disableNonPortableJndiName = disableInDD; glassfishSpecificJndiName = ejbDescriptor.getJndiName(); intfsForPortableJndi.put(ejbDescriptor.getHomeClassName(), ejbHomeStub); ejbDescriptor.setJndiName(javaGlobalName); " for EJB : " + this.ejbDescriptor.getName(), e); this.ejbDescriptor.getName() + " : " + publishedPortableGlobalJndiNames); this.ejbDescriptor.getName() + " : " + publishedNonPortableGlobalJndiNames); this.ejbDescriptor.getName() + " : " + publishedInternalGlobalJndiNames);
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException { RunAs runAsAn = (RunAs)ainfo.getAnnotation(); for (EjbContext ejbContext : ejbContexts) { EjbDescriptor ejbDesc = ejbContext.getDescriptor(); // override by xml if (ejbDesc.getUsesCallerIdentity() != null) { continue; } String roleName = runAsAn.value(); Role role = new Role(roleName); // add Role if not exists ejbDesc.getEjbBundleDescriptor().addRole(role); RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor(); runAsDesc.setRoleName(roleName); ejbDesc.setUsesCallerIdentity(false); if (ejbDesc.getRunAsIdentity() == null) { ejbDesc.setRunAsIdentity(runAsDesc); } } return getDefaultProcessedResult(); }
public void setEjbComponentImpl(EjbDescriptor ejbComponent) { webComponentImpl = null; webComponentLink = null; ejbLink = ejbComponent.getName(); ejbComponentImpl = ejbComponent; }
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()); } }
String appName = deploymentDescriptor.getApplication().getRegistrationName(); roleMapperFactory.setAppNameForContext(appName, contextId); codesource = getApplicationCodeSource(contextId); ejbName = deploymentDescriptor.getName(); realmName = deploymentDescriptor.getApplication().getRealm(); Set iorConfigs = deploymentDescriptor.getIORConfigurationDescriptors();