Package javax.ejb

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


                }
            } 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);
View Full Code Here

     */
    protected ApplicationException getApplicationException(final EasyBeansInvocationContext invocationContext,
            final Exception e) {
        Map<String, ApplicationException> applicationExceptions = invocationContext.getFactory().getBeanInfo()
                .getApplicationExceptions();
        ApplicationException appException = applicationExceptions.get(e.getClass().getName());
        if (appException != null) {
            return appException;
        }
        // If runtime exception, not an application by default
        if (e instanceof RuntimeException) {
View Full Code Here

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

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

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

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

            }
        } 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

   
    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

        }

        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

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.