Package javax.ejb

Examples of javax.ejb.TransactionAttributeType


      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


    @Before(TRANSACTED_METHODS_POINTCUT)
    public void enterTransactedMethod(final StaticJoinPoint jp) throws Throwable {

        final MethodSignature sig = (MethodSignature)jp.getSignature();
        final Class declaringType = sig.getDeclaringType();        final Method method = sig.getMethod();
        final TransactionAttributeType txType = getTransactionAttributeTypeFor(declaringType, method);

        final TransactionManager tm = getTransactionManager();

        switch(txType) {
            case REQUIRED:
View Full Code Here

    @Before(TRANSACTED_METHODS_POINTCUT)
    public void enterTransactedMethod(final StaticJoinPoint jp) throws Throwable {

        final MethodSignature sig = (MethodSignature)jp.getSignature();
        final Class declaringType = sig.getDeclaringType();        final Method method = sig.getMethod();
        final TransactionAttributeType txType = getTransactionAttributeTypeFor(declaringType, method);

        final TransactionManager tm = getTransactionManager();

        switch(txType) {
            case REQUIRED:
View Full Code Here

   @AroundInvoke
   public Object invoke(InvocationContext invocation) throws Exception
   {
      Method invokedMethod = invocation.getMethod();
      TransactionAttributeType txAttr = this.getTransactionalComponent().getTransactionAttributeType(invokedMethod);
      switch (txAttr)
      {
         case MANDATORY:
            return mandatory(invocation);
         case NEVER:
View Full Code Here

        if (sessionBean.getTransactionType() != TransactionManagementType.BEAN) {
            ContainerTransactionsMetaData containerTransactions = sessionBean.getContainerTransactions();
            if (containerTransactions != null && !containerTransactions.isEmpty()) {
                final String className = null; // applies to any class
                for (ContainerTransactionMetaData containerTx : containerTransactions) {
                    TransactionAttributeType txAttr = containerTx.getTransAttribute();
                    MethodsMetaData methods = containerTx.getMethods();
                    for (MethodMetaData method : methods) {
                        String methodName = method.getMethodName();
                        MethodIntf methodIntf = this.getMethodIntf(method.getMethodIntf());
                        if (methodName.equals("*")) {
View Full Code Here

        assert methodIntf != null : "methodIntf is null";
        assert methodName != null : "methodName is null";
        assert methodParams != null : "methodParams is null";

        ArrayKey methodParamsKey = new ArrayKey((Object[]) methodParams);
        TransactionAttributeType txAttr = get(get(get(txPerViewStyle3, methodIntf), methodName), methodParamsKey);
        if (txAttr != null)
            return txAttr;
        txAttr = get(get(txPerViewStyle2, methodIntf), methodName);
        if (txAttr != null)
            return txAttr;
View Full Code Here

        if (annotations == null)
            return;

        for (AnnotationInstance annotationInstance : annotations) {
            AnnotationTarget target = annotationInstance.target();
            TransactionAttributeType transactionAttributeType = TransactionAttributeType.valueOf(annotationInstance.value().asEnum());
            if (target instanceof ClassInfo) {
                // Style 1
                final String className = target.toString();
                componentDescription.setTransactionAttribute(methodIntf, methodIntf == null ? className : null, transactionAttributeType);
            } else if (target instanceof MethodInfo) {
View Full Code Here

        if (perMethodIntf == null)
            throw new IllegalStateException("Can't find tx attrs for view type " + methodIntf + " on bean named " + this.getComponentName());
        ConcurrentMap<ArrayKey, TransactionAttributeType> perMethod = perMethodIntf.get(method.getName());
        if (perMethod == null)
            throw new IllegalStateException("Can't find tx attrs for method name " + method.getName() + " on view type " + methodIntf + " on bean named " + this.getComponentName());
        TransactionAttributeType txAttr = perMethod.get(new ArrayKey((Object[]) method.getParameterTypes()));
        if (txAttr == null)
            throw new IllegalStateException("Can't find tx attr for method " + method + " on view type " + methodIntf + " on bean named " + this.getComponentName());
        return txAttr;
    }
View Full Code Here

            getConfigurators().add(new ComponentConfigurator() {
                @Override
                public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException {

                    if(getClassDescription().getPostConstructMethod() != null) {
                        TransactionAttributeType txAttr = getTransactionAttribute(MethodIntf.BEAN, getClassDescription().getClassName(), getClassDescription().getPostConstructMethod().getName(), getClassDescription().getPostConstructMethod().getParameterTypes());
                        configuration.addPostConstructInterceptor(new SingletonLifecycleCMTTxInterceptorFactory(txAttr), InterceptorOrder.ComponentPostConstruct.TRANSACTION_INTERCEPTOR);
                    }
                    if(getClassDescription().getPreDestroyMethod() != null) {
                        TransactionAttributeType txAttr = getTransactionAttribute(MethodIntf.BEAN, getClassDescription().getClassName(), getClassDescription().getPreDestroyMethod().getName(), getClassDescription().getPreDestroyMethod().getParameterTypes());
                        configuration.addPreDestroyInterceptor(new SingletonLifecycleCMTTxInterceptorFactory(txAttr), InterceptorOrder.ComponentPreDestroy.TRANSACTION_INTERCEPTOR);
                    }
                }
            });
        } else {
View Full Code Here

            return;
        }

        String className = method.getDeclaringClass().getName();
        String methodName = method.getName();
        TransactionAttributeType txAttr = ejbComponentDescription.getTransactionAttribute(methodIntf, className, methodName, toString(method.getParameterTypes()));

        ConcurrentMap<String, ConcurrentMap<ArrayKey, TransactionAttributeType>> perMethodIntf = this.txAttrs.get(methodIntf);
        if (perMethodIntf == null) {
            perMethodIntf = new ConcurrentHashMap<String, ConcurrentMap<ArrayKey, TransactionAttributeType>>();
            this.txAttrs.put(methodIntf, perMethodIntf);
View Full Code Here

TOP

Related Classes of javax.ejb.TransactionAttributeType

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.