Examples of ContainerTransaction


Examples of org.apache.openejb.jee.ContainerTransaction

            public Map<String, List<MethodAttribute>> getExistingDeclarations() {
                return assemblyDescriptor.getMethodTransactionMap(ejbName);
            }

            public void addClassLevelDeclaration(TransactionAttribute attribute, Class type) {
                ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

Examples of org.apache.openejb.jee.ContainerTransaction

                ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }

            public void addMethodLevelDeclaration(TransactionAttribute attribute, Method method) {
                ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), ejbName, method);
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

Examples of org.apache.openejb.jee.ContainerTransaction

        ejbJar.addEnterpriseBean(new StatelessBean(Red.class));
        ejbJar.addEnterpriseBean(new StatelessBean(Crimson.class));
        ejbJar.addEnterpriseBean(new StatelessBean(Scarlet.class));
        List<ContainerTransaction> declared = ejbJar.getAssemblyDescriptor().getContainerTransaction();

        declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "*", "*", "*"));
        declared.add(new ContainerTransaction(TransAttribute.SUPPORTS, "*", "Crimson", "*"));
        declared.add(new ContainerTransaction(TransAttribute.SUPPORTS, Color.class.getName(), "Scarlet", "*"));
        declared.add(new ContainerTransaction(TransAttribute.NEVER, Red.class.getName(), "Scarlet", "red"));
        declared.add(new ContainerTransaction(TransAttribute.REQUIRED, "Scarlet", Scarlet.class.getMethod("scarlet")));

        ejbJar.getAssemblyDescriptor().addInterceptorBinding(new InterceptorBinding("*", AttributeInterceptor.class.getName()));

        EjbJarInfo ejbJarInfo = config.configureApplication(ejbJar);
        assembler.createApplication(ejbJarInfo);
View Full Code Here

Examples of org.apache.openejb.jee.ContainerTransaction

    context.assertIsSatisfied();
  }
 
  private void addMethodTransactionToDescriptor(AssemblyDescriptor descriptor, String ejbName, String methodName, String[] params) {
    List<ContainerTransaction> containerTransactions = descriptor.getContainerTransaction();
    ContainerTransaction containerTransaction = new ContainerTransaction();

    containerTransaction.getMethod().add(createMethod(ejbName, methodName, params));
    containerTransaction.setTransAttribute(TransAttribute.MANDATORY);
    containerTransactions.add(containerTransaction);
  }
View Full Code Here

Examples of org.apache.openejb.jee.ContainerTransaction

            public Map<String, List<MethodAttribute>> getExistingDeclarations() {
                return assemblyDescriptor.getMethodTransactionMap(ejbName);
            }

            public void addClassLevelDeclaration(final TransactionAttribute attribute, final Class type) {
                final ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

Examples of org.apache.openejb.jee.ContainerTransaction

                final ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }

            public void addMethodLevelDeclaration(final TransactionAttribute attribute, final Method method) {
                final ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), ejbName, method);
                assemblyDescriptor.getContainerTransaction().add(ctx);
            }
View Full Code Here

Examples of org.apache.openejb.jee.ContainerTransaction

                    // SET THE DEFAULT
                    if (!methodTransactions.containsKey("*")) {
                        TransactionAttribute attribute = clazz.getAnnotation(TransactionAttribute.class);
                        if (attribute != null) {
                            ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), ejbName, "*");
                            assemblyDescriptor.getContainerTransaction().add(ctx);
                        }
                    }

                    List<Method> methods = classFinder.findAnnotatedMethods(TransactionAttribute.class);
View Full Code Here

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

       boolean lookForIt = false;
      
       for (int i = 0; i < componentInterfaceMethods.length; i++) {
               if (Arrays.binarySearch(EJBObjectMethods, componentInterfaceMethods[i].getName()) < 0) {
         try {
       ContainerTransaction containerTransaction = null;
       boolean resolved = false;
/*
                         // This flag is a workaround introduced by Harminder
                         // because currently methodDescriptor.getEjbClassSymbol() is
                         // returning NULL
                         //boolean allMethods = false;
                         boolean wildCardWasPresent = false;
*/
                        
       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 component interface
         // according to the six styles
         // style 1)
                 if (methodDescriptor.getName().equals(MethodDescriptor.ALL_METHODS)) {
             // if getEjbClassName() is Remote -> CARRY ON
             // if Remote - PASS
                     if (methodDescriptor.getEjbClassSymbol() == null) {
           lookForIt = true;
                     } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_REMOTE)) {
           lookForIt = true;
           // if empty String PASS
             } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCAL)) {
           lookForIt = true;
             }else if (methodDescriptor.getEjbClassSymbol().equals("")) {
           lookForIt = true;
             } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME)) {
           lookForIt = false;
             else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) {
           lookForIt = false;
             }else {
           // carry on & don't look for
           // container transaction
           lookForIt = false;
             }
            
            
         } else if (methodDescriptor.getParameterClassNames() == null) {
            
            
             // if (getEjbClassSybol() is Remote or is the empty String AND if componentInterfaceMethods[i].getName().equals(methodDescriptor.getName())
             if (((methodDescriptor.getEjbClassSymbol() == null) ||
            methodDescriptor.getEjbClassSymbol().equals("") ||
            methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_REMOTE)||
            methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCAL)) &&
           (componentInterfaceMethods[i].getName().equals(methodDescriptor.getName()))) {
           //  PASS
           lookForIt = true;
             } else {
           // carry on
           lookForIt = false;
             }
            
            
         } else {
            
             // if (getEjbClassSybol() is Remote or is the empty String AND if componentInterfaceMethods[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_REMOTE)||
            methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCAL))&&
           (componentInterfaceMethods[i].getName().equals(methodDescriptor.getName()))&&
           (MethodUtils.stringArrayEquals(methodDescriptor.getParameterClassNames(), (new MethodDescriptor(componentInterfaceMethods[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
View Full Code Here

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

      boolean lookForIt = false;
     
      for (int i=0; i< methods.length; i++) {
    if (Arrays.binarySearch(EJBObjectMethods, methods[i].getName()) < 0) {
                    try {
      ContainerTransaction containerTransaction = null;
      boolean resolved = false;
/*
                        // This flag is a workaround introduced by Harminder
                        // because currently methodDescriptor.getEjbClassSymbol() is
                        // returning NULL
                        //boolean allMethods = false;
                        boolean wildCardWasPresent = false;
*/

      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
View Full Code Here

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

        // 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",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.