当前位置: 首页>>代码示例>>Java>>正文


Java XMLConfiguration.configurationsAt方法代码示例

本文整理汇总了Java中org.apache.commons.configuration.XMLConfiguration.configurationsAt方法的典型用法代码示例。如果您正苦于以下问题:Java XMLConfiguration.configurationsAt方法的具体用法?Java XMLConfiguration.configurationsAt怎么用?Java XMLConfiguration.configurationsAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.configuration.XMLConfiguration的用法示例。


在下文中一共展示了XMLConfiguration.configurationsAt方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的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

示例2: listServerTypes

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public List<String> listServerTypes() throws IaasException {
	HashMap<String, String> request = getBasicParameters();
	request.put(LParameter.ACTION, LOperation.LIST_SERVER_TYPE);
	XMLConfiguration response = execute(request);
	List<String> result = new LinkedList<String>();
	if (response != null) {
		List<HierarchicalConfiguration> types = response
				.configurationsAt("servertypes.servertype");
		for (HierarchicalConfiguration type : types) {
			String name = type.getString("name");
			if (name != null && name.trim().length() > 0) {
				result.add(name);
			}
		}
	}
	return result;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:18,代码来源:RORClient.java

示例3: listLPlatforms

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * Returns a list of all available LPlatform configurations.
 * 
 * @param verbose
 *            set to <code>true</code> to retrieve extended information
 * @return the list of configurations (may be empty but not
 *         <code>null</code>)
 * @throws RORException
 */
public List<LPlatformConfiguration> listLPlatforms(boolean verbose)
		throws IaasException {
	HashMap<String, String> request = getBasicParameters();
	request.put(LParameter.ACTION, LOperation.LIST_LPLATFORM);
	request.put(LParameter.VERBOSE, (verbose ? "true" : "false"));
	XMLConfiguration result = execute(request);

	List<LPlatformConfiguration> resultList = new LinkedList<LPlatformConfiguration>();
	if (result != null) {
		List<HierarchicalConfiguration> platforms = result
				.configurationsAt("lplatforms.lplatform");
		for (HierarchicalConfiguration platform : platforms) {
			resultList.add(new LPlatformConfiguration(platform));
		}
	}
	return resultList;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:27,代码来源:RORClient.java

示例4: listLPlatformDescriptors

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * Retrieves a list of templates available for the tenant.
 * 
 * @return the list
 * @throws RORException
 */
public List<LPlatformDescriptor> listLPlatformDescriptors()
		throws IaasException {
	HashMap<String, String> request = getBasicParameters();
	request.put(LParameter.ACTION, LOperation.LIST_LPLATFORM_DESCR);
	XMLConfiguration result = execute(request);

	List<LPlatformDescriptor> resultList = new LinkedList<LPlatformDescriptor>();
	if (result != null) {
		List<HierarchicalConfiguration> descriptors = result
				.configurationsAt("lplatformdescriptors.lplatformdescriptor");
		for (HierarchicalConfiguration descriptor : descriptors) {
			resultList.add(new LPlatformDescriptor(descriptor));
		}
	}
	return resultList;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:23,代码来源:RORClient.java

示例5: listDiskImages

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * Retrieves a list of disk images available for the tenant.
 * 
 * @return the list
 * @throws RORException
 */
public List<DiskImage> listDiskImages() throws IaasException {
	HashMap<String, String> request = getBasicParameters();
	request.put(LParameter.ACTION, LOperation.LIST_DISKIMAGE);
	XMLConfiguration result = execute(request);

	List<DiskImage> resultList = new LinkedList<DiskImage>();
	if (result != null) {
		List<HierarchicalConfiguration> images = result
				.configurationsAt("diskimages.diskimage");
		for (HierarchicalConfiguration image : images) {
			resultList.add(new RORDiskImage(image));
		}
	}
	return resultList;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:22,代码来源:RORClient.java

示例6: fillGenreMap

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的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

示例7: fillCategoryMap

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的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

示例8: getHierarchicalExample

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * 获取树状结构数据
 */
public void getHierarchicalExample() {

    try {
        XMLConfiguration config = new XMLConfiguration("properties-website-job.xml");
        log.info(config.getFileName());
        //   log.info(config.getStringByEncoding("jdbc.oracle.work.235.url", "GBK"));

        //包含 websites.site.name 的集合
        Object prop = config.getProperty("websites.site.name");

        if (prop instanceof Collection) {
            //  System.out.println("Number of tables: " + ((Collection<?>) prop).size());
            Collection<String> c = (Collection<String>) prop;
            int i = 0;

            for (String s : c) {

                System.out.println("sitename :" + s);

                List<HierarchicalConfiguration> fields = config.configurationsAt("websites.site(" + String.valueOf(i) + ").fields.field");
                for (HierarchicalConfiguration sub : fields) {
                    // sub contains all data about a single field
                    //此处可以包装成 bean
                    String name = sub.getString("name");
                    String type = sub.getString("type");
                    System.out.println("name :" + name + " , type :" + type);
                }

                i++;
                System.out.println(" === ");
            }
        }
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }


}
 
开发者ID:h819,项目名称:spring-boot,代码行数:42,代码来源:MyConfigurationXMLUtils.java

示例9: cfg2Mdl

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void cfg2Mdl(XMLConfiguration config)
{
	// TODO Auto-generated method stub
	if (null == config)
	{
		return;
	}
	List<SubnodeConfiguration> items = config.configurationsAt("module.rest");
	RestUrl resturl = null;
	for (SubnodeConfiguration subnode : items)
	{
		if (null != subnode && !NFVOUtils.isEmpty(subnode.getString("[@id]")))
		{
			REST_URLS.put(
					subnode.getString("[@id]"),
					resturl = new RestUrl(subnode.getString("[@id]"), subnode.getString("url"), subnode
							.getString("[@type]"), subnode.getString("[@desc]")));
			resturl.setReqjson(subnode.getString("reqjson"));
			List<SubnodeConfiguration> items2 = subnode.configurationsAt("properties.property");
			for (SubnodeConfiguration subnode2 : items2)
			{
				resturl.getPairs().add(subnode2.getString("[@key]"), subnode2.getString("[@value]"));
			}
		}
	}
	LOGGER.info("REST_URLS = {}", REST_URLS);
}
 
开发者ID:wolabs,项目名称:womano,代码行数:29,代码来源:RestConfigHandler.java

示例10: cfg2Mdl

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void cfg2Mdl(XMLConfiguration config)
{
	// TODO Auto-generated method stub
	if (null == config)
	{
		return;
	}
	List<SubnodeConfiguration> items = config.configurationsAt("module.block");
	ConfigBlock block = null;
	for (SubnodeConfiguration subnode : items)
	{
		if (null != subnode && !NFVOUtils.isEmpty(subnode.getString("[@id]")))
		{

			block = new ConfigBlock();
			block.setId(subnode.getString("[@id]"));

			List<SubnodeConfiguration> items2 = subnode.configurationsAt("property");
			for (SubnodeConfiguration subnode2 : items2)
			{
				block.getPairs().add(subnode2.getString("[@key]"), subnode2.getString("[@value]"));
			}
			CONFIG_BLOCKS.put(block.getId(), block);
		}
	}
	LOGGER.info("CONFIG_BLOCKS = {}", CONFIG_BLOCKS);
}
 
开发者ID:wolabs,项目名称:womano,代码行数:29,代码来源:SystemConfig.java

示例11: readIntermediateGMLFile

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public void readIntermediateGMLFile() throws IOException{
	XMLConfiguration configuration = getConfiguration();
	try {
		configuration.load(new File(_intermediateGMLInputFile));
		System.out.println("reading the partitioned gml information from " + _intermediateGMLInputFile);
	} catch (ConfigurationException e) {
		throw new RuntimeException(e);
	}

	List<HierarchicalConfiguration> subConfigurationCollection;
	int partitionId;
	List<Object> instanceObjectCollection;
	List<Path> instancePaths;
	subConfigurationCollection = configuration.configurationsAt("partition");
	for(HierarchicalConfiguration subConfig : subConfigurationCollection){
		partitionId = subConfig.getInt("[@id]");
		_partitionedTemplates.put(partitionId, Paths.get(subConfig.getString("template")));

		instanceObjectCollection = subConfig.getList("instances.instance");
		instancePaths = new LinkedList<>();
		for(Object instanceObj : instanceObjectCollection){
			instancePaths.add(Paths.get(instanceObj.toString()));
		}

		_partitionedInstances.put(partitionId, instancePaths);
	}
}
 
开发者ID:dream-lab,项目名称:goffish_v2,代码行数:28,代码来源:GMLPartitionBuilder.java

示例12: fillCertificationMap

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
private static void fillCertificationMap(String xmlCertificationFilename) {
    File xmlCertificationFile = new File(xmlCertificationFilename);
    if (xmlCertificationFile.exists() && xmlCertificationFile.isFile() && xmlCertificationFilename.toUpperCase().endsWith("XML")) {
        try {
            XMLConfiguration conf = new XMLConfiguration(xmlCertificationFile);

            List<HierarchicalConfiguration> certifications = conf.configurationsAt("certification");
            for (HierarchicalConfiguration certification : certifications) {
                String masterCertification = certification.getString(LIT_NAME);
                List<Object> subcertifications = certification.getList("subcertification");
                for (Object subcertification : subcertifications) {
                    CERTIFICATIONS_MAP.put((String) subcertification, masterCertification);
                }

            }
            if (conf.containsKey("default")) {
                defaultCertification = conf.getString("default");
                LOG.info("Found default certification: {}", defaultCertification);
            }
        } catch (ConfigurationException error) {
            LOG.error("Failed parsing moviejukebox certification input file: {}", xmlCertificationFile.getName());
            LOG.error(SystemTools.getStackTrace(error));
        }
    } else {
        LOG.error("The moviejukebox certification input file you specified is invalid: {}", xmlCertificationFile.getName());
    }
}
 
开发者ID:YAMJ,项目名称:yamj-v2,代码行数:28,代码来源:Library.java

示例13: registerFromDescriptor

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public void registerFromDescriptor( URL url, ClassLoader cl )
    throws NativesManagerException
{
    try
    {
        XMLConfiguration config = new XMLConfiguration();

        try ( InputStream reader = new BufferedInputStream( url.openStream() ) )
        {
            config.load( reader );
        }

        String basePath = config.getString( "base-path" );

        if ( basePath == null )
        {
            basePath = EMPTY;
        }
        else if ( !basePath.isEmpty() )
        {
            basePath = ( stripEnd( basePath, "/" ) + "/" );
        }

        for ( HierarchicalConfiguration nativesConfig : config.configurationsAt( "natives" ) )
        {
            String osName = nativesConfig.getString( "os[@name]" );

            for ( HierarchicalConfiguration archConfig : nativesConfig.configurationsAt( "arch" ) )
            {
                NativesInfo natives = new NativesInfo();

                natives.osName = osName.toUpperCase();
                natives.archName = getCanonicalArchitecture( archConfig.getString( "[@name]" ) ).toUpperCase();
                natives.capnpPath = ( basePath + archConfig.getString( "capnp-exec-path" ) );
                natives.capnpcJavaPath = ( basePath + archConfig.getString( "capnpc-java-exec-path" ) );
                natives.capnpJavaSchemaPath = ( basePath + archConfig.getString( "capnp-java-schema-path" ) );

                natives.capnpUrl = cl.getResource( natives.capnpPath );
                natives.capnpcJavaUrl = cl.getResource( natives.capnpcJavaPath );
                natives.capnpJavaSchemaUrl = cl.getResource( natives.capnpJavaSchemaPath );

                nativesTable.put( natives.osName, natives.archName, natives );
            }
        }
    }
    catch ( Exception e )
    {
        throw new NativesManagerException( e );
    }
}
 
开发者ID:expretio,项目名称:capnp-maven-plugin,代码行数:51,代码来源:NativesManager.java

示例14: doHandleNativesDependency

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
private void doHandleNativesDependency()
    throws MojoExecutionException
{
    String classifier;

    if ( nativeDependencyClassifier.equals( AUTO_CLASSIFIER_DEFAULT ) )
    {
        Table<String, String, String> indexTable = HashBasedTable.create();

        try
        {
            XMLConfiguration index = new XMLConfiguration();

            index.load( resolve( createNativesIndexArtifact() ) );

            for ( HierarchicalConfiguration indexEntry : index.configurationsAt( "entry" ) )
            {
                String osName = indexEntry.getString( "os-name" );
                String archNames = indexEntry.getString( "arch-names" );
                String mavenClassifier = indexEntry.getString( "maven-classifier" );

                for ( String archName : Splitter.on( ',' ).omitEmptyStrings().trimResults().split( archNames ) )
                {
                    indexTable
                        .put(
                            osName.toUpperCase(),
                            getCanonicalArchitecture( archName ),
                            mavenClassifier );
                }
            }

            classifier =
                indexTable
                    .get(
                        JavaPlatform.getCurrentOs().toString(),
                        getCanonicalArchitecture( JavaPlatform.getCurrentArch() ) );
        }
        catch ( Exception e )
        {
            throw new NativesManagerException( e );
        }
    }
    else
    {
        classifier = nativeDependencyClassifier;
    }

    nativesManager.addResourceUrl( resolve( createNativesArtifact( classifier ) ) );
}
 
开发者ID:expretio,项目名称:capnp-maven-plugin,代码行数:50,代码来源:CapnProtoMojo.java


注:本文中的org.apache.commons.configuration.XMLConfiguration.configurationsAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。