Package javax.ejb

Examples of javax.ejb.ApplicationException


            /*
             * @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) continue;
                    assemblyDescriptor.addApplicationException(exception, annotation.rollback());
                }
            }
        }
View Full Code Here


      }

      // Everything after this line is a hack.

      // TODO: we have no facility that picks up annotations from shared libs, so lets do some emergency annotation scanning.
      ApplicationException annotation = exceptionType.getAnnotation(ApplicationException.class);
      if(annotation != null)
         return annotation;
     
      // An unchecked-exception is only an application exception if annotated (or described) as such.
      // (see EJB 3.1 FR 14.2.1)
View Full Code Here

                if (ejbJar.getAssemblyDescriptor() == null) {
                    ejbJar.setAssemblyDescriptor(new AssemblyDescriptor());
                }
            }
            for (Class<?> exceptionClass : classes) {
                ApplicationException annotation = exceptionClass.getAnnotation(ApplicationException.class);
                org.apache.openejb.jee.ApplicationException exception = new org.apache.openejb.jee.ApplicationException(exceptionClass.getName(), annotation.rollback());
                ejbJar.getAssemblyDescriptor().getApplicationException().add(exception);
            }

            return ejbModule;
        }
View Full Code Here

      }

      // Everything after this line is a hack.

      // TODO: we have no facility that picks up annotations from shared libs, so lets do some emergency annotation scanning.
      ApplicationException annotation = exceptionType.getAnnotation(ApplicationException.class);
      if(annotation != null)
         return annotation;
     
      // An unchecked-exception is only an application exception if annotated (or described) as such.
      // (see EJB 3.1 FR 14.2.1)
View Full Code Here

    * @param ex The exception to handle
    * @throws Exception Either the passed exception or an EJBException
    */
   protected Exception handleException(TransactionalInvocationContext invocation, Exception ex) throws Exception
   {
      ApplicationException ae = invocation.getApplicationException(ex.getClass());
      // it's an application exception, so just throw it back as-is
      if (ae != null)
      {
         throw ex;
      }
View Full Code Here

      throw new EJBException(e);
   }

   protected void handleInCallerTx(TransactionalInvocationContext invocation, Throwable t, Transaction tx) throws Exception
   {
      ApplicationException ae = invocation.getApplicationException(t.getClass());

      if (ae != null)
      {
         if (ae.rollback()) setRollbackOnly(tx);
         // an app exception can never be an Error
         throw (Exception) t;
      }

      // if it's not EJBTransactionRolledbackException
View Full Code Here

      throw (Exception) t;
   }

   public void handleExceptionInOurTx(TransactionalInvocationContext invocation, Throwable t, Transaction tx) throws Exception
   {
      ApplicationException ae = invocation.getApplicationException(t.getClass());
      if (ae != null)
      {
         if (ae.rollback()) setRollbackOnly(tx);
         throw (Exception) t;
      }

      // if it's neither EJBException nor RemoteException
      if(!(t instanceof EJBException || t instanceof RemoteException))
View Full Code Here

            /*
             * @ApplicationException
             */
            for (final Method method : clazz.getMethods()) {
                for (final Class<?> exception : method.getExceptionTypes()) {
                    final 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)");
            final List<Class<?>> appExceptions = finder.findAnnotatedClasses(ApplicationException.class);
            for (final Class<?> exceptionClass : appExceptions) {
                startupLogger.debug("...handling " + exceptionClass);
                final 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

                ejbModule.getEjbJar().setAssemblyDescriptor(assemblyDescriptor);
            }

            for (Class<?> exceptionClass : finder.findAnnotatedClasses(ApplicationException.class)) {
                if (assemblyDescriptor.getApplicationException(exceptionClass) == null) {
                    ApplicationException annotation = exceptionClass.getAnnotation(ApplicationException.class);
                    assemblyDescriptor.addApplicationException(exceptionClass, annotation.rollback());
                }
            }

            ejbModule.getFinderReference().set(finder);
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.