Package org.glassfish.ejb.deployment.descriptor

Examples of org.glassfish.ejb.deployment.descriptor.EjbDescriptor


                addErrorDetails(result, compName);
                result.failed(smh.getLocalString
                    (getClass().getName() + ".failed",
                    "failed [AS-EJB ejb] : ejb-name cannot not be empty. It should be a valid ejb-name as defined in ejb-jar.xml"));
            } else {
                EjbDescriptor testDesc = descriptor.getEjbBundleDescriptor().getEjbByName(ejbName);
                if(testDesc!=null && testDesc.getName().equals(ejbName))
                {
                    addGoodDetails(result, compName);
                    result.passed(smh.getLocalString(getClass().getName() + ".passed",
                        "PASSED [AS-EJB ejb] :  ejb-name is {0} and verified with ejb-jar.xml",
                        new Object[] {ejbName}));
View Full Code Here


            return false;
       
        Iterator<EjbDescriptor> iterator = entities.iterator();
  if(interfaceType.equals(MethodDescriptor.EJB_REMOTE)) {
      while (iterator.hasNext()) {
    EjbDescriptor entity = iterator.next();
   
    if (fieldType.getName().equals(entity.getHomeClassName()) ||
        fieldType.getName().equals(entity.getRemoteClassName()))
        return true;
      }
  }
  if(interfaceType.equals(MethodDescriptor.EJB_LOCAL)) {
      while (iterator.hasNext()) {
    EjbDescriptor entity = iterator.next();
   
    if (fieldType.getName().equals(entity.getLocalHomeClassName()) ||
        fieldType.getName().equals(entity.getLocalClassName()))
        return true;
      }
  }
        return false;
  }catch(Throwable t) {
View Full Code Here

      EjbBundleDescriptorImpl bundle = descriptor.getEjbBundleDescriptor();
      Iterator iterator = (bundle.getEjbs()).iterator();
      Vector<String> schemaNames = new Vector<String>();
      while(iterator.hasNext()) {
    EjbDescriptor entity = (EjbDescriptor) iterator.next();
    if (entity instanceof EjbEntityDescriptor) {
        if (!entity.equals(descriptor)) {
      if (((EjbEntityDescriptor)entity).getPersistenceType().equals(EjbEntityDescriptor.CONTAINER_PERSISTENCE)) {
          schemaNames.addElement(((EjbCMPEntityDescriptor)entity).getAbstractSchemaName());
      }
        }
    }
View Full Code Here

            return false;
       
        Iterator<EjbDescriptor> iterator = entities.iterator();
  if (interfaceType.equals(MethodDescriptor.EJB_REMOTE)) {
      while (iterator.hasNext()) {
    EjbDescriptor entity = iterator.next();
    if (fieldType.getName().equals(entity.getHomeClassName()) ||
        fieldType.getName().equals(entity.getRemoteClassName()))
        return true;
      }
  }
   if (interfaceType.equals(MethodDescriptor.EJB_LOCAL)) {
      while (iterator.hasNext()) {
    EjbDescriptor entity = iterator.next();
    if (fieldType.getName().equals(entity.getLocalHomeClassName()) ||
        fieldType.getName().equals(entity.getLocalClassName()))
        return true;
      }
  }
  return false;
    }
View Full Code Here

        if (entities==null)
            return false;
  // only local interface can be a valid interface
        Iterator<EjbDescriptor> iterator = entities.iterator();
        while (iterator.hasNext()) {
            EjbDescriptor entity = iterator.next();
      if (fieldType.getName().equals(entity.getLocalClassName()))
    return true;
  }
        return false;
    }
View Full Code Here

     * ejb which are elligible to have a particular transaction setting.
     */
    public Collection getTransactionalMethodsFor(com.sun.enterprise.deployment.EjbDescriptor desc, ClassLoader loader)
        throws ClassNotFoundException, NoSuchMethodException
    {
        EjbDescriptor ejbDescriptor = (EjbDescriptor) desc;
        // only set if desc is a stateful session bean.  NOTE that
        // !statefulSessionBean does not imply stateless session bean
        boolean statefulSessionBean = false;

        Vector methods = new Vector();
        if (ejbDescriptor instanceof EjbSessionDescriptor) {
            statefulSessionBean =
                ((EjbSessionDescriptor) ejbDescriptor).isStateful();
           
            boolean singletonSessionBean =
                ((EjbSessionDescriptor) ejbDescriptor).isSingleton();
           
      // Session Beans
            if (ejbDescriptor.isRemoteInterfacesSupported()) {               
                Collection disallowedMethods = extractDisallowedMethodsFor(javax.ejb.EJBObject.class, sessionBeanMethodsDisallowed);
                Collection potentials = getTransactionMethodsFor(loader, ejbDescriptor.getRemoteClassName() , disallowedMethods);
                transformAndAdd(potentials, MethodDescriptor.EJB_REMOTE, methods);
            }
           
            if( ejbDescriptor.isRemoteBusinessInterfacesSupported() ) {
               
                for(String intfName :
                        ejbDescriptor.getRemoteBusinessClassNames() ) {

                    Class businessIntf = loader.loadClass(intfName);
                    Method[] busIntfMethods = businessIntf.getMethods();
                    for (Method next : busIntfMethods ) {
                        methods.add(new MethodDescriptor
                                    (next, MethodDescriptor.EJB_REMOTE));
                    }
                }
            }

            if (ejbDescriptor.isLocalInterfacesSupported()) {
                Collection disallowedMethods = extractDisallowedMethodsFor(javax.ejb.EJBLocalObject.class, sessionLocalBeanMethodsDisallowed);
                Collection potentials = getTransactionMethodsFor(loader, ejbDescriptor.getLocalClassName() , disallowedMethods);
                transformAndAdd(potentials, MethodDescriptor.EJB_LOCAL, methods);
               
            }

            if( ejbDescriptor.isLocalBusinessInterfacesSupported() ) {

                for(String intfName :
                        ejbDescriptor.getLocalBusinessClassNames() ) {

                    Class businessIntf = loader.loadClass(intfName);
                    Method[] busIntfMethods = businessIntf.getMethods();
                    for (Method next : busIntfMethods ) {
                        methods.add(new MethodDescriptor
                                    (next, MethodDescriptor.EJB_LOCAL));
                    }
                }
            }

            if( ejbDescriptor.isLocalBean() ) {
                String intfName = ejbDescriptor.getEjbClassName();
                Class businessIntf = loader.loadClass(intfName);
                Method[] busIntfMethods = businessIntf.getMethods();
                for (Method next : busIntfMethods ) {
                    methods.add(new MethodDescriptor
                                (next, MethodDescriptor.EJB_LOCAL));
                }
            }

            if (ejbDescriptor.hasWebServiceEndpointInterface()) {
                Class webServiceClass = loader.loadClass
                    (ejbDescriptor.getWebServiceEndpointInterfaceName());
               
                Method[] webMethods = webServiceClass.getMethods();               
                for (int i=0;i<webMethods.length;i++) {
                    methods.add(new MethodDescriptor(webMethods[i]
                                MethodDescriptor.EJB_WEB_SERVICE));
                   
                }
            }

            // SFSB and Singleton can have lifecycle callbacks transactional
            if (statefulSessionBean || singletonSessionBean) {
                Set<LifecycleCallbackDescriptor> lcds = ejbDescriptor.getLifecycleCallbackDescriptors();
                for(LifecycleCallbackDescriptor lcd : lcds) {
                    try {
                        Method m = lcd.getLifecycleCallbackMethodObject(loader);
                        MethodDescriptor md = new MethodDescriptor(m, MethodDescriptor.EJB_BEAN);
                        methods.add(md);
                    } catch(Exception e) {
                        if (_logger.isLoggable(Level.FINE)) {
                            _logger.log(Level.FINE,
                            "Lifecycle callback processing error", e);
                        }
                    }
                }
            }


        } else {
            // entity beans local interfaces
            String homeIntf = ejbDescriptor.getHomeClassName();
            if (homeIntf!=null) {               
                Class home = loader.loadClass(homeIntf);
                Collection potentials = getTransactionMethodsFor(javax.ejb.EJBHome.class, home);
                transformAndAdd(potentials, MethodDescriptor.EJB_HOME, methods);
               
                String remoteIntf = ejbDescriptor.getRemoteClassName();               
                Class remote = loader.loadClass(remoteIntf);
                potentials = getTransactionMethodsFor(javax.ejb.EJBObject.class, remote);
                transformAndAdd(potentials, MethodDescriptor.EJB_REMOTE, methods);
            }
           
            // enity beans remote interfaces
            String localHomeIntf = ejbDescriptor.getLocalHomeClassName();
            if (localHomeIntf!=null) {
                Class home = loader.loadClass(localHomeIntf);
                Collection potentials = getTransactionMethodsFor(javax.ejb.EJBLocalHome.class, home);
                transformAndAdd(potentials, MethodDescriptor.EJB_LOCALHOME, methods);
               
                String remoteIntf = ejbDescriptor.getLocalClassName();               
                Class remote = loader.loadClass(remoteIntf);
                potentials = getTransactionMethodsFor(javax.ejb.EJBLocalObject.class, remote);
                transformAndAdd(potentials, MethodDescriptor.EJB_LOCAL, methods);               
            }
        }

        if( !statefulSessionBean ) {
            if( ejbDescriptor.isTimedObject() ) {
                if( ejbDescriptor.getEjbTimeoutMethod() != null) {
                    methods.add(ejbDescriptor.getEjbTimeoutMethod());
                }
                for (ScheduledTimerDescriptor schd : ejbDescriptor.getScheduledTimerDescriptors()) {
                    methods.add(schd.getTimeoutMethod());
                }
            }
        }

View Full Code Here

        boolean pass = true;

        if (wsdescriptor.implementedByEjbComponent()) {

          EjbDescriptor descriptor = (EjbDescriptor) wsdescriptor.getEjbComponentImpl();

    try  {
             ContainerTransaction ctx = descriptor.getContainerTransaction();

             if ((ctx != null) &&
                 (ContainerTransaction.MANDATORY.equals(ctx.getTransactionAttribute()))) {
                 // Call result.failed here : All methods are having Mandatory TX
                  result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
                  result.failed(smh.getLocalString (getClass().getName() + ".failed",
                  "[{0}] of this WebService [{1}] have Mandatory Transaction Attribute.",
                  new Object[] {"All the methods", compName.toString()}));

                 return result;
             }

             Collection txMethDescs = descriptor.getTransactionMethodDescriptors();

             // get hold of the SEI Class
             String s = descriptor.getWebServiceEndpointInterfaceName();

             if (s == null) {
               // internal error, should never happen
                result.addErrorDetails(smh.getLocalString
               ("com.sun.enterprise.tools.verifier.tests.webservices.Error",
                "Error: Unexpected error occurred [ {0} ]",
                new Object[] {"Service Endpoint Interface Class Name Null"}));
                pass = false;
            
             ClassLoader cl = getVerifierContext().getClassLoader();
             Class sei = null;

             try {
                sei = Class.forName(s, false, cl);
             }catch(ClassNotFoundException e) {
               result.addErrorDetails(smh.getLocalString
               ("com.sun.enterprise.tools.verifier.tests.webservices.Error",
                "Error: Unexpected error occurred [ {0} ]",
                new Object[] {"Could not Load Service Endpoint Interface Class"}));
                pass = false;
             }

             Iterator it = txMethDescs.iterator();
             while (it.hasNext()) {
               // need to check if this method is part of SEI
               MethodDescriptor methdesc =(MethodDescriptor)it.next();
              if (isSEIMethod(methdesc, descriptor, sei, cl)) {
                  ctx = descriptor.getContainerTransactionFor(methdesc);
                  if ((ctx != null) &&
                     (ContainerTransaction.MANDATORY.equals(ctx.getTransactionAttribute()))) {
                     // Call result.failed here with Method details here
                     result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
View Full Code Here

            }
        }

        for (Iterator itr = bundleDescriptor.getEjbs().iterator();
             itr.hasNext();) {
            EjbDescriptor ejbDescriptor = (EjbDescriptor) itr.next();
            super.check(ejbDescriptor);
        }

        if (bundleDescriptor.containsCMPEntity() &&
                context.getJDOException() == null) {
View Full Code Here

        if (desc.hasWebServiceClients()) {
            Set ejbdescs = desc.getEjbs();
            Iterator ejbIt = ejbdescs.iterator();

            while (ejbIt.hasNext()) {
                EjbDescriptor ejbDesc = (EjbDescriptor) ejbIt.next();
                context.setEjbDescriptorForServiceRef(ejbDesc);
                Set serviceRefDescriptors = ejbDesc.getServiceReferenceDescriptors();
                Iterator it = serviceRefDescriptors.iterator();
                while (it.hasNext()) {
                    webServiceClientCheckMgr.setVerifierContext(context);
                    webServiceClientCheckMgr.check(
                            (ServiceReferenceDescriptor) it.next());
View Full Code Here

    }

    private void setDescClassLoader(EjbBundleDescriptorImpl bundleDescriptor) {
        Iterator bundleItr = bundleDescriptor.getEjbs().iterator();
        while (bundleItr.hasNext()) {
            EjbDescriptor descriptor = (EjbDescriptor) bundleItr.next();
            if (descriptor instanceof IASEjbCMPEntityDescriptor) {
                ((IASEjbCMPEntityDescriptor) (descriptor)).setClassLoader(
                        context.getClassLoader());
            }
        }
View Full Code Here

TOP

Related Classes of org.glassfish.ejb.deployment.descriptor.EjbDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.