protected AbstractSessionContextImpl(Object ejb, BaseContainer container) { super(ejb, container); EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) getContainer().getEjbDescriptor(); this.ejbName = sessionDesc.getName(); }
/** * Validates @StatefulTimeout or <stateful-timeout> values. Any value less than -1 * is invalid. */ private void validateStatefulTimeout(EjbDescriptor ejb) { if(ejb instanceof EjbSessionDescriptor) { EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejb; Long statefulTimeoutValue = sessionDesc.getStatefulTimeoutValue(); if(statefulTimeoutValue != null && statefulTimeoutValue < -1) { throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.invalid_stateful_timeout_value", "Invalid value [{0}] for @StatefulTimeout or <stateful-timeout> element in EJB [{1}]. Values less than -1 are not valid.", new Object[] {statefulTimeoutValue, sessionDesc.getName()})); } } }
protected AbstractSessionContextImpl(Object ejb, BaseContainer container) { super(ejb, container); EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) getContainer().getEjbDescriptor(); this.ejbName = sessionDesc.getName(); }
/** * 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(); }
/** * Get the remove methods of the EJB * * @return An iterator over the remove methods */ public Collection<Method> getRemoveMethods() { Set<Method> removeMethods = new HashSet<Method>(); if( ejbDesc.getType().equals(EjbSessionDescriptor.TYPE) ) { EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDesc; if( sessionDesc.isStateful() && sessionDesc.hasRemoveMethods() ) { for(MethodDescriptor mDesc : sessionDesc.getRemoveMethodDescriptors()) { Method m = mDesc.getMethod(ejbDesc); if( m == null ) { throw new IllegalStateException("Can't resolve remove method " + mDesc + " For EJB " + sessionDesc.getName()); } removeMethods.add(m); } } } return removeMethods; }
void addSingletonContainer(EjbApplication ejbApp, AbstractSingletonContainer c) { c.setSingletonLifeCycleManager(this); EjbSessionDescriptor sdesc = (EjbSessionDescriptor) c.getEjbDescriptor(); String modName = sdesc.getEjbBundleDescriptor().getName(); //System.out.println("BundleName: " + modName); String src = normalizeSingletonName(sdesc.getName(), sdesc); String[] depends = sdesc.getDependsOn(); String[] newDepends = new String[depends.length]; StringBuilder sb = new StringBuilder("Partial order of dependent(s). " + src + " => {"); for(int i=0; i < depends.length; i++) { newDepends[i] = normalizeSingletonName(depends[i], sdesc); sb.append(newDepends[i] + " "); } sb.append("}"); if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, sb.toString()); } this.addDependency(src, newDepends); name2Container.put(src, c); name2EjbApp.put(src, ejbApp); }
void doStartup(EjbApplication ejbApp) { Collection<EjbDescriptor> ejbs = ejbApp.getEjbBundleDescriptor().getEjbs(); int descSz = ejbs.size(); for (EjbDescriptor desc : ejbs) { if (desc instanceof EjbSessionDescriptor) { EjbSessionDescriptor sdesc = (EjbSessionDescriptor) desc; if ((sdesc.isSingleton())) { if (sdesc.getInitOnStartup()) { String normalizedSingletonName = normalizeSingletonName(sdesc.getName(), sdesc); initializeSingleton(name2Container.get(normalizedSingletonName)); } } } } }
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; }
" for Singleton " + sessionDesc.getName());
+ " ejb " + sd.getName() + " : " + sd);
"enterprise.deployment.annotation.handlers.notmatchcreate", "Unable to find matching Home create method for Init method {0} on bean {1}.", new Object[] { m, sessionDescriptor.getName() })); return getDefaultFailedResult();
ejbDesc.getName());