Package org.woped.config.metrics

Examples of org.woped.config.metrics.ConfigurationDocument


   
    try {
      // Since the values of the algorithms could have been changed via the metrics builder,
      // we have to insert them again manually in the configuration.
      // So first remove the current ones and then put the new ones in.
      ConfigurationDocument toBeSavedConfig = (ConfigurationDocument) confMap.get(fileID).copy();
           
      if(toBeSavedConfig.getConfiguration().isSetAlgorithms())
        toBeSavedConfig.getConfiguration().unsetAlgorithms();
      toBeSavedConfig.getConfiguration().addNewAlgorithms();
     
      for(String metricID : algorithmOrigin.keySet())
        if(algorithmOrigin.get(metricID) == fileID) { 
          Algorithm algo = algorithmsMap.get(metricID);
          toBeSavedConfig.getConfiguration().getAlgorithms().addNewAlgorithm().set(algo);
        }
     
      toBeSavedConfig.save(new File(fileMap.get(fileID)), xmlOptions);
      confMap.put(fileID, toBeSavedConfig);
      LoggerManager.info(Constants.CONFIG_LOGGER,
          rb.getString("Exit.Config.SavingSuccess") + ": " + fileMap.get(fileID));
      return true;
    } catch (IOException e) {
View Full Code Here


 
  /**
   * Saves/exports the specified metrics to the specified file
   */
  public boolean save(List<String> metricIDs, File exportFile) {
    ConfigurationDocument confDoc = ConfigurationDocument.Factory.newInstance(xmlOptions);
    confDoc.addNewConfiguration();
    confDoc.getConfiguration().addNewVariables();
    confDoc.getConfiguration().addNewAlgorithms();
    confDoc.getConfiguration().addNewAlgorithmGroups();
   
    for(String metricID : metricIDs){
      if(isVariable(metricID)){ 
        confDoc.getConfiguration().getVariables().addNewVariable();
        confDoc.getConfiguration().getVariables().setVariableArray(
            confDoc.getConfiguration().getVariables().sizeOfVariableArray() - 1,
            variablesMap.get(metricID));
      }
      else if(isAlgorithm(metricID)){
        confDoc.getConfiguration().getAlgorithms().addNewAlgorithm();
        confDoc.getConfiguration().getAlgorithms().setAlgorithmArray(
            confDoc.getConfiguration().getAlgorithms().sizeOfAlgorithmArray() - 1,
            algorithmsMap.get(metricID));
      }
    }
   
    try {
      confDoc.save(exportFile);
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
   
View Full Code Here

   */
  public void addNewMetricFile(String filePath) {
    if(!fileMap.containsValue(filePath))
      fileMap.put(fileMap.size(), filePath);
   
    ConfigurationDocument c = ConfigurationDocument.Factory.newInstance();
    c.addNewConfiguration();
    confMap.put(fileMap.size() - 1, c);
  }
View Full Code Here

TOP

Related Classes of org.woped.config.metrics.ConfigurationDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.