Search in sources :

Example 26 with ServiceName

use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.

the class ServiceNameRefEditorTest method testSetAsText2.

public void testSetAsText2() throws Exception {
    ServiceNameRefEditor editor = new ServiceNameRefEditor();
    editor.setServiceManagerName("Manager1");
    editor.setAsText("Service1=Service1");
    assertEquals(new ServiceNameRef("Service1", new ServiceName("Service1")), editor.getValue());
}
Also used : ServiceName(jp.ossc.nimbus.core.ServiceName) ServiceNameRef(jp.ossc.nimbus.core.ServiceNameRef)

Example 27 with ServiceName

use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.

the class ObjectMappedEditorFinderService method startService.

/* (非 Javadoc)
	 * @see jp.ossc.nimbus.core.ServiceBaseSupport#startService()
	 */
public void startService() throws Exception {
    // 上位リポジトリの取得
    if (mFinderServiceName != null) {
        this.mParentFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(this.mFinderServiceName);
    }
    ServiceNameEditor editor = new ServiceNameEditor();
    editor.setServiceManagerName(getServiceManagerName());
    // 自分が管理するエディターサービスの設定
    Iterator iterator = mEditorMap.keySet().iterator();
    while (iterator.hasNext()) {
        String classAndKey = (String) iterator.next();
        String key = null;
        String clsName = null;
        final int index = classAndKey.indexOf(',');
        if (index == -1) {
            clsName = classAndKey;
        } else {
            clsName = classAndKey.substring(0, index);
            if (index != classAndKey.length() - 1) {
                key = classAndKey.substring(index + 1);
            }
        }
        Class cls = convertStringToClass(clsName);
        JournalEditor journalEditor = null;
        Object value = mEditorMap.get(classAndKey);
        if (value instanceof String) {
            String serviceName = (String) value;
            editor.setAsText(serviceName);
            ServiceName name = (ServiceName) editor.getValue();
            journalEditor = (JournalEditor) ServiceManagerFactory.getServiceObject(name);
        } else if (value instanceof JournalEditor) {
            journalEditor = (JournalEditor) value;
        }
        Map keyEditorMap = (Map) mEditorRepository.getValueOf(cls);
        if (keyEditorMap == null) {
            keyEditorMap = new HashMap();
            mEditorRepository.add(cls, keyEditorMap);
        }
        keyEditorMap.put(key, journalEditor);
    }
}
Also used : ServiceNameEditor(jp.ossc.nimbus.beans.ServiceNameEditor) ServiceName(jp.ossc.nimbus.core.ServiceName) HashMap(java.util.HashMap) Iterator(java.util.Iterator) JournalEditor(jp.ossc.nimbus.service.journal.JournalEditor) Map(java.util.Map) HashMap(java.util.HashMap)

Example 28 with ServiceName

use of jp.ossc.nimbus.core.ServiceName 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 29 with ServiceName

use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.

the class ScheduleManagerServlet method init.

/**
 * サーブレットの初期化を行う。<p>
 * サービス定義のロード及びロード完了チェックを行う。
 *
 * @exception ServletException サーブレットの初期化に失敗した場合
 */
public synchronized void init() throws ServletException {
    ServiceName jsonConverterServiceName = getJSONConverterServiceName();
    if (jsonConverterServiceName == null) {
        jsonConverter = new BeanJSONConverter();
        DateFormatConverter dateFormatConverter = new DateFormatConverter(DateFormatConverter.DATE_TO_STRING, "yyyyMMddHHmmssSSS");
        dateFormatConverter.setNullString(null);
        jsonConverter.setFormatConverter(Date.class, dateFormatConverter);
    } else {
        jsonConverter = (BeanJSONConverter) ServiceManagerFactory.getServiceObject(jsonConverterServiceName);
    }
    jsonConverter.setCharacterEncodingToStream("UTF-8");
    jsonConverter.setUnicodeEscape(isUnicodeEscape());
    toStringConverter = new StringStreamConverter(StringStreamConverter.STREAM_TO_STRING);
    toStringConverter.setCharacterEncodingToObject("UTF-8");
    ServiceName scheduleManagerServiceName = getScheduleManagerServiceName();
    if (scheduleManagerServiceName == null) {
        throw new ServletException("ScheduleManagerServiceName is null.");
    } else {
        scheduleManager = (ScheduleManager) ServiceManagerFactory.getServiceObject(scheduleManagerServiceName);
    }
    ServiceName schedulerServiceName = getSchedulerServiceName();
    if (schedulerServiceName != null) {
        scheduler = (Scheduler) ServiceManagerFactory.getServiceObject(schedulerServiceName);
    }
}
Also used : ServletException(javax.servlet.ServletException) ServiceName(jp.ossc.nimbus.core.ServiceName) BeanJSONConverter(jp.ossc.nimbus.util.converter.BeanJSONConverter) DateFormatConverter(jp.ossc.nimbus.util.converter.DateFormatConverter) StringStreamConverter(jp.ossc.nimbus.util.converter.StringStreamConverter)

Example 30 with ServiceName

use of jp.ossc.nimbus.core.ServiceName in project nimbus by nimbus-org.

the class ScheduleManagerServlet method getSchedulerServiceName.

private ServiceName getSchedulerServiceName() {
    final ServletConfig config = getServletConfig();
    final String serviceNameStr = config.getInitParameter(INIT_PARAM_NAME_SCHEDULER_SERVICE_NAME);
    if (serviceNameStr == null) {
        return null;
    }
    final ServiceNameEditor editor = new ServiceNameEditor();
    editor.setAsText(serviceNameStr);
    return (ServiceName) editor.getValue();
}
Also used : ServiceNameEditor(jp.ossc.nimbus.beans.ServiceNameEditor) ServiceName(jp.ossc.nimbus.core.ServiceName) ServletConfig(javax.servlet.ServletConfig)

Aggregations

ServiceName (jp.ossc.nimbus.core.ServiceName)66 ServiceNameRef (jp.ossc.nimbus.core.ServiceNameRef)13 ServiceNameEditor (jp.ossc.nimbus.beans.ServiceNameEditor)12 DefaultInterceptorChainList (jp.ossc.nimbus.service.aop.DefaultInterceptorChainList)9 DefaultMethodInvocationContext (jp.ossc.nimbus.service.aop.DefaultMethodInvocationContext)8 Interceptor (jp.ossc.nimbus.service.aop.Interceptor)8 InvocationContext (jp.ossc.nimbus.service.aop.InvocationContext)8 FilterChain (javax.servlet.FilterChain)7 InterceptorChain (jp.ossc.nimbus.service.aop.InterceptorChain)7 Map (java.util.Map)6 Properties (java.util.Properties)6 DefaultInterceptorChain (jp.ossc.nimbus.service.aop.DefaultInterceptorChain)6 HashMap (java.util.HashMap)5 ServiceMetaData (jp.ossc.nimbus.core.ServiceMetaData)5 Invoker (jp.ossc.nimbus.service.aop.Invoker)5 Iterator (java.util.Iterator)4 Method (java.lang.reflect.Method)3 ServletConfig (javax.servlet.ServletConfig)3 DefaultThreadLocalInterceptorChain (jp.ossc.nimbus.service.aop.DefaultThreadLocalInterceptorChain)3 DefaultSemaphoreService (jp.ossc.nimbus.service.semaphore.DefaultSemaphoreService)3