Search in sources :

Example 1 with ClassMappingTree

use of jp.ossc.nimbus.util.ClassMappingTree in project nimbus by nimbus-org.

the class BeanFlowConverterService method startService.

public void startService() throws Exception {
    if (beanFlowInvokerFactoryServiceName != null) {
        beanFlowInvokerFactory = (BeanFlowInvokerFactory) ServiceManagerFactory.getServiceObject(beanFlowInvokerFactoryServiceName);
    }
    if (beanFlowInvokerFactory == null) {
        throw new IllegalArgumentException("BeanFlowInvoker is null.");
    }
    final Set flowKeySet = beanFlowInvokerFactory.getBeanFlowKeySet();
    if (classMapping != null && classMapping.size() != 0) {
        classMap = new ClassMappingTree(null);
        final Iterator entries = classMapping.entrySet().iterator();
        while (entries.hasNext()) {
            final Map.Entry entry = (Map.Entry) entries.next();
            final Class clazz = convertStringToClass((String) entry.getKey());
            final String beanFlowKey = (String) entry.getValue();
            if (!flowKeySet.contains(beanFlowKey)) {
                throw new IllegalArgumentException("BeanFlow is not found : " + beanFlowKey);
            }
            classMap.add(clazz, beanFlowKey);
        }
    } else {
        if (classMap != null) {
            classMap.clear();
        }
    }
    if (conditions != null && conditions.length != 0) {
        if (conditionList != null) {
            conditionList.clear();
        } else {
            conditionList = new ArrayList();
        }
        for (int i = 0; i < conditions.length; i++) {
            final String condition = conditions[i];
            final int index = condition.lastIndexOf('=');
            if (index == 0 || index == -1 || index == condition.length() - 1) {
                throw new IllegalArgumentException("Condition is illegal : " + condition);
            }
            final String cond = condition.substring(0, index);
            final String beanFlowKey = condition.substring(index + 1);
            if (!flowKeySet.contains(beanFlowKey)) {
                throw new IllegalArgumentException("BeanFlow is not found : " + beanFlowKey);
            }
            conditionList.add(new Condition(cond, beanFlowKey));
        }
    } else {
        if (conditionList != null) {
            conditionList.clear();
        }
    }
    if (defaultBeanFlowKey != null && !flowKeySet.contains(defaultBeanFlowKey)) {
        throw new IllegalArgumentException("BeanFlow is not found : " + defaultBeanFlowKey);
    }
    if ((classMapping == null || classMapping.size() == 0) && (conditionList == null || conditionList.size() == 0) && defaultBeanFlowKey == null) {
        throw new IllegalArgumentException("BeanFlowKey is not specified.");
    }
}
Also used : ClassMappingTree(jp.ossc.nimbus.util.ClassMappingTree)

Example 2 with ClassMappingTree

use of jp.ossc.nimbus.util.ClassMappingTree in project nimbus by nimbus-org.

the class ClusterInvokerService method startService.

public void startService() throws Exception {
    if (selectorServiceName != null) {
        selector = (KeepAliveCheckerSelector) ServiceManagerFactory.getServiceObject(selectorServiceName);
    }
    if (selector == null) {
        throw new IllegalArgumentException("KeepAliveCheckerSelector is null.");
    }
    if (exceptionConditions != null && exceptionConditions.length != 0) {
        exceptionConditionMap = new ClassMappingTree(null);
        for (int i = 0; i < exceptionConditions.length; i++) {
            String className = exceptionConditions[i];
            final int index = className.lastIndexOf(':');
            String conditionStr = null;
            if (index != -1) {
                if (index != className.length() - 1) {
                    conditionStr = className.substring(index + 1);
                }
                className = className.substring(0, index);
            }
            final Class clazz = convertStringToClass(className);
            Condition condition = null;
            if (conditionStr == null) {
                condition = new Condition();
            } else {
                condition = new Condition(conditionStr);
            }
            exceptionConditionMap.add(clazz, condition);
        }
    } else {
        exceptionConditionMap = null;
    }
    if (threadContextServiceName != null) {
        threadContext = (Context) ServiceManagerFactory.getServiceObject(threadContextServiceName);
    }
}
Also used : ClassMappingTree(jp.ossc.nimbus.util.ClassMappingTree)

Example 3 with ClassMappingTree

use of jp.ossc.nimbus.util.ClassMappingTree in project nimbus by nimbus-org.

the class RetryInterceptorService method startService.

/**
 * サービスの開始処理を行う。<p>
 *
 * @exception Exception サービスの開始処理に失敗した場合
 */
public void startService() throws Exception {
    if (returnConditions != null && returnConditions.length != 0) {
        if (returnConditionList != null) {
            returnConditionList.clear();
        } else {
            returnConditionList = new ArrayList();
        }
        for (int i = 0; i < returnConditions.length; i++) {
            returnConditionList.add(new Condition(returnConditions[i]));
        }
    } else {
        if (returnConditionList != null) {
            returnConditionList.clear();
        }
    }
    if (exceptionConditions != null && exceptionConditions.length != 0) {
        exceptionConditionMap = new ClassMappingTree(null);
        for (int i = 0; i < exceptionConditions.length; i++) {
            String className = exceptionConditions[i];
            final int index = className.lastIndexOf(':');
            String conditionStr = null;
            if (index != -1) {
                if (index != className.length() - 1) {
                    conditionStr = className.substring(index + 1);
                }
                className = className.substring(0, index);
            }
            final Class clazz = convertStringToClass(className);
            Condition condition = null;
            if (conditionStr == null) {
                condition = new Condition();
            } else {
                condition = new Condition(conditionStr);
            }
            exceptionConditionMap.add(clazz, condition);
        }
    } else {
        if (exceptionConditionMap != null) {
            exceptionConditionMap.clear();
        }
    }
}
Also used : ClassMappingTree(jp.ossc.nimbus.util.ClassMappingTree)

Example 4 with ClassMappingTree

use of jp.ossc.nimbus.util.ClassMappingTree in project nimbus by nimbus-org.

the class BeanJournalEditorService method setFieldOnly.

/**
 * 編集時にJavaオブジェクトのpublicフィールドのみを対象とするかどうかを設定する。<p>
 * デフォルトは、falseでpublicフィールドのみを対象にはしない。<br>
 *
 * @param type 対象のクラス
 * @param isFieldOnly publicフィールドのみを対象とする場合は、true
 */
public void setFieldOnly(Class type, boolean isFieldOnly) {
    if (propertyAccessTypeMap == null) {
        propertyAccessTypeMap = new ClassMappingTree();
    }
    PropertyAccessType pat = (PropertyAccessType) propertyAccessTypeMap.getValueOf(type);
    if (pat == null) {
        pat = new PropertyAccessType();
        propertyAccessTypeMap.add(type, pat);
    }
    pat.isFieldOnly = isFieldOnly;
}
Also used : ClassMappingTree(jp.ossc.nimbus.util.ClassMappingTree)

Example 5 with ClassMappingTree

use of jp.ossc.nimbus.util.ClassMappingTree in project nimbus by nimbus-org.

the class BeanJournalEditorService method createService.

public void createService() throws Exception {
    secretPropertyMap = new ClassMappingTree();
    enabledPropertyMap = new ClassMappingTree();
}
Also used : ClassMappingTree(jp.ossc.nimbus.util.ClassMappingTree)

Aggregations

ClassMappingTree (jp.ossc.nimbus.util.ClassMappingTree)17 HashSet (java.util.HashSet)2 Iterator (java.util.Iterator)1 ServiceNameEditor (jp.ossc.nimbus.beans.ServiceNameEditor)1 NimbusClassLoader (jp.ossc.nimbus.core.NimbusClassLoader)1 ServiceName (jp.ossc.nimbus.core.ServiceName)1