當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。