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


Java HierarchicalConfiguration.getString方法代碼示例

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


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

示例1: getAllValuesSets

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * 
 * @return
 * @should return all values
 */
public List<Set> getAllValuesSets() {
    List<HierarchicalConfiguration> types = getLocalConfigurationsAt("sets.allValuesSet");
    if (types != null) {
        List<Set> ret = new ArrayList<>(types.size());
        for (Iterator<HierarchicalConfiguration> it = types.iterator(); it.hasNext();) {
            HierarchicalConfiguration sub = it.next();
            Set set = new Set(sub.getString("."), null, null);
            set.setTranslate(sub.getBoolean("[@translate]", false));
            ret.add(set);
            // logger.debug("loaded type: " + sub.getString("[@name]") + ": " + sub.getString("[@type]"));
        }
        return ret;
    }
    return new ArrayList<>(0);
}
 
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:21,代碼來源:Configuration.java

示例2: getCollectionBlacklist

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * Returns collection names to be omitted from search results, listings etc. from config_viewer.xml
 * 
 * @return
 * @should return all key-value pairs
 */
public List<String> getCollectionBlacklist() {
    List<String> ret = new ArrayList<>();
    if (viewerConfig == null) {
        logger.error("Viewer config not loaded, cannot read collection blacklist.");
        return ret;
    }
    List<HierarchicalConfiguration> templates = viewerConfig.configurationsAt("collections.collection");
    if (templates != null && !templates.isEmpty()) {
        for (Iterator<HierarchicalConfiguration> it = templates.iterator(); it.hasNext();) {
            HierarchicalConfiguration sub = it.next();
            String field = sub.getString("[@field]");
            List<Object> collections = sub.getList("blacklist.collection");
            for (Object o : collections) {
                ret.add(field + ":" + (String) o);
            }
        }
    }
    return ret;
}
 
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:26,代碼來源:Configuration.java

示例3: getRestrictedAccessConditions

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * @return
 * @should return all values
 */
public List<LicenseType> getRestrictedAccessConditions() {
    List<HierarchicalConfiguration> elements = getLocalConfigurationsAt("solr.restrictions.restriction");
    if (elements != null) {
        List<LicenseType> ret = new ArrayList<>(elements.size());
        for (Iterator<HierarchicalConfiguration> it = elements.iterator(); it.hasNext();) {
            HierarchicalConfiguration sub = it.next();
            Map<String, String> fieldConfig = new HashMap<>();
            String value = sub.getString(".");
            String field = sub.getString("[@field]", null);
            String condition = sub.getString("[@conditions]", null);
            ret.add(new LicenseType(field, value, condition));
        }
        return ret;
    }

    return new ArrayList<>(0);
}
 
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:22,代碼來源:Configuration.java

示例4: loadDriver

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * Loads a driver from the supplied hierarchical configuration.
 *
 * @param driverCfg hierarchical configuration containing the driver definition
 * @param resolver  driver resolver
 * @return driver
 */
public DefaultDriver loadDriver(HierarchicalConfiguration driverCfg,
                                DriverResolver resolver) {
    String name = driverCfg.getString(NAME);
    String parentsString = driverCfg.getString(EXTENDS, "");
    List<Driver> parents = Lists.newArrayList();
    if (!parentsString.equals("")) {
        List<String> parentsNames;
        if (parentsString.contains(",")) {
            parentsNames = Arrays.asList(parentsString.replace(" ", "").split(","));
        } else {
            parentsNames = Lists.newArrayList(parentsString);
        }
        parents = parentsNames.stream().map(parent -> (parent != null) ?
                resolve(parent, resolver) : null).collect(Collectors.toList());
    }
    String manufacturer = driverCfg.getString(MFG, "");
    String hwVersion = driverCfg.getString(HW, "");
    String swVersion = driverCfg.getString(SW, "");
    return new DefaultDriver(name, parents, manufacturer, hwVersion, swVersion,
                             parseBehaviours(driverCfg),
                             parseProperties(driverCfg));
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:30,代碼來源:XmlDriverLoader.java

示例5: load

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * Loads and parse CME MDP Configuration.
 *
 * @param uri URI to CME MDP Configuration (config.xml, usually available on CME FTP)
 * @throws ConfigurationException if failed to parse configuration file
 * @throws MalformedURLException  if URI to Configuration is malformed
 */
private void load(final URI uri) throws ConfigurationException, MalformedURLException {
    // todo: if to implement the same via standard JAXB then dep to apache commons configuration will be not required
    final XMLConfiguration configuration = new XMLConfiguration();
    configuration.setDelimiterParsingDisabled(true);
    configuration.load(uri.toURL());
    for (final HierarchicalConfiguration channelCfg : configuration.configurationsAt("channel")) {
        final ChannelCfg channel = new ChannelCfg(channelCfg.getString("[@id]"), channelCfg.getString("[@label]"));

        for (final HierarchicalConfiguration connCfg : channelCfg.configurationsAt("connections.connection")) {
            final String id = connCfg.getString("[@id]");
            final FeedType type = FeedType.valueOf(connCfg.getString("type[@feed-type]"));
            final TransportProtocol protocol = TransportProtocol.valueOf(connCfg.getString("protocol").substring(0, 3));
            final Feed feed = Feed.valueOf(connCfg.getString("feed"));
            final String ip = connCfg.getString("ip");
            final int port = connCfg.getInt("port");
            final List<String> hostIPs = Arrays.asList(connCfg.getStringArray("host-ip"));

            final ConnectionCfg connection = new ConnectionCfg(feed, id, type, protocol, ip, hostIPs, port);
            channel.addConnection(connection);
            connCfgs.put(connection.getId(), connection);
        }
        channelCfgs.put(channel.getId(), channel);
    }
}
 
開發者ID:epam,項目名稱:java-cme-mdp3-handler,代碼行數:32,代碼來源:Configuration.java

示例6: getNetworks

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
public List<Network> getNetworks() {
    List<Network> result = new LinkedList<Network>();
    if (configuration != null) {
        List<HierarchicalConfiguration> networks = configuration
                .configurationsAt("networks.network");
        for (HierarchicalConfiguration networkEntry : networks) {
            int maxVm = 0;
            try {
                maxVm = Integer.parseInt(networkEntry
                        .getString("numOfMaxVm"));
            } catch (NumberFormatException e) {
                maxVm = Integer.MAX_VALUE;
            }
            Network network = new Network(networkEntry.getString("name"),
                    networkEntry.getString("networkCategory"),
                    networkEntry.getString("networkId"), maxVm);
            result.add(network);
        }
    }
    return result;
}
 
開發者ID:servicecatalog,項目名稱:development,代碼行數:22,代碼來源:LPlatformBase.java

示例7: fillGenreMap

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private static void fillGenreMap(String xmlGenreFilename) {
    File xmlGenreFile = new File(xmlGenreFilename);
    if (xmlGenreFile.exists() && xmlGenreFile.isFile() && xmlGenreFilename.toUpperCase().endsWith("XML")) {

        try {
            XMLConfiguration c = new XMLConfiguration(xmlGenreFile);

            List<HierarchicalConfiguration> genres = c.configurationsAt("genre");
            for (HierarchicalConfiguration genre : genres) {
                String masterGenre = genre.getString(LIT_NAME);
                LOG.trace("New masterGenre parsed : (" + masterGenre + ")");
                List<Object> subgenres = genre.getList("subgenre");
                for (Object subgenre : subgenres) {
                    LOG.trace("New genre added to map : (" + subgenre + "," + masterGenre + ")");
                    GENRES_MAP.put((String) subgenre, masterGenre);
                }

            }
        } catch (ConfigurationException error) {
            LOG.error("Failed parsing moviejukebox genre input file: {}", xmlGenreFile.getName());
            LOG.error(SystemTools.getStackTrace(error));
        }
    } else {
        LOG.error("The moviejukebox genre input file you specified is invalid: {}", xmlGenreFile.getName());
    }
}
 
開發者ID:YAMJ,項目名稱:yamj-v2,代碼行數:27,代碼來源:Library.java

示例8: getMap

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
public static Map<String, String> getMap(String key) {
	// return getMapAndCache(key);
	Map<String, String> result = null;
	StringBuilder sb = new StringBuilder();
	sb.append(key);
	sb.append(".entry");
	// System.out.println(sb);
	List<HierarchicalConfiguration> list = configurationsAt(sb.toString());
	// System.out.println(list.size());
	if (!list.isEmpty()) {
		result = new LinkedHashMap<String, String>();
		for (HierarchicalConfiguration node : list) {
			String nodeKey = node.getString("key");
			String nodeValue = node.getString("value");
			// System.out.println(nodeKey+" "+nodeValue);
			result.put(nodeKey, nodeValue);
		}
	}
	return result;
}
 
開發者ID:mixaceh,項目名稱:openyu-commons,代碼行數:21,代碼來源:ConfigHelper2.java

示例9: initConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
protected void initConfig(XMLConfiguration configuration) {
    messages.clear();
    if (config != null) {
        String style = getStyle();
        @SuppressWarnings("unchecked") List<HierarchicalConfiguration> msgConfigs = config
                .configurationsAt(KEY_MESSAGE_NODE);
        for (HierarchicalConfiguration msgConfig : msgConfigs) {
            String event = msgConfig.getString(KEY_EVENT);
            String subject = msgConfig.getString(KEY_SUBJECT);
            String body = msgConfig.getString(KEY_BODY);
            if (!StringUtils.isEmpty(event) && !StringUtils.isEmpty(subject) && !StringUtils.isEmpty(body)) {
                messages.put(event, new MailMessage(body, subject, style));
            }
        }
    }
}
 
開發者ID:intuit,項目名稱:Tank,代碼行數:21,代碼來源:MailMessageConfig.java

示例10: fillCategoryMap

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private static void fillCategoryMap(String xmlCategoryFilename) {
    File xmlFile = new File(xmlCategoryFilename);
    if (xmlFile.exists() && xmlFile.isFile() && xmlCategoryFilename.toUpperCase().endsWith("XML")) {

        try {
            XMLConfiguration c = new XMLConfiguration(xmlFile);

            List<HierarchicalConfiguration> categories = c.configurationsAt("category");
            for (HierarchicalConfiguration category : categories) {
                boolean enabled = Boolean.parseBoolean(category.getString("enable", TRUE));

                if (enabled) {
                    String origName = category.getString(LIT_NAME);
                    String newName = category.getString("rename", origName);
                    CATEGORIES_MAP.put(origName, newName);
                    //logger.debug("Added category '" + origName + "' with name '" + newName + "'");
                }
            }
        } catch (ConfigurationException error) {
            LOG.error("Failed parsing moviejukebox category input file: {}", xmlFile.getName());
            LOG.error(SystemTools.getStackTrace(error));
        }
    } else {
        LOG.error("The moviejukebox category input file you specified is invalid: {}", xmlFile.getName());
    }
}
 
開發者ID:YAMJ,項目名稱:yamj-v2,代碼行數:27,代碼來源:Library.java

示例11: 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

示例12: getAdditionalSets

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * 
 * @return
 * @should return all values
 */
public List<Set> getAdditionalSets() {
    List<HierarchicalConfiguration> types = getLocalConfigurationsAt("sets.set");
    if (types != null) {
        List<Set> ret = new ArrayList<>(types.size());
        for (Iterator<HierarchicalConfiguration> it = types.iterator(); it.hasNext();) {
            HierarchicalConfiguration sub = it.next();
            Set set = new Set(sub.getString("[@setName]"), sub.getString("[@setSpec]"), sub.getString("[@setQuery]"));
            ret.add(set);
            // logger.debug("loaded type: " + sub.getString("[@name]") + ": " + sub.getString("[@type]"));
        }
        return ret;
    }
    return new ArrayList<>(0);
}
 
開發者ID:intranda,項目名稱:goobi-viewer-connector,代碼行數:20,代碼來源:Configuration.java

示例13: 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

示例14: convertCfgToPermission

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

示例15: getProperty

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * Returns the desired property from the config, giving preference to the environment but defaulting to the system if it exists.
 * The calls above should look to adopt this method.
 */
private String getProperty(HierarchicalConfiguration sysCfg, HierarchicalConfiguration envCfg, String property) {
    String envVal = envCfg.getString(property);
    if (envVal != null) {
        return envVal;
    }

    String sysVal = sysCfg.getString(property);
    if (sysVal != null) {
        return sysVal;
    }

    return null;
}
 
開發者ID:goldmansachs,項目名稱:obevo,代碼行數:18,代碼來源:DbEnvironmentXmlEnricher.java


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