Search in sources :

Example 1 with InterceptorChainFactory

use of jp.ossc.nimbus.service.aop.InterceptorChainFactory in project nimbus by nimbus-org.

the class EJBDriveDispatcher method init.

/**
 * EJBローカルを取得する。
 * @param unitOfWorkKey
 * @param commandKey
 * @param intercetorFactrySvcName
 * @param interceptorCreateKey
 * @param loggerServiceName
 * @throws NamingException
 * @throws CreateException
 * @throws RemoteException
 */
public void init(String unitOfWorkKey, String commandKey, String intercetorFactrySvcName, String interceptorCreateKey, String loggerServiceName) throws NamingException, CreateException {
    InitialContext ctx = new InitialContext();
    String value = null;
    // Logger
    try {
        value = (String) ctx.lookup(loggerServiceName);
    } catch (NamingException e) {
    }
    if (value == null || value.length() == 0) {
        this.mLogger = null;
    } else {
        ServiceName serviceName = UtilTool.convertServiceName(value);
        this.mLogger = (Logger) ServiceManagerFactory.getService(serviceName);
    }
    // ユニットオブワークLocal取得
    value = (String) ctx.lookup(unitOfWorkKey);
    mUnitOfWorkInvokerHome = (SLSBUnitOfWorkHomeLocal) ctx.lookup(value);
    // コマンドLocal取得
    value = (String) ctx.lookup(commandKey);
    mCommandInvokerHome = (SLSBCommandHomeLocal) ctx.lookup(value);
    // インターセプターファクトリ取得
    value = (String) ctx.lookup(intercetorFactrySvcName);
    if (value == null || value.length() == 0) {
        mFactory = null;
    } else {
        ServiceName serviceName = UtilTool.convertServiceName(value);
        Object factory = ServiceManagerFactory.getService(serviceName);
        if (factory instanceof InterceptorChainInvokerFactory) {
            mFactory = (InterceptorChainInvokerFactory) factory;
        } else if (factory instanceof InterceptorChainFactory) {
            chainFactory = (InterceptorChainFactory) factory;
        }
        // interceptor Factory Key
        value = (String) ctx.lookup(interceptorCreateKey);
        mInterceptorKey = value;
    }
    if (this.getLogger() != null) {
        this.getLogger().write(IOC__00001, "InterceptorChainInvokerFactory get completed.");
    }
}
Also used : InterceptorChainInvokerFactory(jp.ossc.nimbus.service.aspect.interfaces.InterceptorChainInvokerFactory) ServiceName(jp.ossc.nimbus.core.ServiceName) NamingException(javax.naming.NamingException) InterceptorChainFactory(jp.ossc.nimbus.service.aop.InterceptorChainFactory) InitialContext(javax.naming.InitialContext)

Example 2 with InterceptorChainFactory

use of jp.ossc.nimbus.service.aop.InterceptorChainFactory in project nimbus by nimbus-org.

the class SLSBCommandBean method ejbCreate.

/**
 * EJBを作成する。
 * @throws javax.ejb.CreateException
 */
public void ejbCreate() throws javax.ejb.CreateException {
    InitialContext ctx = null;
    try {
        ctx = new InitialContext();
        // ログの取得
        String value = null;
        // Logger
        try {
            value = (String) ctx.lookup(C_LOGGER_JNDI_KEY);
        } catch (NamingException e) {
        }
        ServiceName serviceName = null;
        Logger logger = null;
        if (value != null && value.length() > 0) {
            serviceName = UtilTool.convertServiceName(value);
            logger = (Logger) ServiceManagerFactory.getService(serviceName);
        }
        // インターセプチェインタファクトリーサービスの取得
        InterceptorChainInvokerFactory iciFactory = null;
        InterceptorChainFactory icFactory = null;
        value = (String) ctx.lookup(C_INTERCEPTOR_SERVICE_NAME_JNDI_KEY);
        if (value != null && value.length() > 0) {
            serviceName = UtilTool.convertServiceName(value);
            Object factory = ServiceManagerFactory.getService(serviceName);
            if (factory instanceof InterceptorChainInvokerFactory) {
                iciFactory = (InterceptorChainInvokerFactory) factory;
            } else {
                icFactory = (InterceptorChainFactory) factory;
            }
        }
        // Beanフローファクトリーサービスの取得
        value = (String) ctx.lookup(C_BEAN_FLOW_SERVICE_NAME_JNDI_KEY);
        serviceName = UtilTool.convertServiceName(value);
        BeanFlowInvokerFactory bfFactory = (BeanFlowInvokerFactory) ServiceManagerFactory.getService(serviceName);
        super.init(logger, iciFactory, icFactory, bfFactory);
    } catch (NamingException e) {
        CreateException ce = new CreateException("InitialContext Error");
        ce.initCause(e);
        throw ce;
    }
}
Also used : InterceptorChainInvokerFactory(jp.ossc.nimbus.service.aspect.interfaces.InterceptorChainInvokerFactory) InterceptorChainFactory(jp.ossc.nimbus.service.aop.InterceptorChainFactory)

Aggregations

InterceptorChainFactory (jp.ossc.nimbus.service.aop.InterceptorChainFactory)2 InterceptorChainInvokerFactory (jp.ossc.nimbus.service.aspect.interfaces.InterceptorChainInvokerFactory)2 InitialContext (javax.naming.InitialContext)1 NamingException (javax.naming.NamingException)1 ServiceName (jp.ossc.nimbus.core.ServiceName)1