Examples of TransactionAttribute


Examples of javax.ejb.TransactionAttribute

      return containers;
   }
  
   protected void validateMDBTransactionAttribute(MDB mdb)
   {
      TransactionAttribute tx = (TransactionAttribute)mdb.resolveAnnotation(TransactionAttribute.class);
      if (tx != null)
      {
         TransactionAttributeType type = tx.value();
         if (type != TransactionAttributeType.REQUIRED && type != TransactionAttributeType.NOT_SUPPORTED)
            throw new RuntimeException("MDB " + mdb.getEjbName() + " has an invalid TransactionAttribute: " + type +
                  ". Only REQUIRED and NOT_SUPPORTED are valid");
      }
   }
View Full Code Here

Examples of javax.ejb.TransactionAttribute

   {
      TransactionManagementType mtype = TxUtil.getTransactionManagementType(container);
      if (mtype == javax.ejb.TransactionManagementType.BEAN) return false;


      TransactionAttribute attr = (TransactionAttribute)container.resolveAnnotation(method, TransactionAttribute.class);
      if (attr == null)
      {
         attr =(TransactionAttribute)container.resolveAnnotation(TransactionAttribute.class);
      }
      TransactionAttributeType type = TransactionAttributeType.REQUIRED;
      if (attr != null) type = attr.value();
      return type == javax.ejb.TransactionAttributeType.REQUIRED;
   }
View Full Code Here

Examples of javax.ejb.TransactionAttribute

            // SET THE DEFAULT
            if (!hasMethodTransaction("*", null, methodTransactions)) {
                for (Class<?> type : ancestors(clazz)) {
                    if (!hasMethodTransaction("*", type, methodTransactions)){
                        TransactionAttribute attribute = type.getAnnotation(TransactionAttribute.class);
                        if (attribute != null) {
                            ContainerTransaction ctx = new ContainerTransaction(cast(attribute.value()), type.getName(), ejbName, "*");
                            assemblyDescriptor.getContainerTransaction().add(ctx);
                        }
                    }
                }

            }


            List<Method> methods = classFinder.findAnnotatedMethods(TransactionAttribute.class);
            for (Method method : methods) {
                TransactionAttribute attribute = method.getAnnotation(TransactionAttribute.class);
                if (!methodTransactions.containsKey(method.getName())) {
                    // no method with this name in descriptor
                    addContainerTransaction(attribute, ejbName, method, assemblyDescriptor);
                } else {
                    // method name already declared
View Full Code Here

Examples of javax.ejb.TransactionAttribute

      }
   }
  
   protected static TransactionAttributeType getTxType(Advisor advisor, Method method)
   {
      TransactionAttribute tx = (TransactionAttribute) advisor.resolveAnnotation(method, TransactionAttribute.class);

      if (tx == null)
         tx = (TransactionAttribute) advisor.resolveAnnotation(TransactionAttribute.class);

      TransactionAttributeType value = TransactionAttributeType.REQUIRED;
      if (tx != null && tx.value() != null)
      {
         value = tx.value();
      }

      return value;
   }
View Full Code Here

Examples of javax.ejb.TransactionAttribute

      return containers;
   }
  
   protected void validateMDBTransactionAttribute(MDB mdb)
   {
      TransactionAttribute tx = (TransactionAttribute)mdb.resolveAnnotation(TransactionAttribute.class);
      if (tx != null)
      {
         TransactionAttributeType type = tx.value();
         if (type != TransactionAttributeType.REQUIRED && type != TransactionAttributeType.NOT_SUPPORTED)
            throw new RuntimeException("MDB " + mdb.getEjbName() + " has an invalid TransactionAttribute: " + type +
                  ". Only REQUIRED and NOT_SUPPORTED are valid");
      }
   }
View Full Code Here

Examples of org.jboss.ejb3.packagemanager.annotation.TransactionAttribute

    * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
    */
   @Override
   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
   {
      TransactionAttribute txAnnotation = this.getTxAttribute(method);
      // nothing special to do, just invoke
      if (txAnnotation == null)
      {
         return method.invoke(this.packageManager, args);
      }
      TransactionAttributeType txType = txAnnotation.value();
      switch (txType)
      {
         case REQUIRED :
            return this.invokeInCurrentTx(proxy, method, args);
         case REQUIRES_NEW :
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute

     * @param ae the annotated method or class
     * @return TransactionAttribute the configured transaction attribute, or <code>null</code> if none was found
     */
    protected TransactionAttribute determineTransactionAttribute(AnnotatedElement ae) {
      for (TransactionAnnotationParser annotationParser : this.annotationParsers) {
        TransactionAttribute attr = annotationParser.parseTransactionAnnotation(ae);
        if (attr != null) {
          return attr;
        }
      }
      return null;
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute

        } else {
          return (TransactionAttribute) cached;
        }
      } else {
        // We need to work it out.
        TransactionAttribute txAtt = computeTransactionAttribute(method, targetClass);
        // Put it in the cache.
        if (txAtt == null) {
          this.attributeCache.put(cacheKey, NULL_TRANSACTION_ATTRIBUTE);
        } else {
          if (logger.isDebugEnabled()) {
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute

      // If the target class is null, the method will be unchanged.
      Method specificMethod = ClassUtils.getMostSpecificMethod(method, userClass);
      // If we are dealing with method with generic parameters, find the original method.
      specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod);

      TransactionAttribute txAtt = null;

      if (specificMethod != method) {
        // Fallback is to look at the original method.
        txAtt = findTransactionAttribute(method);
        if (txAtt != null) {
View Full Code Here

Examples of org.springframework.transaction.interceptor.TransactionAttribute

  @Test
  public void usesCustomTransactionConfigurationOnInterface() throws SecurityException, NoSuchMethodException {

    CustomAnnotationTransactionAttributeSource source = new TransactionalRepositoryProxyPostProcessor.CustomAnnotationTransactionAttributeSource();

    TransactionAttribute attribute = source.getTransactionAttribute(Bar.class.getMethod("bar", Object.class),
        FooImpl.class);
    assertThat(attribute.isReadOnly(), is(false));

    attribute = source.getTransactionAttribute(Bar.class.getMethod("foo"), FooImpl.class);
    assertThat(attribute.isReadOnly(), is(false));
  }
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.