Examples of TransactionAttributeType


Examples of javax.ejb.TransactionAttributeType

     * Adds the right transaction interceptor depending of the transactional
     * attribute set by the user.
     * @param bean the given bean on which set the transactional interceptor.
     */
    public static void resolve(final EasyBeansEjbJarClassMetadata bean) {
        TransactionAttributeType beanTxType = bean.getTransactionAttributeType();
        TransactionManagementType beanTxManaged = bean.getTransactionManagementType();


        // Checks if Synchronization is needed for this stateful bean
        boolean addSynchro = false;
        if (bean.isStateful()) {
                String[] interfaces = bean.getInterfaces();
                if (interfaces != null) {
                        for (String itf : interfaces) {
                            if (SESSION_SYNCHRONIZATION_INTERFACE.equals(itf)) {
                                addSynchro = true;
                                break;
                            }
                        }
                }

        }

        for (EasyBeansEjbJarMethodMetadata method : bean.getMethodMetadataCollection()) {

            List<? extends IJClassInterceptor> previousInterceptors = method.getInterceptors();

            List<IJClassInterceptor> interceptors = new ArrayList<IJClassInterceptor>();
            if (previousInterceptors != null) {
                interceptors.addAll(previousInterceptors);
            }

            // Bean managed or container managed ?
            if (beanTxManaged.equals(BEAN)) {
                // BMT
                if (bean.isStateful()) {
                    interceptors.add(new JClassInterceptor(BMT_STATEFUL_INTERCEPTOR, EASYBEANS_INTERCEPTOR));
                } else if (bean.isStateless()) {
                    interceptors.add(new JClassInterceptor(BMT_STATELESS_INTERCEPTOR, EASYBEANS_INTERCEPTOR));
                } else {
                    interceptors.add(new JClassInterceptor(BMT_INTERCEPTOR, EASYBEANS_INTERCEPTOR));
                }
            } else {
                // CMT
                TransactionAttributeType methodTx = method.getTransactionAttributeType();

                // Set method tx attribute to the class tx attribute if none was
                // set.
                if (methodTx == null) {
                    if (!method.isInherited()) {
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

   
  private void setPatternTransaction(EjbMethodPattern<X> pattern,
                                     TransactionAttribute xa)
    throws ConfigException
  {
    TransactionAttributeType xaType = xa.value();

    pattern.setTransaction(xaType);
  }
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

      = method.getAnnotation(TransactionAttribute.class);
   
    TransactionAttribute xaClassAttr
      = method.getDeclaringType().getAnnotation(TransactionAttribute.class);
   
    TransactionAttributeType xaType = null;
   
    if (xaClassAttr != null)
      xaType = xaClassAttr.value();
   
    if (xaAttr != null)
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

   @Override
   public TransactionAttributeType getTransactionAttribute()
   {
      TransactionAttribute tx = (TransactionAttribute) getAdvisor().resolveAnnotation(TransactionAttribute.class);
     
      TransactionAttributeType value = TransactionAttributeType.REQUIRED;
      if (tx != null && tx.value() != null)
      {
         value = tx.value();
      }
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

      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();
      }
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

      int timeout = resolveTransactionTimeout(advisor, method);

      if (policy == null);
         super.initialize();

      TransactionAttributeType txType = getTxType(advisor, jp);
     
      if (txType.equals(TransactionAttributeType.NEVER))
      {
         // make sure we use the EJB3 interceptor, not the AOP one.
         return new TxInterceptor.Never(tm, policy);
      }
      else if (txType.equals(TransactionAttributeType.REQUIRED))
      {
         return new TxInterceptor.Required(tm, policy, timeout);
      }
      else if (txType.equals(TransactionAttributeType.REQUIRES_NEW))
      {
         return new TxInterceptor.RequiresNew(tm, policy, timeout);
      }
      else if(txType.equals(TransactionAttributeType.NOT_SUPPORTED))
      {
         return new TxInterceptor.NotSupported(tm, policy, timeout);
      }
      else if(txType.equals(TransactionAttributeType.MANDATORY))
      {
         return new TxInterceptor.Mandatory(tm, policy, timeout);
      }
      else if(txType.equals(TransactionAttributeType.SUPPORTS))
      {
         return new TxInterceptor.Supports(tm, policy, timeout);
      }
      else
      {
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

    * @return the method transaction type
    */
   public TransactionAttributeType getMethodTransactionType(String methodName, Class<?>[] params, MethodInterfaceType iface)
   {
      // default value
      TransactionAttributeType result = null;

      ContainerTransactionsMetaData containerTransactions = getContainerTransactions();
      if (containerTransactions == null || containerTransactions.isEmpty())
         return result;

View Full Code Here

Examples of javax.ejb.TransactionAttributeType

   public TransactionAttributeType getMethodTransactionType(Method m, MethodInterfaceType iface)
   {
      if (m == null)
         return TransactionAttributeType.SUPPORTS;

      TransactionAttributeType result = null;
      if (methodTx != null)
      {
         result = methodTx.get(m);
         if (result != null)
            return result;
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

   }

   @Override
   public TransactionAttributeType unmarshal(String string) throws Exception
   {
      TransactionAttributeType type = TransactionAttributeType.REQUIRED;
      if(string.equals("NotSupported"))
         type = TransactionAttributeType.NOT_SUPPORTED;
      else if(string.equals("Supports"))
         type = TransactionAttributeType.SUPPORTS;
      else if(string.equals("RequiresNew"))
View Full Code Here

Examples of javax.ejb.TransactionAttributeType

    * @return the method transaction type
    */
   public TransactionAttributeType getMethodTransactionType(String methodName, Class<?>[] params, MethodInterfaceType iface)
   {
      // default value
      TransactionAttributeType result = null;

      ContainerTransactionsMetaData containerTransactions = getContainerTransactions();
      if (containerTransactions == null || containerTransactions.isEmpty())
         return result;

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.