Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.MethodDescriptor


        boolean hasError = false;
        String query = null;
        PersistenceDescriptor desc = ((EjbCMPEntityDescriptor)ejbDesc).getPersistenceDescriptor();
       
        for (Iterator it = desc.getQueriedMethods().iterator(); it.hasNext();) {
            MethodDescriptor method = (MethodDescriptor) it.next();
            try {
                QueryDescriptor qDesc = desc.getQueryFor(method);
                query = qDesc.getQuery();
               
                if (qDesc.getIsEjbQl()) {
                    Method m = method.getMethod(ejbDesc);

                    int retypeMapping = mapRetType(qDesc.getReturnTypeMapping());
       
                    boolean finder = false;

                    if ((method.getName()).startsWith("find")) {
                       finder = true;
                       retypeMapping = 2; /*QueryDescriptor.NO_RETURN_TYPE_MAPPING;*/
                    }

                    ejbqlDriver.compile(query, m, retypeMapping, finder, ejbDesc.getName());
View Full Code Here


      if (!descriptor.getMethodContainerTransactions().isEmpty()) {
          for (Enumeration ee = descriptor.getMethodContainerTransactions().keys(); ee.hasMoreElements();) {
        lookForIt = false;
       
        MethodDescriptor methodDescriptor = (MethodDescriptor) ee.nextElement();
    /*** Fixed the bug: 4883730. ejbClassSymbol is null when method-intf is not
     * defined in the xml, since it is an optional field. Removed the earlier
     * checks. A null method-intf indicates that the method is supposed to be
     * in both Local & Home interfaces. ***/                   
/*
                                // This code is a workaround introduced by Harminder
                                // because currently methodDescriptor.getEjbClassSymbol() is
                                // returning NULL
                                String methodIntf = null;
                                try {
                                    methodIntf = methodDescriptor.getEjbClassSymbol();
                                } catch ( Exception ex ) {}
                                if ( methodIntf == null ) { //|| methodIntf.equals("")
                                    //probably a wildcard was there
                                    wildCardWasPresent = true;
                                    continue;
                                }
                                 //allMethods = true;
                                 // end of workaround
*/
                               
       
        // here we have to check that each method descriptor
        // corresponds to a or some methods on the home interface
        // according to the six styles
        // style 1)
                 if (methodDescriptor.getName().equals(MethodDescriptor.ALL_METHODS)) {
            // if getEjbClassName() is Remote -> CARRY ON
            // if Home - PASS
                    if (methodDescriptor.getEjbClassSymbol() == null) {
          lookForIt = true;
                    } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)) {
          lookForIt = true;
          // if empty String PASS
            } else if (methodDescriptor.getEjbClassSymbol().equals("")) {
          lookForIt = true;
            }else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) {
          lookForIt = true;
            } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_REMOTE)) {
          lookForIt = false;
            } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCAL)) {
          lookForIt = false;
          // else (Bogus)
            } else {
          // carry on & don't look for
          // container transaction
          lookForIt = false;
            }                       
        } else if (methodDescriptor.getParameterClassNames() == null) {
                       
            // if (getEjbClassSybol() is Home or is the empty String AND if methods[i].getName().equals(methodDescriptor.getName())
            if (((methodDescriptor.getEjbClassSymbol() == null) ||
           methodDescriptor.getEjbClassSymbol().equals("") ||
           methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)||
           methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) &&
          (methods[i].getName().equals(methodDescriptor.getName()))) {
          //  PASS
          lookForIt = true;
            } else {
          // carry on
          lookForIt = false;
            }                       
        } else {
           
            // if (getEjbClassSybol() is Home or is the empty String AND if methods[i].getName().equals(methodDescriptor.getName()) AND
            // the parameters of the method[i] are the same as the parameters of the method descriptor )
           
            if (((methodDescriptor.getEjbClassSymbol() == null) ||
           methodDescriptor.getEjbClassSymbol().equals("") ||
           methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)||
           methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) &&
          (methods[i].getName().equals(methodDescriptor.getName())) &&
          (MethodUtils.stringArrayEquals(methodDescriptor.getParameterClassNames(), (new MethodDescriptor(methods[i], methodIntf)).getParameterClassNames()))) {
          // PASS     
          lookForIt = true;
            } else {
          // CARRY ON
          lookForIt = false;
            }
           
        }
       
        if (lookForIt) {
            containerTransaction =
          (ContainerTransaction) descriptor.getMethodContainerTransactions().get(methodDescriptor);                       
            if (containerTransaction != null) {
          String transactionAttribute  =
              containerTransaction.getTransactionAttribute();
         
          // danny is doing this in the DOL, but is it possible to not have
          // any value for containerTransaction.getTransactionAttribute()
          // in the DOL? if it is possible to have blank value for this,
          // then this check is needed here, otherwise we are done and we
          // don't need this check here
          if (ContainerTransaction.NOT_SUPPORTED.equals(transactionAttribute)
              || ContainerTransaction.SUPPORTS.equals(transactionAttribute)
              || ContainerTransaction.REQUIRED.equals(transactionAttribute)
              || ContainerTransaction.REQUIRES_NEW.equals(transactionAttribute)
              || ContainerTransaction.MANDATORY.equals(transactionAttribute)
              || ContainerTransaction.NEVER.equals(transactionAttribute)
              || (!transactionAttribute.equals(""))) {
              addGoodDetails(result, compName);
              result.addGoodDetails(smh.getLocalString
            (getClass().getName() + ".passed",
                   "Valid: [ {0} ] TransactionAttribute [ {1} ] for method [ {2} ] is valid.   Transaction attributes must be specified for all methods except getEJBMetaData and getHomeHandle methods of home interface [ {3} ]",
             new Object[] {methods[i].getName(),transactionAttribute,methodDescriptor.getName(), home}));
              resolved = true;
          } else {
              oneFailed = true;
              addErrorDetails(result, compName);
              result.addErrorDetails(smh.getLocalString
             (getClass().getName() + ".failed",
                "Error: [ {0} ] TransactionAttribute [ {1} ] for method [ {2} ] " +
                "is not valid.   Transaction attributes must be specified for " +
                "all methods except getEJBMetaData and getHomeHandle methods of "+
                "home interface [ {3} ]",
                new Object[] {methods[i].getName(), transactionAttribute, methodDescriptor.getName(),home}));
          }
            } else {
          oneFailed = true;
          result.addErrorDetails(smh.getLocalString
                     (getClass().getName() + ".failedException",
                "Error: TransactionAttribute is null for method [ {0} ]",
                new Object[] {methodDescriptor.getName()}));
            }
        }
          }   
          // before you go on to the next method,
          // did you resolve the last one okay?
View Full Code Here

        // We don't use getQueryFor to free ourselfves from classloader issues.
        Set set = descriptor.getPersistenceDescriptor().getQueriedMethods();
        Iterator iterator = set.iterator();
  if (iterator.hasNext()) {
      while(iterator.hasNext()) {
    MethodDescriptor queryMethod = (MethodDescriptor) iterator.next();
    if (queryMethod.getName().equals(method.getName())) {
        Class mParms[] = method.getParameterTypes();
        String queryParms[] = queryMethod.getParameterClassNames();
            int queryParamsLen;
            if(queryParms == null)
              queryParamsLen = 0;
            else
              queryParamsLen = queryParms.length;
View Full Code Here

      Class c = Class.forName(home, false, getVerifierContext().getClassLoader());
      Method methods[] = c.getDeclaredMethods();
     
      for (int i=0; i< methods.length; i++) {
          if (methods[i].getName().startsWith("find") && !(methods[i].getName()).equals(FINDBYPRIMARYKEY)) {
        QueryDescriptor query = pers.getQueryFor(new MethodDescriptor(methods[i], methodIntf));
        if (query != null) {
            if (query.getQuery() != null && !"".equals(query.getQuery())) {
                result.addGoodDetails(smh.getLocalString
              ("tests.componentNameConstructor",
               "For [ {0} ]",
View Full Code Here

        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        // We don't use getQueryFor to free ourselfves from classloader issues.
        Set set = descriptor.getPersistenceDescriptor().getQueriedMethods();
        Iterator iterator = set.iterator();
        while(iterator.hasNext()) {
            MethodDescriptor queryMethod = (MethodDescriptor) iterator.next();
            if (queryMethod.getName().equals(m.getName())) {
                Class mParms[] = m.getParameterTypes();
 
                String queryParms[] = queryMethod.getParameterClassNames();
 
    if (queryParms != null) {
 
                if (queryParms.length == mParms.length) {
                    boolean same = true;
View Full Code Here

                        !remoteMethod.getName().equals("class$") &&
                        !remoteMethod.getName().equals("setSessionContext")) {
                   
                    Iterator methods = allMethods.iterator();
                    while (methods.hasNext()) {
                        MethodDescriptor methodDescriptor = (MethodDescriptor)methods.next();
                       
                        if (methodDescriptor.getName().equals(remoteMethod.getName())) {
                            if (MethodUtils.stringArrayEquals(methodDescriptor.getParameterClassNames(),
                                    (new MethodDescriptor(remoteMethod,methodIntf)).getParameterClassNames())) {
                                found = true;
                                break;
                            }
                        }
                    }
View Full Code Here

      }

      Iterator iterator = methods.iterator();
      while(iterator.hasNext())
      {
        MethodDescriptor method = (MethodDescriptor) iterator.next();
        // if the MDB is also a TimedObject then don't check the
        // transaction attribute of ejbTimeout. The
        // timer/HasValidEjbTimeout test will check the transaction
        // attribute for ejbTimeout

        if( descriptor.isTimedObject() &&
            (method.getName()).equals("ejbTimeout") )
          continue;
        ContainerTransaction txAttr = descriptor.
          getContainerTransactionFor(method);
        if(txAttr == null)
        {
            if(getVerifierContext().getJavaEEVersion().compareTo(SpecVersionMapper.JavaEEVersion_5)<0) {
          // transaction attribute is not specified for method.
          addErrorDetails(result, compName);
          result.failed(smh.getLocalString
              (getClass().getName()+".failed4",
               "Error : Message-driven bean [ {0} ] method definition [ {1} ] does not have a valid container transaction descriptor.",
               new Object[] {descriptor.getName(), method.getName()}));                                
            } // default transaction attr in EJB 3.0 is REQUIRED
          continue;
        }
        String ta = txAttr.getTransactionAttribute();
        if (ContainerTransaction.REQUIRED.equals(ta) ||
            ContainerTransaction.NOT_SUPPORTED.equals(ta)) {
          addGoodDetails(result, compName);
          result.passed(smh.getLocalString
              (getClass().getName()+".passed",
               "Message-driven bean [ {0} ] method definition [ {1} ] in assembly-descriptor is correct",
               new Object[] {descriptor.getName(), method.getName()}));                                           
        } else {
          addErrorDetails(result, compName);
          result.failed(smh.getLocalString
              (getClass().getName()+".failed3",
               "Error : Message-driven bean [ {0} ] method definition [ {1} ] transaction attribute must be Required or NotSupported",
               new Object[] {descriptor.getName(), method.getName()}));                                
        }
      }
      return result;                   
    } else {
      addNaDetails(result, compName);
View Full Code Here

          }
      } else {

            EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDescriptor;

          MethodDescriptor afterBeginMethodDesc = sessionDesc.getAfterBeginMethod();
            if( afterBeginMethodDesc != null ) {
                afterBeginMethod = afterBeginMethodDesc.getDeclaredMethod(sessionDesc);

                processSessionSynchMethod(afterBeginMethod);
            }

          MethodDescriptor beforeCompletionMethodDesc = sessionDesc.getBeforeCompletionMethod();
            if( beforeCompletionMethodDesc != null ) {
                beforeCompletionMethod = beforeCompletionMethodDesc.getDeclaredMethod(sessionDesc);

                processSessionSynchMethod(beforeCompletionMethod);
            }
           
          MethodDescriptor afterCompletionMethodDesc = sessionDesc.getAfterCompletionMethod();
            if( afterCompletionMethodDesc != null ) {
                afterCompletionMethod = afterCompletionMethodDesc.getDeclaredMethod(sessionDesc);
                if( afterCompletionMethod == null ) {
                    afterCompletionMethod =
                        afterCompletionMethodDesc.getDeclaredMethod(sessionDesc, new Class[] { Boolean.TYPE });
                }
                processSessionSynchMethod(afterCompletionMethod);
            }

      }
View Full Code Here

            if (checkpointPolicy.isHAEnabled()) {
                Iterator iter = invocationInfoMap.values().iterator();
                while (iter.hasNext()) {
                    InvocationInfo info = (InvocationInfo) iter.next();
                    info.checkpointEnabled = false;
                    MethodDescriptor md = new MethodDescriptor(
                            info.method, info.methodIntf);
                    IASEjbExtraDescriptors extraDesc =
                            ejbDescriptor.getIASEjbExtraDescriptors();
                    if (extraDesc != null) {
                        CheckpointAtEndOfMethodDescriptor cpDesc =
View Full Code Here

            if ( ejbDescriptor.isTimedObject() ) {

                warnIfNotFullProfile("use of persistent EJB Timer Service");

                MethodDescriptor ejbTimeoutMethodDesc =
                    ejbDescriptor.getEjbTimeoutMethod();
                // Can be a @Timeout or @Schedule or TimedObject
                if (ejbTimeoutMethodDesc != null) {
                    Method method = ejbTimeoutMethodDesc.getMethod(ejbDescriptor);
                    processEjbTimeoutMethod(method);

                    ejbTimeoutMethod = method;
                }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.MethodDescriptor

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.