Package javax.ejb

Examples of javax.ejb.ApplicationException


                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());
                }
            }

            return ejbModule;
        }
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

            /*
             * @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

      throw t;
   }

   public void handleInCallerTx(Invocation invocation, Throwable t, Transaction tx) throws Throwable
   {
      ApplicationException ae = TxUtil.getApplicationException(t.getClass(), invocation);
  
      if (ae != null)
      {
         if (ae.rollback()) setRollbackOnly(tx);
         throw t;
      }
     
      // if it's not EJBTransactionRolledbackException
      if(!(t instanceof EJBTransactionRolledbackException))
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;
     
      // This feels like a hack around shortcomings in jboss-metadata
      Class[] exceptionTypes = invokedMethod.getExceptionTypes();
View Full Code Here

      EJBContainer container = (EJBContainer) containers.get(0);
      Stateful annotation = ((EJBContainer) containers.get(0)).getAnnotation(Stateful.class);
      assertNotNull("Can't find annotation @Stateful on the container", annotation);
     
      //ApplicationException ex = container.getAnnotation(ApplicationException.class, DummyException.class);
      ApplicationException ex = ExtendedAdvisorHelper.getExtendedAdvisor(container.getAdvisor()).resolveAnnotation(DummyException.class, ApplicationException.class);
      assertNotNull("Can't find annotation @ApplicationException in the meta data", ex);
   }
View Full Code Here

      super(finder);
   }

   public ApplicationExceptionMetaData create(Class<?> element)
   {
      ApplicationException annotation = finder.getAnnotation(element, ApplicationException.class);
      if(annotation == null)
         return null;
     
      if(!Exception.class.isAssignableFrom(element))
         throw new IllegalArgumentException("ApplicationException is only valid on an Exception");
     
      ApplicationExceptionMetaData metaData = new ApplicationExceptionMetaData();
      metaData.setExceptionClass(element.getName());
      metaData.setRollback(annotation.rollback());
     
      return metaData;
   }
View Full Code Here

   {
      if (ex == null)
      {
         return;
      }
      ApplicationException ae = this.getTransactionalComponent().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(InvocationContext invocation, Throwable t, Transaction tx) throws Exception
   {
      ApplicationException ae = this.getApplicationException(t.getClass());
      if (ae != null)
      {
         if (ae.rollback())
         {
            setRollbackOnly(tx);
         }
         // an app exception can never be an Error
         throw (Exception) t;
View Full Code Here

      throw (Exception) t;
   }

   protected void handleExceptionInOurTx(InvocationContext invocation, Throwable t, Transaction tx) throws Exception
   {
      ApplicationException ae = this.getApplicationException(t.getClass());
      if (ae != null)
      {
         if (ae.rollback())
         {
            setRollbackOnly(tx);
         }
         throw (Exception) t;
      }
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.