Examples of ApplicationException


Examples of javax.ejb.ApplicationException

     * @param e the exception to handle
     * @throws Exception when handling the exception.
     */
    protected void handleBeanManagedException(final EasyBeansInvocationContext invocationContext, final Exception e)
            throws Exception {
        ApplicationException applicationException = getApplicationException(invocationContext, e);

        // it is an application exception
        if (applicationException != null) {
            // Re-throw AppException.
            throw e;
View Full Code Here

Examples of javax.ejb.ApplicationException

     * @throws Exception when handling the exception.
     */
    protected void handleUnspecifiedTransactionContext(final EasyBeansInvocationContext invocationContext,
            final Exception e) throws Exception {

        ApplicationException applicationException = getApplicationException(invocationContext, e);

        // it is an application exception
        if (applicationException != null) {
            // Re-throw AppException.
            throw e;
View Full Code Here

Examples of javax.ejb.ApplicationException

     * @param e the exception to handle
     * @throws Exception when handling the exception.
     */
    protected void handleContextClientTransaction(final EasyBeansInvocationContext invocationContext, final Exception e)
            throws Exception {
        ApplicationException applicationException = getApplicationException(invocationContext, e);

        // An application exception ?
        if (applicationException != null) {
            /*
             * Re-throw AppException. Mark the transaction for rollback if the
             * application exception is specified as causing rollback.
             */

            // Mark the transaction for rollback.
            if (applicationException.rollback()) {
                markTransactionRollback();
            }

            // rethrow
            throw e;
View Full Code Here

Examples of javax.ejb.ApplicationException

     * @throws Exception when handling the exception.
     */
    protected void handleContextContainerTransaction(final EasyBeansInvocationContext invocationContext,
            final Exception e) throws Exception {

        ApplicationException applicationException = getApplicationException(invocationContext, e);

        // An application exception ?
        if (applicationException != null) {
            /*
             * If the instance called setRollback-Only(), then rollback the
             * transaction, and re-throw AppException.
             */
            if (isMarkedRollbackOnly()) {
                rollback();
                throw e;
            }

            /*
             * Mark the transaction for rollback if the application exception is
             * specified as causing rollback, and then re-throw AppException.
             * Otherwise, attempt to commit the transaction, and then re-throw
             * AppException.
             */
            if (applicationException.rollback()) {
                // TODO: rollback or mark rollback ??
                rollback();
            } else {
                commit();
            }
View Full Code Here

Examples of javax.ejb.ApplicationException

            }
        } catch (InvocationTargetException e) {
            Throwable cause = e.getCause();
            RPCException rpcException = new RPCException(cause);
            // ApplicationException ?
            ApplicationException applicationException = getBeanInfo().getApplicationExceptions().get(cause.getClass().getName());
            if (applicationException != null) {
                rpcException.setApplicationException();
            }
            ejbResponse.setRPCException(rpcException);
            if (enabledEvent) {
View Full Code Here

Examples of javax.ejb.ApplicationException

   
    if (cfg != null) {
      return new AppExceptionItem(true, cfg.isRollback(), cfg.isInherited());
    }
   
    ApplicationException appExn = exn.getAnnotation(ApplicationException.class);
   
    if (appExn != null) {
      // ejb/1276
      return new AppExceptionItem(true, appExn.rollback(), appExn.inherited());
    }
   
    AppExceptionItem parentItem = getApplicationException(exn.getSuperclass(),
                                                          isSystem);
View Full Code Here

Examples of javax.ejb.ApplicationException

        }

        private void processApplicationExceptions(Class<?> clazz, AssemblyDescriptor assemblyDescriptor) {
            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

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

Examples of javax.ejb.ApplicationException

            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

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) {
                        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
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.