Search in sources :

Example 1 with IOCException

use of jp.ossc.nimbus.ioc.IOCException in project nimbus by nimbus-org.

the class EJBDriveDispatcher method invokeUnitOfWorkBase.

/**
 * ユニットオブワークを実行する
 * @param uow		入力ユニットオブワーク
 * @return	出力ユニットオブワーク
 * @throws Throwable
 */
public UnitOfWork invokeUnitOfWorkBase(UnitOfWork uow) throws Exception {
    UnitOfWork retUow = FacadeValueAccess.createCommandsValue();
    boolean cmdErrFlg = false;
    // 配列分実行する
    if (this.getLogger() != null) {
        this.getLogger().write(IOC__00002);
    }
    for (int rcnt = 0; rcnt < uow.size(); rcnt++) {
        CommandBase tmp = uow.getCommand(rcnt);
        try {
            if (tmp.isCommand()) {
                if (!cmdErrFlg) {
                    if (mCommandInvokerRemote == null) {
                        mCommandInvokerRemote = mCommandInvokerHome.create();
                        if (this.getLogger() != null) {
                            this.getLogger().write(IOC__00001, "SLSBCommandHomeLocal get cmpleted.");
                        }
                    }
                    Command ret = this.mCommandInvokerRemote.invokeCommand((Command) tmp);
                    if (ret.getStatus() == CommandBase.C_STATUS_ERROR) {
                        if (this.getLogger() != null) {
                            this.getLogger().write("IOC__00020");
                        }
                        this.getContext().setRollbackOnly();
                        cmdErrFlg = true;
                    }
                    retUow.addCommand(ret);
                } else {
                    if (this.getLogger() != null) {
                        this.getLogger().write("IOC__00021");
                    }
                    retUow.addCommand((Command) tmp);
                }
            } else {
                if (this.getLogger() != null) {
                    this.getLogger().write("IOC__00015");
                }
                if (mUnitOfWorkInvokerRemote == null) {
                    mUnitOfWorkInvokerRemote = mUnitOfWorkInvokerHome.create();
                    if (this.getLogger() != null) {
                        this.getLogger().write(IOC__00001, "SLSBUnitOfWorkHomeLocal get cmpleted.");
                    }
                }
                UnitOfWork ret = this.mUnitOfWorkInvokerRemote.invokeUnitOfWork((UnitOfWork) tmp);
                retUow.addUnitOfWork(ret);
            }
        } catch (EJBException e) {
            if (this.getLogger() != null) {
                this.getLogger().write("IOC__00017", e.getCausedByException());
            }
            Exception ex = (Exception) e.getCausedByException();
            throw ex;
        } catch (Throwable e) {
            if (this.getLogger() != null) {
                this.getLogger().write("IOC__00017", e);
            }
            IOCException ex = new IOCException("EJBDispatcher#invokeUnitOfWorkBase Unrecognized Error ", e);
            throw ex;
        }
    }
    return retUow;
}
Also used : UnitOfWork(jp.ossc.nimbus.ioc.UnitOfWork) CommandBase(jp.ossc.nimbus.ioc.CommandBase) Command(jp.ossc.nimbus.ioc.Command) IOCException(jp.ossc.nimbus.ioc.IOCException) EJBException(javax.ejb.EJBException) NamingException(javax.naming.NamingException) InterceptorException(jp.ossc.nimbus.service.aspect.interfaces.InterceptorException) TargetUncheckedException(jp.ossc.nimbus.service.aspect.interfaces.TargetUncheckedException) TargetCheckedException(jp.ossc.nimbus.service.aspect.interfaces.TargetCheckedException) IOCException(jp.ossc.nimbus.ioc.IOCException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) CreateException(javax.ejb.CreateException)

Example 2 with IOCException

use of jp.ossc.nimbus.ioc.IOCException in project nimbus by nimbus-org.

the class EJBDriveDispatcher method invokeInterceptor.

/**
 * インターセプタを通してUnitOfWorkを実行する。
 * インターセプタが指定されていなければ直接UnitOfWorkを実行する。
 * @param input
 * @return 出力オブジェクト
 * @throws InterceptorException
 * @throws TargetCheckedException
 * @throws TargetUncheckedException
 */
public Object invokeInterceptor(Object input) throws InterceptorException, TargetCheckedException, TargetUncheckedException {
    Object ret = null;
    if (mFactory == null && chainFactory == null) {
        try {
            ret = (UnitOfWork) invokeUnitOfWorkBase((UnitOfWork) input);
        } catch (IOCException e) {
            throw new TargetUncheckedException(e.getCause());
        } catch (Throwable e) {
            if (this.getLogger() != null) {
                this.getLogger().write("IOC__00018", e);
            }
            throw new TargetUncheckedException(e);
        }
    } else {
        if (this.getLogger() != null) {
            this.getLogger().write("IOC__00004", this.getInterceptorKey());
        }
        if (mFactory != null) {
            InterceptorChainInvoker ici = this.mFactory.createInterceptorInvoker(this.getInterceptorKey());
            ret = ici.invokeChain(this, input);
        } else if (chainFactory != null) {
            try {
                InterceptorChain chain = chainFactory.getInterceptorChain(getInterceptorKey());
                ret = chain.invokeNext(createInvocationContext(input));
            } catch (TargetUncheckedException e) {
                throw e;
            } catch (TargetCheckedException e) {
                throw e;
            } catch (InterceptorException e) {
                throw e;
            } catch (RuntimeException e) {
                throw e;
            } catch (Exception e) {
                throw new IOCException(e);
            } catch (Throwable th) {
                if (th instanceof Error) {
                    throw (Error) th;
                }
            }
        }
    }
    return ret;
}
Also used : InterceptorChainInvoker(jp.ossc.nimbus.service.aspect.interfaces.InterceptorChainInvoker) InterceptorChain(jp.ossc.nimbus.service.aop.InterceptorChain) InterceptorException(jp.ossc.nimbus.service.aspect.interfaces.InterceptorException) IOCException(jp.ossc.nimbus.ioc.IOCException) TargetUncheckedException(jp.ossc.nimbus.service.aspect.interfaces.TargetUncheckedException) TargetCheckedException(jp.ossc.nimbus.service.aspect.interfaces.TargetCheckedException) NamingException(javax.naming.NamingException) InterceptorException(jp.ossc.nimbus.service.aspect.interfaces.InterceptorException) TargetUncheckedException(jp.ossc.nimbus.service.aspect.interfaces.TargetUncheckedException) TargetCheckedException(jp.ossc.nimbus.service.aspect.interfaces.TargetCheckedException) IOCException(jp.ossc.nimbus.ioc.IOCException) RemoteException(java.rmi.RemoteException) EJBException(javax.ejb.EJBException) CreateException(javax.ejb.CreateException)

Aggregations

RemoteException (java.rmi.RemoteException)2 CreateException (javax.ejb.CreateException)2 EJBException (javax.ejb.EJBException)2 NamingException (javax.naming.NamingException)2 IOCException (jp.ossc.nimbus.ioc.IOCException)2 InterceptorException (jp.ossc.nimbus.service.aspect.interfaces.InterceptorException)2 TargetCheckedException (jp.ossc.nimbus.service.aspect.interfaces.TargetCheckedException)2 TargetUncheckedException (jp.ossc.nimbus.service.aspect.interfaces.TargetUncheckedException)2 Command (jp.ossc.nimbus.ioc.Command)1 CommandBase (jp.ossc.nimbus.ioc.CommandBase)1 UnitOfWork (jp.ossc.nimbus.ioc.UnitOfWork)1 InterceptorChain (jp.ossc.nimbus.service.aop.InterceptorChain)1 InterceptorChainInvoker (jp.ossc.nimbus.service.aspect.interfaces.InterceptorChainInvoker)1