Package javax.ejb

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


    }

    protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
            EjbContext[] ejbContexts) throws AnnotationProcessorException {
       
        TransactionAttribute taAn =
            (TransactionAttribute) ainfo.getAnnotation();

        for (EjbContext ejbContext : ejbContexts) {
            EjbDescriptor ejbDesc = (EjbDescriptor) ejbContext.getDescriptor();
            ContainerTransaction containerTransaction =
                getContainerTransaction(taAn.value());

            if (ElementType.TYPE.equals(ainfo.getElementType())) {
                ejbContext.addPostProcessInfo(ainfo, this);
            } else {
                Method annMethod = (Method) ainfo.getAnnotatedElement();
View Full Code Here

     * methods that don't have a value.
     */
    public void postProcessAnnotation(AnnotationInfo ainfo, EjbContext ejbContext)
            throws AnnotationProcessorException {
        EjbDescriptor ejbDesc = (EjbDescriptor) ejbContext.getDescriptor();
        TransactionAttribute taAn =
            (TransactionAttribute) ainfo.getAnnotation();
        ContainerTransaction containerTransaction =
            getContainerTransaction(taAn.value());
        Class classAn = (Class)ainfo.getAnnotatedElement();

        Set txBusMethods = ejbDesc.getTxBusinessMethodDescriptors();
        for (Object mdObj : txBusMethods) {
            MethodDescriptor md = (MethodDescriptor)mdObj;
View Full Code Here

     * @param klass
     * @param method
     * @return the TX type
     */
    public static TransactionAttributeType getTransactionAttributeTypeFor(final Class klass, final Method method) {
        TransactionAttribute tx = method.getAnnotation(TransactionAttribute.class);
        if (tx == null) {
            tx = (TransactionAttribute) klass.getAnnotation(TransactionAttribute.class);
        }
        if (tx != null) {
            return tx.value();
        } else {
            return REQUIRED; // default for CMT components - EJB3/9.4
        }
    }
View Full Code Here

/* 64 */     return annotation.value();
/*    */   }
/*    */
/*    */   public void process(T bean, E element)
/*    */   {
/* 69 */     TransactionAttribute annotation = (TransactionAttribute)this.finder.getAnnotation(element, TransactionAttribute.class);
/* 70 */     if (annotation == null) {
/* 71 */       return;
/*    */     }
/* 73 */     IEjbJarMetaData ejbJarMetaData = bean.getEjbJarMetaData();
/*    */
View Full Code Here

/*     */   private static final String TX_TYPE_NEVER = "NEVER";
/*     */
/*     */   protected String resolveTxType(Advisor advisor, Joinpoint jp)
/*     */   {
/*  58 */     Method method = ((MethodJoinpoint)jp).getMethod();
/*  59 */     TransactionAttribute tx = (TransactionAttribute)advisor.resolveAnnotation(method, TransactionAttribute.class);
/*     */
/*  61 */     if (tx == null) {
/*  62 */       tx = (TransactionAttribute)advisor.resolveAnnotation(TransactionAttribute.class);
/*     */     }
/*  64 */     String value = "REQUIRED";
/*  65 */     if (tx != null)
/*     */     {
/*  67 */       TransactionAttributeType type = tx.value();
/*     */
/*  69 */       if (type == null)
/*     */       {
/*  71 */         value = "REQUIRED";
/*     */       }
View Full Code Here

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

/*     */     throws NoSuchMethodException
/*     */   {
/* 168 */     TransactionManagementType mtype = TxUtil.getTransactionManagementType(this.container);
/* 169 */     if (mtype == TransactionManagementType.BEAN) return false;
/*     */
/* 172 */     TransactionAttribute attr = (TransactionAttribute)this.container.resolveAnnotation(method, TransactionAttribute.class);
/* 173 */     if (attr == null)
/*     */     {
/* 175 */       attr = (TransactionAttribute)this.container.resolveAnnotation(TransactionAttribute.class);
/*     */     }
/* 177 */     TransactionAttributeType type = TransactionAttributeType.REQUIRED;
/* 178 */     if (attr != null) type = attr.value();
/* 179 */     return type == TransactionAttributeType.REQUIRED;
/*     */   }
View Full Code Here

      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

  private void fillClassDefaults(ApiClass ejbClass) {
    if (!_isContainerTransaction) {
      ejbClass.addAnnotation(XaAnnotation.createBeanManaged());
    }

    TransactionAttribute ann = ejbClass
        .getAnnotation(TransactionAttribute.class);

    if (ann == null) {
      // ejb/1100
      ejbClass.addAnnotation(XaAnnotation.create(REQUIRED));
View Full Code Here

TOP

Related Classes of javax.ejb.TransactionAttribute

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.