當前位置: 首頁>>代碼示例>>Java>>正文


Java HierarchicalConfiguration.getBoolean方法代碼示例

本文整理匯總了Java中org.apache.commons.configuration.HierarchicalConfiguration.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java HierarchicalConfiguration.getBoolean方法的具體用法?Java HierarchicalConfiguration.getBoolean怎麽用?Java HierarchicalConfiguration.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.configuration.HierarchicalConfiguration的用法示例。


在下文中一共展示了HierarchicalConfiguration.getBoolean方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFieldForMetadataFormat

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * 
 * @param metadataFormat
 * @return
 * @should return all values
 */
public List<FieldConfiguration> getFieldForMetadataFormat(String metadataFormat) {
    if (metadataFormat == null) {
        throw new IllegalArgumentException("metadataFormat may not be null");
    }

    List<HierarchicalConfiguration> elements = getLocalConfigurationsAt(metadataFormat + ".fields.field");
    if (elements != null) {
        List<FieldConfiguration> ret = new ArrayList<>(elements.size());
        for (Iterator<HierarchicalConfiguration> it = elements.iterator(); it.hasNext();) {
            HierarchicalConfiguration sub = it.next();
            Map<String, String> fieldConfig = new HashMap<>();
            String name = sub.getString("[@name]", null);
            String valueSource = sub.getString("[@valueSource]", null);
            boolean translate = sub.getBoolean("[@translate]", false);
            boolean multivalued = sub.getBoolean("[@multivalued]", false);
            boolean useTopstructValueIfNoneFound = sub.getBoolean("[@useTopstructValueIfNoneFound]", false);
            String defaultValue = sub.getString("[@defaultValue]", null);
            String prefix = sub.getString("[@prefix]", null);
            if (prefix != null) {
                prefix = prefix.replace("_SPACE_", " ");
            }
            String suffix = sub.getString("[@suffix]", null);
            if (suffix != null) {
                suffix = suffix.replace("_SPACE_", " ");
            }
            ret.add(new FieldConfiguration(name, valueSource, translate, multivalued, useTopstructValueIfNoneFound, defaultValue, prefix,
                    suffix));
        }
        return ret;
    }

    return null;
}
 
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:40,代碼來源:Configuration.java

示例2: convertCfgToUser

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private static Function<HierarchicalConfiguration, User> convertCfgToUser(final Tokenizer tokenizer) {
    return new Function<HierarchicalConfiguration, User>() {
        @Override
        public User valueOf(HierarchicalConfiguration cfg) {
            return new User(tokenizer.tokenizeString(cfg.getString("[@name]")), cfg.getString("[@password]"),
                    cfg.getBoolean("[@admin]", false));
        }
    };
}
 
開發者ID:goldmansachs,項目名稱:obevo,代碼行數:10,代碼來源:DbEnvironmentXmlEnricher.java

示例3: buildStoreConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) {
    StringBuilder sb = new StringBuilder();
    String name = configuration.getString("name");
    if ( name == null ) sb.append("store name is not defined ");
    String path = configuration.getString("path","data");
    String filename = configuration.getString("filename", name);
    boolean delay = configuration.getBoolean("delay", true);
    int mode = configuration.getInt("mode", 0);
    int freq = configuration.getInt("freq", this.freq == 0 ? 1 : this.freq );
    int batchSize = configuration.getInt("batchSize", 10);
    String logPath = configuration.getString("logPath","log");
    List<String> replicaUrl = configuration.getList("replicaUrl");
    long replciaTimeout = configuration.getLong("replicaTimeout", 60000);
    if (replicaUrl == null ) sb.append("no replicaUrl is defined");
    boolean sorted = configuration.getBoolean("sorted", false);
    if ( sb.length() > 0 ) {
        throw new RuntimeException("error on buildStoreConfig "+sb.toString());
    }
    else {
        StoreConfig storeConfig = new StoreConfig(name, path, freq, replicaUrl, batchSize, delay, mode, sorted);
        storeConfig.setGetTriggerName( configuration.getString("getTrigger"));
        storeConfig.setPutTriggerName( configuration.getString("putTrigger"));
        storeConfig.setDeleteTriggerName( configuration.getString("deleteTrigger"));
        storeConfig.setUseMaxCache(configuration.getBoolean("useMaxCache", false));
        storeConfig.setMaxCacheMemory(configuration.getInt("maxCacheMemory", 20000));
        storeConfig.setUseLRU(configuration.getBoolean("useLRU", false));
        storeConfig.setLogPath( logPath);
        storeConfig.setReplicaTimeout( replciaTimeout);
        //add pstReplicaURl
        storeConfig.setPstReplicaUrl( configuration.getList("pstReplicaUrl"));
        storeConfig.setSerializeClass(configuration.getString("serializeClass"));
        return storeConfig ;
    }

}
 
開發者ID:viant,項目名稱:CacheStore,代碼行數:36,代碼來源:BuildRemoteConfig.java

示例4: buildStoreConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) {
        StringBuilder sb = new StringBuilder();
        String name = configuration.getString("name");
        if ( name == null ) sb.append("store name is not defined ");
        String path = configuration.getString("path","data");
        String filename = configuration.getString("filename", name);
        boolean delay = configuration.getBoolean("delayWrite", true);
        int mode = configuration.getInt("mode", 0);
        int delayThread = configuration.getInt("delayThread", 2);
        String serializeClass = configuration.getString("serializer", "com.sm.localstore.impl.HessianSerializer");
        String blockSizeClass = configuration.getString("blockSize");
        BlockSize blockSize = null;
        if ( blockSizeClass != null ) {
            try {
                blockSize = (BlockSize) Class.forName(blockSizeClass).newInstance();
            } catch (Exception ex) {
                sb.append(("unable to load "+blockSizeClass+" "+ex.getMessage()));
            }
        }
        boolean useCache = configuration.getBoolean("useCache", false);
        long maxCache = configuration.getLong("maxCache", 1000 * 1000 * 1000L);
        String logPath = configuration.getString("logPath", "log");
        String replicaUrl = configuration.getString("replicaUrl");
        String purgeClass = configuration.getString("purgeClass");
        if ( sb.length() > 0 ) {
            throw new RuntimeException("error on buildStoreConfig "+sb.toString());
        }
        else {
            StoreConfig storeConfig = new StoreConfig(name, path, 10, null );
            storeConfig.setDelay( delay);
            storeConfig.setDelayThread(delayThread);
            storeConfig.setLogPath( logPath);
            storeConfig.setBlockSize( blockSize);
            storeConfig.setPurgeClass(purgeClass);
//            return new StoreConfig(name, path, filename, delay, mode, writeThread, useCache, maxCache, maxCache,
//                    logPath, serializeClass, blockSize, replicaUrl);
            return storeConfig;
        }
    }
 
開發者ID:viant,項目名稱:CacheStore,代碼行數:40,代碼來源:BuildStoreConfig.java

示例5: SecurityConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public SecurityConfig(@Nonnull HierarchicalConfiguration config) {
    if (config != null) {
        List<HierarchicalConfiguration> sizes = config.configurationsAt("groups/group");
        for (HierarchicalConfiguration sizeConfig : sizes) {
            String group = sizeConfig.getString("");
            if (sizeConfig.getBoolean("@isDefault", false)) {
                defaultGroups.add(group);
            }
            groups.add(group);
        }

        List<HierarchicalConfiguration> restrictionConfigs = config.configurationsAt("restrictions/restriction");
        for (HierarchicalConfiguration restrictionConfig : restrictionConfigs) {
            List<HierarchicalConfiguration> restrictionGroups = restrictionConfig.configurationsAt("groups/group");
            String key = restrictionConfig.getString("@operation");
            List<String> value = new ArrayList<String>();
            for (HierarchicalConfiguration restrictionGroupConfig : restrictionGroups) {
                value.add(restrictionGroupConfig.getString(""));
            }
            restrictionMap.put(key, value);
        }

        List<HierarchicalConfiguration> userConfigs = config.configurationsAt("users/user");
        for (HierarchicalConfiguration userConfig : userConfigs) {
            users.add(new DefaultUser(userConfig));
        }
    }
}
 
開發者ID:intuit,項目名稱:Tank,代碼行數:30,代碼來源:SecurityConfig.java

示例6: DefaultUser

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public DefaultUser(HierarchicalConfiguration config) {
    this.name = config.getString("name");
    this.email = config.getString("email");
    this.password = config.getString("password");
    this.admin = config.getBoolean("admin", false);
    for (HierarchicalConfiguration c : (List<HierarchicalConfiguration>) config.configurationsAt("group")) {
        groups.add(c.getString(""));
    }
}
 
開發者ID:intuit,項目名稱:Tank,代碼行數:11,代碼來源:DefaultUser.java

示例7: convertCfgToSchema

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private Function<HierarchicalConfiguration, Schema> convertCfgToSchema(final DbPlatform systemDbPlatform, final int schemaNameValidation) {
    return new Function<HierarchicalConfiguration, Schema>() {
        private static final long serialVersionUID = 1L;

        @Override
        public Schema valueOf(HierarchicalConfiguration object) {
            String schemaName = object.getString("[@name]");
            if (schemaNameValidation >= 2) {
                validateSchemaName(schemaName);
            }
            boolean readOnly = object.getBoolean("[@readOnly]", false);

            MutableSetMultimap<String, String> excludedNameMap = Multimaps.mutable.set.empty();

            ImmutableList<HierarchicalConfiguration> excludes = iterConfig(object, "excludes");
            if (!excludes.isEmpty()) {
                if (excludes.size() > 1) {
                    throw new IllegalArgumentException("Only expecting 1 excludes element under <schema>");
                }
                HierarchicalConfiguration excludesConfig = excludes.get(0);
                if (excludesConfig != null) {
                    for (ChangeType changeType : systemDbPlatform.getChangeTypes()) {
                        ImmutableList<String> excludedNames = iterString(excludesConfig, changeType.getName().toLowerCase());
                        if (excludedNames.notEmpty()) {
                            excludedNameMap.putAll(changeType.getName(), excludedNames);
                        }

                        ImmutableList<String> excludedPatterns = iterString(excludesConfig, changeType.getName().toLowerCase() + "Pattern");
                        if (excludedPatterns.notEmpty()) {
                            throw new IllegalArgumentException("The <objectType>Pattern element is deprecated. Use just the <objectType> element w/ wildcards (% or *)");
                        }
                    }

                    if (iterString(excludesConfig, "procedure").notEmpty() || iterString(excludesConfig, "procedurePattern").notEmpty()) {
                        throw new IllegalArgumentException("The procedure and procedurePattern elements are no longer supported. Use <sp> only, with wildcards (% or *) if  needed");
                    }

                }
            }

            return new Schema(schemaName, systemDbPlatform.getObjectExclusionPredicateBuilder().add(excludedNameMap.toImmutable()), readOnly);
        }
    };
}
 
開發者ID:goldmansachs,項目名稱:obevo,代碼行數:45,代碼來源:DbEnvironmentXmlEnricher.java


注:本文中的org.apache.commons.configuration.HierarchicalConfiguration.getBoolean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。