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


Java XMLConfiguration.setRootElementName方法代码示例

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


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

示例1: saveIntermediateGMLFile

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public void saveIntermediateGMLFile() throws IOException{ 
	XMLConfiguration configuration = getConfiguration();
	configuration.setRootElementName("gml");
	List<Path> instancePathCollection;
	for(int partitionId : _partitionedTemplates.keySet()){
		configuration.addProperty("partition(-1)[@id]", partitionId);
		configuration.addProperty("partition.template", _partitionedTemplates.get(partitionId).toFile().getAbsolutePath());

		instancePathCollection = _partitionedInstances.get(partitionId);
		for(Path instancePath : instancePathCollection){
			configuration.addProperty("partition.instances.instance(-1)", instancePath.toFile().getAbsolutePath());
		}
	}

	try {
		File partitionedGMLFileDir = _workingDirPath.resolve(_intermediateGMLInputFile).toFile();
		configuration.save(partitionedGMLFileDir);
		System.out.println("saving the partitioned gml information to " + partitionedGMLFileDir.getAbsolutePath());
	} catch (ConfigurationException e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:dream-lab,项目名称:goffish_v2,代码行数:23,代码来源:GMLPartitionBuilder.java

示例2: loadDrivers

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * Loads the specified drivers resource as an XML stream and parses it to
 * produce a ready-to-register driver provider.
 *
 * @param driversStream stream containing the drivers definitions
 * @param resolver      driver resolver
 * @return driver provider
 * @throws java.io.IOException if issues are encountered reading the stream
 *                             or parsing the driver definitions within
 */
public DefaultDriverProvider loadDrivers(InputStream driversStream,
                                         DriverResolver resolver) throws IOException {
    try {
        XMLConfiguration cfg = new XMLConfiguration();
        cfg.setRootElementName(DRIVERS);
        cfg.setAttributeSplittingDisabled(true);

        cfg.load(driversStream);
        return loadDrivers(cfg, resolver);
    } catch (ConfigurationException e) {
        throw new IOException("Unable to load drivers", e);
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:24,代码来源:XmlDriverLoader.java

示例3: loadDrivers

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * Loads the specified drivers resource as an XML stream and parses it to
 * produce a ready-to-register driver provider.
 *
 * @param driversStream stream containing the drivers definitions
 * @return driver provider
 * @throws java.io.IOException if issues are encountered reading the stream
 *                             or parsing the driver definitions within
 */
public DefaultDriverProvider loadDrivers(InputStream driversStream) throws IOException {
    try {
        XMLConfiguration cfg = new XMLConfiguration();
        cfg.setRootElementName(DRIVERS);
        cfg.setAttributeSplittingDisabled(true);

        cfg.load(driversStream);
        return loadDrivers(cfg);
    } catch (ConfigurationException e) {
        throw new IOException("Unable to load drivers", e);
    }
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:22,代码来源:XmlDriverLoader.java

示例4: createClientConfig

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
private void createClientConfig(StartFloeInfo info, String managerHost, String coordinatorHost)
        throws IOException, ConfigurationException {

    XMLConfiguration config = new XMLConfiguration();
    config.setRootElementName("GopherConfiguration");

    config.setProperty(FLOE_MANAGER, managerHost + ":" + MANAGER_PORT);
    config.setProperty(FLOE_COORDINATOR, coordinatorHost + ":" + COORDINATOR_PORT);

    info.getSourceInfo().sourceNodeTransport.values();

    for (List<TransportInfoBase> b : info.getSourceInfo().sourceNodeTransport.values()) {
        for (TransportInfoBase base : b) {
            String host = base.getParams().get("hostAddress");
            int dataPort = Integer.parseInt(base.getParams().get("tcpListenerPort"));

            int controlPort = Integer.parseInt(base.getControlChannelInfo().getParams().
                    get("tcpListenerPort"));

            config.setProperty(DATA_FLOW_HOST, host);
            config.setProperty(DATA_FLOW_DATA_PORT, dataPort);
            config.setProperty(DATA_FLOW_CONTROL_PORT, controlPort);
            break;
        }
        break;
    }

    config.save(new FileWriter(CONFIG_FILE_PATH));

}
 
开发者ID:dream-lab,项目名称:goffish_v2,代码行数:31,代码来源:DeploymentTool.java

示例5: AbstractGraphConfiguration

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public AbstractGraphConfiguration() {
	config = new XMLConfiguration();
	config.setRootElementName(ROOT_NODE);
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:5,代码来源:AbstractGraphConfiguration.java

示例6: configureJob

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * <p>
 * Configure the execution of the algorithm.
 * 
 * @param jobFilename Name of the KEEL file with properties of the execution
 *  </p>                  
 */

private static void configureJob(String jobFilename) {

	Properties props = new Properties();

	try {
		InputStream paramsFile = new FileInputStream(jobFilename);
		props.load(paramsFile);
		paramsFile.close();			
	}
	catch (IOException ioe) {
		ioe.printStackTrace();
		System.exit(0);
	}
	
	// Files training and test
	String trainFile;
	String testFile;
	StringTokenizer tokenizer = new StringTokenizer(props.getProperty("inputData"));
	tokenizer.nextToken();
	trainFile = tokenizer.nextToken();
	trainFile = trainFile.substring(1, trainFile.length()-1);
	testFile = tokenizer.nextToken();
	testFile = testFile.substring(1, testFile.length()-1);
	
	tokenizer = new StringTokenizer(props.getProperty("outputData"));
	String reportTrainFile = tokenizer.nextToken();
	reportTrainFile = reportTrainFile.substring(1, reportTrainFile.length()-1);
	String reportTestFile = tokenizer.nextToken();
	reportTestFile = reportTestFile.substring(1, reportTestFile.length()-1);	
	String reportRulesFile = tokenizer.nextToken();
	reportRulesFile = reportRulesFile.substring(1, reportRulesFile.length()-1);				
	
	// Algorithm auxiliar configuration
	XMLConfiguration algConf = new XMLConfiguration();
	algConf.setRootElementName("experiment");
	algConf.addProperty("process[@algorithm-type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasAlgorithm");
	algConf.addProperty("process.rand-gen-factory[@type]", "net.sourceforge.jclec.util.random.RanecuFactory");
	algConf.addProperty("process.rand-gen-factory[@seed]", Integer.parseInt(props.getProperty("seed")));
	algConf.addProperty("process.population-size", Integer.parseInt(props.getProperty("population-size")));
	algConf.addProperty("process.max-of-generations", Integer.parseInt(props.getProperty("max-generations")));
	algConf.addProperty("process.max-deriv-size", Integer.parseInt(props.getProperty("max-deriv-size")));
	algConf.addProperty("process.dataset[@type]", "net.sourceforge.jclec.util.dataset.KeelDataSet");
	algConf.addProperty("process.dataset.train-data.file-name", trainFile);
	algConf.addProperty("process.dataset.test-data.file-name", testFile);
	algConf.addProperty("process.species[@type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasSyntaxTreeSpecies");
	algConf.addProperty("process.evaluator[@type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasEvaluator");
	algConf.addProperty("process.provider[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeCreator");
	algConf.addProperty("process.parents-selector[@type]", "net.sourceforge.jclec.selector.RouletteSelector");
	algConf.addProperty("process.recombinator[@type]", "net.sourceforge.jclec.syntaxtree.SyntaxTreeRecombinator");
	algConf.addProperty("process.recombinator[@rec-prob]", Double.parseDouble(props.getProperty("rec-prob")));
	algConf.addProperty("process.recombinator.base-op[@type]", "net.sourceforge.jclec.problem.classification.freitas.FreitasCrossover");
	algConf.addProperty("process.copy-prob", Double.parseDouble(props.getProperty("copy-prob")));
	algConf.addProperty("process.listener[@type]", "net.sourceforge.jclec.problem.classification.freitas.KeelFreitasPopulationReport");
	algConf.addProperty("process.listener.report-dir-name", "./");
	algConf.addProperty("process.listener.train-report-file", reportTrainFile);
	algConf.addProperty("process.listener.test-report-file", reportTestFile);
	algConf.addProperty("process.listener.rules-report-file", reportRulesFile);
	algConf.addProperty("process.listener.global-report-name", "resumen");
	algConf.addProperty("process.listener.report-frequency", 50);

	try {
		algConf.save(new File("configure.txt"));
	} catch (ConfigurationException e) {
		e.printStackTrace();
	}

	net.sourceforge.jclec.RunExperiment.main(new String [] {"configure.txt"});
}
 
开发者ID:triguero,项目名称:Keel3.0,代码行数:77,代码来源:Main.java


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