/** * Returns the class loader associated with this application * * @return ClassLoader for this app */ public ClassLoader getClassLoader() { return bundleDesc.getClassLoader(); }
@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; }
private Class getClass(String className) { try { return getEjbBundleDescriptor().getClassLoader().loadClass(className); } catch ( Exception ex ) { throw new DeploymentException(ex); } }
/** * Return the set of method objects representing no-interface view */ public Set<Method> getOptionalLocalBusinessMethods() { Set<Method> methods = new HashSet<Method>(); try { Class c = getEjbBundleDescriptor().getClassLoader().loadClass(getEjbClassName()); Method[] ms = c.getMethods(); for (Method m : ms) { if (m.getDeclaringClass() != Object.class) { methods.add(m); } } } catch (Throwable t) { _logger.log(Level.SEVERE, "enterprise.deployment.backend.methodClassLoadFailure", new Object[]{"(EjbDescriptor.getMethods())"}); throw new RuntimeException(t); } return methods; }
/** * @return the collection of MethodDescriptors to which ContainerTransactions * may be assigned. */ public Collection getTransactionMethodDescriptors() { return getTransactionMethods(getEjbBundleDescriptor().getClassLoader()); }
/** * Return the set of method objects on my home and remote interfaces. */ public Vector getMethods() { return getMethods(getEjbBundleDescriptor().getClassLoader()); }
/** * Return a Vector of the Field objetcs of this ejb. */ public Vector getFields() { Vector fieldsVector = new Vector(); Class ejb = null; try { ClassLoader cl = getEjbBundleDescriptor().getClassLoader(); ejb = cl.loadClass(this.getEjbClassName()); } catch (Throwable t) { _logger.log(Level.SEVERE, "enterprise.deployment.backend.methodClassLoadFailure", new Object[]{this.getEjbClassName()}); return fieldsVector; } Field[] fields = ejb.getFields(); for (int i = 0; i < fields.length; i++) { fieldsVector.addElement(fields[i]); } return fieldsVector; }
public Set getTxBusinessMethodDescriptors() { ClassLoader classLoader = getEjbBundleDescriptor().getClassLoader(); Set methods = new HashSet(); try { addAllInterfaceMethodsIn (methods, classLoader.loadClass(messageListenerType), MethodDescriptor.EJB_BEAN); if (isTimedObject()) { methods.add(getEjbTimeoutMethod()); } } catch (Throwable t) { _logger.log(Level.SEVERE,"enterprise.deployment.backend.methodClassLoadFailure",new Object [] {"(EjbDescriptor.getBusinessMethodDescriptors())"}); throw new RuntimeException(t); } return methods; }
public Method getDeclaredMethod(EjbDescriptor ejbDescriptor, Class[] javaParamClassNames) { try { ClassLoader classloader = ejbDescriptor.getEjbBundleDescriptor().getClassLoader(); Class nextClass = classloader.loadClass(ejbDescriptor.getEjbClassName()); String mname = getName(); while((nextClass != Object.class) && (nextClass != null)) { // Do not use TypeUtil not to spend time converting parameter // types for each call. try { return nextClass.getDeclaredMethod(mname, javaParamClassNames); } catch (NoSuchMethodException nsme) { nextClass = nextClass.getSuperclass(); } } } catch(Exception e) { _logger.log(Level.SEVERE,"enterprise.deployment.backend.methodClassLoadFailure",new Object[]{ejbDescriptor}); } return null; }
public Method getDeclaredMethod(EjbDescriptor ejbDescriptor, Class[] javaParamClassNames) { try { ClassLoader classloader = ejbDescriptor.getEjbBundleDescriptor().getClassLoader(); Class nextClass = classloader.loadClass(ejbDescriptor.getEjbClassName()); String mname = getName(); while((nextClass != Object.class) && (nextClass != null)) { // Do not use TypeUtil not to spend time converting parameter // types for each call. try { return nextClass.getDeclaredMethod(mname, javaParamClassNames); } catch (NoSuchMethodException nsme) { nextClass = nextClass.getSuperclass(); } } } catch(Exception e) { _logger.log(Level.SEVERE,"enterprise.deployment.backend.methodClassLoadFailure",new Object[]{ejbDescriptor}); } return null; }
/** * Return the ejb method objects, i.e. the methods on the home and remote interfaces. */ public Vector getMethods(ClassLoader classLoader) { try { ClassLoader cl = getEjbBundleDescriptor().getClassLoader(); BeanMethodCalculator bmc = Globals.getDefaultHabitat().getComponent(BeanMethodCalculator.class); if (bmc!=null) { return bmc.getMethodsFor(this, classLoader); } else { _logger.log(Level.FINE, "enterprise.deploymnet.ejbcontainernotinstalled"); return new Vector(); } } catch (Throwable t) { _logger.log(Level.SEVERE, "enterprise.deployment.backend.methodClassLoadFailure", new Object[]{"(EjbDescriptor.getMethods())"}); throw new RuntimeException(t); } }
public Method getDeclaredMethod(EjbDescriptor ejbDescriptor) { ClassLoader classloader = ejbDescriptor.getEjbBundleDescriptor().getClassLoader(); try { Class[] parameterTypes = TypeUtil.paramClassNamesToTypes( getJavaParameterClassNames(), classloader); return getDeclaredMethod(ejbDescriptor, parameterTypes); } catch(Exception e) { _logger.log(Level.SEVERE,"enterprise.deployment.backend.methodClassLoadFailure",new Object[]{e, ejbDescriptor}); } return null; }
/** * @return a collection of MethodDescriptor for methods which may * have a associated transaction attribute */ protected Collection getTransactionMethods(ClassLoader classLoader) { try { ClassLoader cl = getEjbBundleDescriptor().getClassLoader(); BeanMethodCalculator bmc = Globals.getDefaultHabitat().getComponent(BeanMethodCalculator.class); if (bmc!=null) { return bmc.getTransactionalMethodsFor(this, classLoader); } else { _logger.log(Level.FINE, "enterprise.deploymnet.ejbcontainernotinstalled"); return null; } } catch (Throwable t) { _logger.log(Level.SEVERE, "enterprise.deployment.backend.methodClassLoadFailure", new Object[]{"(EjbDescriptor.getMethods())"}); throw new RuntimeException(t); } }
public Method getDeclaredMethod(EjbDescriptor ejbDescriptor) { ClassLoader classloader = ejbDescriptor.getEjbBundleDescriptor().getClassLoader(); try { Class[] parameterTypes = TypeUtil.paramClassNamesToTypes( getJavaParameterClassNames(), classloader); return getDeclaredMethod(ejbDescriptor, parameterTypes); } catch(Exception e) { _logger.log(Level.SEVERE,"enterprise.deployment.backend.methodClassLoadFailure",new Object[]{ejbDescriptor}); } return null; }
/** * Returns the full set of business method descriptors I have */ private Set getBusinessMethodDescriptors() { ClassLoader classLoader = getEjbBundleDescriptor().getClassLoader(); Set methods = getLocalRemoteBusinessMethodDescriptors(); try { if (hasWebServiceEndpointInterface()) { addAllInterfaceMethodsIn(methods, classLoader.loadClass(getWebServiceEndpointInterfaceName()), MethodDescriptor.EJB_WEB_SERVICE); } } catch (Throwable t) { _logger.log(Level.SEVERE, "enterprise.deployment.backend.methodClassLoadFailure", new Object[]{"(EjbDescriptor.getBusinessMethodDescriptors())"}); throw new RuntimeException(t); } return methods; }
/** * Returns the full set of method descriptors I have (from all the methods on my home and remote interfaces). */ public Set getMethodDescriptors() { ClassLoader classLoader = getEjbBundleDescriptor().getClassLoader(); Set methods = getBusinessMethodDescriptors(); try { if (isRemoteInterfacesSupported()) { addAllInterfaceMethodsIn(methods, classLoader.loadClass(getHomeClassName()), MethodDescriptor.EJB_HOME); } if (isLocalInterfacesSupported()) { addAllInterfaceMethodsIn(methods, classLoader.loadClass(getLocalHomeClassName()), MethodDescriptor.EJB_LOCALHOME); } } catch (Throwable t) { _logger.log(Level.SEVERE, "enterprise.deployment.backend.methodClassLoadFailure", new Object[]{"(EjbDescriptor.getMethods())"}); throw new RuntimeException(t); } return methods; }
public Vector getFieldDescriptors() { Vector fieldDescriptors = new Vector(); if( isEJB20() ) { try { ClassLoader cl = getEjbBundleDescriptor().getClassLoader(); BeanMethodCalculator bmc = Globals.getDefaultHabitat().getComponent(BeanMethodCalculator.class); if (bmc!=null) { fieldDescriptors = bmc.getPossibleCmpCmrFields (cl, this.getEjbClassName()); } else { _logger.log(Level.FINE, "enterprise.deploymnet.ejbcontainernotinstalled"); } } catch(Throwable t) { String errorMsg = localStrings.getLocalString ("enterprise.deployment.errorloadingejbclass", "error loading the ejb class {0} in getFields" + " on EjbDescriptor\n {1}", new Object[] {this.getEjbClassName(), t.toString() }); _logger.log(Level.FINE,errorMsg); } } else { fieldDescriptors = super.getFieldDescriptors(); } return fieldDescriptors; }
public void unload(EjbApplication ejbApplication, DeploymentContext dc) { EjbBundleDescriptor ejbBundle = ejbApplication.getEjbBundleDescriptor(); try { compEnvManager.unbindFromComponentNamespace(ejbBundle); } catch(Exception e) { _logger.log( Level.WARNING, "Error unbinding ejb bundle " + ejbBundle.getModuleName() + " dependency namespace", e); } if (ejbBundle.containsCMPEntity()) { initCMPDeployer(); if (cmpDeployer != null) { cmpDeployer.unload(ejbBundle.getClassLoader()); } } // All the other work is done in EjbApplication. }
public Vector getPossibleTransactionAttributes() { Vector txAttributes = super.getPossibleTransactionAttributes(); // Session beans that implement SessionSynchronization interface // have a limited set of possible transaction attributes. if( isStateful() ) { try { EjbBundleDescriptor ejbBundle = getEjbBundleDescriptor(); ClassLoader classLoader = ejbBundle.getClassLoader(); Class ejbClass = classLoader.loadClass(getEjbClassName()); AnnotationTypesProvider provider = Globals.getDefaultHabitat().getComponent(AnnotationTypesProvider.class, "EJB"); if (provider!=null) { Class sessionSynchClass = provider.getType("javax.ejb.SessionSynchronization"); if( sessionSynchClass.isAssignableFrom(ejbClass) ) { txAttributes = new Vector(); txAttributes.add(new ContainerTransaction (ContainerTransaction.REQUIRED, "")); txAttributes.add(new ContainerTransaction (ContainerTransaction.REQUIRES_NEW, "")); txAttributes.add(new ContainerTransaction (ContainerTransaction.MANDATORY, "")); } } } catch(Exception e) { // Don't treat this as a fatal error. Just return full // set of possible transaction attributes. } } return txAttributes; }
ClassLoader classLoader = getEjbBundleDescriptor().getClassLoader();