Package javax.ejb

Examples of javax.ejb.ApplicationException


/* 45 */     throw new EJBTransactionRequiredException(((MethodInvocation)invocation).getActualMethod().toString());
/*    */   }
/*    */
/*    */   public void handleExceptionInOurTx(Invocation invocation, Throwable t, Transaction tx) throws Throwable
/*    */   {
/* 50 */     ApplicationException ae = TxUtil.getApplicationException(t.getClass(), invocation);
/* 51 */     if (ae != null)
/*    */     {
/* 53 */       if (ae.rollback()) setRollbackOnly(tx);
/* 54 */       throw t;
/*    */     }
/* 56 */     if ((!(t instanceof RuntimeException)) && (!(t instanceof RemoteException)))
/*    */     {
/* 58 */       throw t;
View Full Code Here


/* 65 */     throw t;
/*    */   }
/*    */
/*    */   public void handleInCallerTx(Invocation invocation, Throwable t, Transaction tx) throws Throwable
/*    */   {
/* 70 */     ApplicationException ae = TxUtil.getApplicationException(t.getClass(), invocation);
/*    */
/* 72 */     if (ae != null)
/*    */     {
/* 74 */       if (ae.rollback()) setRollbackOnly(tx);
/* 75 */       throw t;
/*    */     }
/* 77 */     if ((!(t instanceof RuntimeException)) && (!(t instanceof RemoteException)))
/*    */     {
/* 79 */       throw t;
View Full Code Here

        if (exceptionClassName == null || exceptionClassName.isEmpty()) {
            throw new IllegalArgumentException("Invalid exception class name: " + exceptionClassName);
        }
        //TODO: Is this a good idea? ApplicationException's equals/hashCode
        //will not work the way that would be expected
        ApplicationException appException = new ApplicationException() {
            @Override
            public boolean inherited() {
                return inherited;
            }
View Full Code Here

            /*
             * @ApplicationException
             */
            for (Method method : clazz.getMethods()) {
                for (Class<?> exception : method.getExceptionTypes()) {
                    ApplicationException annotation = exception.getAnnotation(ApplicationException.class);
                    if (annotation == null) continue;
                    if (assemblyDescriptor.getApplicationException(exception) != null) {
                        mergeApplicationExceptionAnnotation(assemblyDescriptor, exception, annotation);
                    } else {
                        logger.debug("Found previously undetected application exception {0} listed on a method {1} with annotation {2}", method, exception, annotation);
                        assemblyDescriptor.addApplicationException(exception, annotation.rollback(), annotation.inherited());
                    }
                }
            }
        }
View Full Code Here

            startupLogger.debug("Searching for annotated application exceptions (see OPENEJB-980)");
            List<Class<?>> appExceptions = finder.findAnnotatedClasses(ApplicationException.class);
            for (Class<?> exceptionClass : appExceptions) {
                startupLogger.debug("...handling " + exceptionClass);
                ApplicationException annotation = exceptionClass.getAnnotation(ApplicationException.class);
                if (assemblyDescriptor.getApplicationException(exceptionClass) == null) {
                    startupLogger.debug("...adding " + exceptionClass + " with rollback=" + annotation.rollback());
                    assemblyDescriptor.addApplicationException(exceptionClass, annotation.rollback(), annotation.inherited());
                } else {
                    mergeApplicationExceptionAnnotation(assemblyDescriptor, exceptionClass, annotation);
                }
            }
View Full Code Here

        if (aeHandler instanceof EjbBundleContext) {
            EjbBundleContext ejbBundleContext = (EjbBundleContext)aeHandler;
           
            EjbBundleDescriptor ejbBundle = ejbBundleContext.getDescriptor();

            ApplicationException appExcAnn = (ApplicationException) annotation;

            EjbApplicationExceptionInfo appExcInfo = new
                EjbApplicationExceptionInfo();
            Class annotatedClass = (Class) ae;
            appExcInfo.setExceptionClassName(annotatedClass.getName());
            appExcInfo.setRollback(appExcAnn.rollback());
            appExcInfo.setInherited(appExcAnn.inherited());

            // Set on descriptor unless the same application exception was defined
            // in ejb-jar.xml
            if( !ejbBundle.getApplicationExceptions().containsKey(annotatedClass.getName()) ) {
                ejbBundle.addApplicationException(appExcInfo);
View Full Code Here

  public void generateApplicationException(JavaWriter out, Class<?> exception)
      throws IOException
  {
    super.generateApplicationException(out, exception);

    ApplicationException applicationException = exception
        .getAnnotation(ApplicationException.class);

    if ((applicationException != null) && (applicationException.rollback())) {
      if (_isContainerManaged && (_transactionType != NOT_SUPPORTED)) {
        out.println("if (_xa.getTransaction() != null)");
        out.println("  _xa.markRollback(e);");
      }
    } else if (_isContainerManaged
View Full Code Here

            /*
             * @ApplicationException
             */
            for (Method method : clazz.getMethods()) {
                for (Class<?> exception : method.getExceptionTypes()) {
                    ApplicationException annotation = exception.getAnnotation(ApplicationException.class);
                    if (annotation == null) continue;
                    if (assemblyDescriptor.getApplicationException(exception) != null) {
                        mergeApplicationExceptionAnnotation(assemblyDescriptor, exception, annotation);
                    } else {
                        logger.debug("Found previously undetected application exception {0} listed on a method {1} with annotation {2}", method, exception, annotation);
                        assemblyDescriptor.addApplicationException(exception, annotation.rollback(), annotation.inherited());
                    }
                }
            }
        }
View Full Code Here

            startupLogger.debug("Searching for annotated application exceptions (see OPENEJB-980)");
            List<Class<?>> appExceptions = finder.findAnnotatedClasses(ApplicationException.class);
            for (Class<?> exceptionClass : appExceptions) {
                startupLogger.debug("...handling " + exceptionClass);
                ApplicationException annotation = exceptionClass.getAnnotation(ApplicationException.class);
                if (assemblyDescriptor.getApplicationException(exceptionClass) == null) {
                    startupLogger.debug("...adding " + exceptionClass + " with rollback=" + annotation.rollback());
                    assemblyDescriptor.addApplicationException(exceptionClass, annotation.rollback(), annotation.inherited());
                } else {
                    mergeApplicationExceptionAnnotation(assemblyDescriptor, exceptionClass, annotation);
                }
            }
View Full Code Here

TOP

Related Classes of javax.ejb.ApplicationException

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.