Example usage for org.apache.commons.configuration XMLConfiguration XMLConfiguration

List of usage examples for org.apache.commons.configuration XMLConfiguration XMLConfiguration

Introduction

In this page you can find the example usage for org.apache.commons.configuration XMLConfiguration XMLConfiguration.

Prototype

public XMLConfiguration(URL url) throws ConfigurationException 

Source Link

Document

Creates a new instance of XMLConfiguration.

Usage

From source file:org.goobi.production.export.ExportXmlLog.java

private HashMap<String, String> getMetsFieldsFromConfig(boolean useAnchor) {
    String xmlpath = "mets.property";
    if (useAnchor) {
        xmlpath = "anchor.property";
    }/*  ww w .j av a 2s  .c o  m*/

    HashMap<String, String> fields = new HashMap<>();
    try {
        File file = new File(ConfigCore.getKitodoConfigDirectory() + "kitodo_exportXml.xml");
        if (file.exists() && file.canRead()) {
            XMLConfiguration config = new XMLConfiguration(file);
            config.setListDelimiter('&');
            config.setReloadingStrategy(new FileChangedReloadingStrategy());

            int count = config.getMaxIndex(xmlpath);
            for (int i = 0; i <= count; i++) {
                String name = config.getString(xmlpath + "(" + i + ")[@name]");
                String value = config.getString(xmlpath + "(" + i + ")[@value]");
                fields.put(name, value);
            }
        }
    } catch (Exception e) {
        fields = new HashMap<>();
    }
    return fields;
}

From source file:org.goobi.production.export.ExportXmlLog.java

private HashMap<String, String> getNamespacesFromConfig() {
    HashMap<String, String> nss = new HashMap<>();
    try {/*  w w  w.  j av  a2 s .  c om*/
        File file = new File(ConfigCore.getKitodoConfigDirectory() + "kitodo_exportXml.xml");
        if (file.exists() && file.canRead()) {
            XMLConfiguration config = new XMLConfiguration(file);
            config.setListDelimiter('&');
            config.setReloadingStrategy(new FileChangedReloadingStrategy());

            int count = config.getMaxIndex("namespace");
            for (int i = 0; i <= count; i++) {
                String name = config.getString("namespace(" + i + ")[@name]");
                String value = config.getString("namespace(" + i + ")[@value]");
                nss.put(name, value);
            }
        }
    } catch (Exception e) {
        nss = new HashMap<>();
    }
    return nss;

}

From source file:org.goobi.production.importer.GoobiHotfolder.java

/**
 * Get instances./*from  w  w  w. j  a v  a2 s  .co  m*/
 *
 * @return list of GoobiHotfolder objects
 */
public static List<GoobiHotfolder> getInstances() {
    logger.trace("config 1");
    List<GoobiHotfolder> answer = new ArrayList<>();
    logger.trace("config 2");

    try {
        XMLConfiguration config = new XMLConfiguration(
                ConfigCore.getKitodoConfigDirectory() + "kitodo_hotfolder.xml");

        logger.trace("config 3");

        config.setListDelimiter('&');

        logger.trace("config 4");
        config.setReloadingStrategy(new FileChangedReloadingStrategy());
        logger.trace("config 5");

        int count = config.getMaxIndex("hotfolder");
        logger.trace("config 6");

        for (int i = 0; i <= count; i++) {

            logger.trace("config 7");
            String name = config.getString("hotfolder(" + i + ")[@name]");
            logger.trace("config 8");
            URI folder = URI.create(config.getString("hotfolder(" + i + ")[@folder]"));
            logger.trace("config 9");
            Integer template = config.getInt("hotfolder(" + i + ")[@template]");
            logger.trace("config 10");

            String updateStrategy = config.getString("hotfolder(" + i + ")[@updateStrategy]");
            logger.trace("config 11");
            String collection = config.getString("hotfolder(" + i + ")[@collection]");
            logger.trace("config 12");
            if (name == null || name.equals("") || template == null) {
                logger.trace("config 13");
                break;
            }
            logger.trace("config 14");
            if (updateStrategy == null || updateStrategy.equals("")) {
                logger.trace("config 15");
                updateStrategy = "ignore";
            }
            if (collection.equals("")) {
                logger.trace("config 16");
                collection = null;
            }
            logger.trace("config 17");
            answer.add(new GoobiHotfolder(name, folder, template, updateStrategy, collection));
        }
        logger.trace("config 18");

    } catch (Exception e) {
        if (logger.isTraceEnabled()) {
            logger.trace("config 19" + e.getMessage());
        }
        return new ArrayList<>();
    }
    logger.trace("config 20");
    return answer;
}

From source file:org.goobi.production.properties.PropertyParser.java

/**
 * Get properties for task./*  w  w w. j a  v  a2  s . c o  m*/
 *
 * @param mySchritt
 *            Task object
 * @return list of ProcessProperty objects
 */
public static ArrayList<ProcessProperty> getPropertiesForStep(Task mySchritt) {
    Hibernate.initialize(mySchritt.getProcess());
    Hibernate.initialize(mySchritt.getProcess().getProject());
    String stepTitle = mySchritt.getTitle();
    String projectTitle = mySchritt.getProcess().getProject().getTitle();
    ArrayList<ProcessProperty> properties = new ArrayList<>();

    if (mySchritt.getProcess().isTemplate()) {
        return properties;
    }

    String path = ConfigCore.getKitodoConfigDirectory() + "kitodo_processProperties.xml";
    XMLConfiguration config;
    try {
        config = new XMLConfiguration(path);
    } catch (ConfigurationException e) {
        logger.error(e);
        config = new XMLConfiguration();
    }
    config.setListDelimiter('&');
    config.setReloadingStrategy(new FileChangedReloadingStrategy());

    // run though all properties
    int countProperties = config.getMaxIndex("property");
    for (int i = 0; i <= countProperties; i++) {

        // general values for property
        ProcessProperty pp = new ProcessProperty();
        pp.setName(config.getString("property(" + i + ")[@name]"));
        pp.setContainer(config.getInt("property(" + i + ")[@container]"));

        // projects
        int count = config.getMaxIndex("property(" + i + ").project");
        for (int j = 0; j <= count; j++) {
            pp.getProjects().add(config.getString("property(" + i + ").project(" + j + ")"));
        }

        // project is configured
        if (pp.getProjects().contains("*") || pp.getProjects().contains(projectTitle)) {

            // showStep
            boolean containsCurrentStepTitle = false;
            count = config.getMaxIndex("property(" + i + ").showStep");
            for (int j = 0; j <= count; j++) {
                ShowStepCondition ssc = new ShowStepCondition();
                ssc.setName(config.getString("property(" + i + ").showStep(" + j + ")[@name]"));
                String access = config.getString("property(" + i + ").showStep(" + j + ")[@access]");
                boolean duplicate = config.getBoolean("property(" + i + ").showStep(" + j + ")[@duplicate]",
                        false);
                ssc.setAccessCondition(AccessCondition.getAccessConditionByName(access));
                if (ssc.getName().equals(stepTitle)) {
                    containsCurrentStepTitle = true;
                    pp.setDuplicationAllowed(duplicate);
                    pp.setCurrentStepAccessCondition(AccessCondition.getAccessConditionByName(access));
                }

                pp.getShowStepConditions().add(ssc);
            }

            // steptitle is configured
            if (containsCurrentStepTitle) {
                // showProcessGroupAccessCondition
                String groupAccess = config.getString("property(" + i + ").showProcessGroup[@access]");
                if (groupAccess != null) {
                    pp.setShowProcessGroupAccessCondition(
                            AccessCondition.getAccessConditionByName(groupAccess));
                } else {
                    pp.setShowProcessGroupAccessCondition(AccessCondition.WRITE);
                }

                // validation expression
                pp.setValidation(config.getString("property(" + i + ").validation"));
                // type
                pp.setType(Type.getTypeByName(config.getString("property(" + i + ").type")));
                // (default) value
                pp.setValue(config.getString("property(" + i + ").defaultvalue"));

                // possible values
                count = config.getMaxIndex("property(" + i + ").value");
                for (int j = 0; j <= count; j++) {
                    pp.getPossibleValues().add(config.getString("property(" + i + ").value(" + j + ")"));
                }
                properties.add(pp);
            }
        }
    }

    // add existing 'eigenschaften' to properties from config, so we have
    // all properties from config and
    // some of them with already existing 'eigenschaften'
    ArrayList<ProcessProperty> listClone = new ArrayList<>(properties);
    List<Property> propertyList = mySchritt.getProcess().getProperties();
    for (Property processProperty : propertyList) {

        for (ProcessProperty pp : listClone) {
            // TODO added temporarily a fix for NPE. Properties without
            // title shouldn't exist at all
            if (processProperty.getTitle() != null) {

                if (processProperty.getTitle().equals(pp.getName())) {
                    // pp has no pe assigned
                    if (pp.getProzesseigenschaft() == null) {
                        pp.setProzesseigenschaft(processProperty);
                        pp.setValue(processProperty.getValue());
                        pp.setContainer(processProperty.getContainer());
                    } else {
                        // clone pp
                        ProcessProperty pnew = pp.getClone(processProperty.getContainer());
                        pnew.setProzesseigenschaft(processProperty);
                        pnew.setValue(processProperty.getValue());
                        pnew.setContainer(processProperty.getContainer());
                        properties.add(pnew);
                    }
                }
            }
        }
    }
    return properties;
}

From source file:org.goobi.production.properties.PropertyParser.java

/**
 * Get properties for process./*from  w  w  w .j  a  v a  2s .c  om*/
 *
 * @param process
 *            object
 * @return ProcessProperty object
 */
public static ArrayList<ProcessProperty> getPropertiesForProcess(Process process) {
    Hibernate.initialize(process.getProject());
    String projectTitle = process.getProject().getTitle();
    ArrayList<ProcessProperty> properties = new ArrayList<>();
    if (process.isTemplate()) {
        List<Property> propertyList = process.getProperties();
        for (Property processProperty : propertyList) {
            ProcessProperty pp = new ProcessProperty();
            pp.setName(processProperty.getTitle());
            pp.setProzesseigenschaft(processProperty);
            pp.setType(Type.TEXT);
            pp.setValue(processProperty.getValue());
            pp.setContainer(processProperty.getContainer());
            properties.add(pp);
        }
        return properties;
    }
    String path = ConfigCore.getKitodoConfigDirectory() + "kitodo_processProperties.xml";
    XMLConfiguration config;
    try {
        config = new XMLConfiguration(path);
    } catch (ConfigurationException e) {
        logger.error(e);
        config = new XMLConfiguration();
    }
    config.setListDelimiter('&');
    config.setReloadingStrategy(new FileChangedReloadingStrategy());

    // run though all properties
    int countProperties = config.getMaxIndex("property");
    for (int i = 0; i <= countProperties; i++) {

        // general values for property
        ProcessProperty pp = new ProcessProperty();
        pp.setName(config.getString("property(" + i + ")[@name]"));
        pp.setContainer(config.getInt("property(" + i + ")[@container]"));

        // projects
        int count = config.getMaxIndex("property(" + i + ").project");
        for (int j = 0; j <= count; j++) {
            pp.getProjects().add(config.getString("property(" + i + ").project(" + j + ")"));
        }

        // project is configured
        if (pp.getProjects().contains("*") || pp.getProjects().contains(projectTitle)) {

            // validation expression
            pp.setValidation(config.getString("property(" + i + ").validation"));
            // type
            pp.setType(Type.getTypeByName(config.getString("property(" + i + ").type")));
            // (default) value
            pp.setValue(config.getString("property(" + i + ").defaultvalue"));

            // possible values
            count = config.getMaxIndex("property(" + i + ").value");
            for (int j = 0; j <= count; j++) {
                pp.getPossibleValues().add(config.getString("property(" + i + ").value(" + j + ")"));
            }
            if (logger.isDebugEnabled()) {
                logger.debug(
                        "add property A " + pp.getName() + " - " + pp.getValue() + " - " + pp.getContainer());
            }
            properties.add(pp);

        }
    }
    // add existing 'eigenschaften' to properties from config, so we have
    // all properties from config and some
    // of them with already existing 'eigenschaften'
    List<ProcessProperty> listClone = new ArrayList<>(properties);
    List<Property> propertyList = process.getProperties();
    for (Property processProperty : propertyList) {
        // TODO added temporarily a fix for NPE. Properties without title
        // shouldn't exist at all
        if (processProperty.getTitle() != null) {

            for (ProcessProperty pp : listClone) {
                if (processProperty.getTitle().equals(pp.getName())) {
                    // pp has no pe assigned
                    if (pp.getProzesseigenschaft() == null) {
                        pp.setProzesseigenschaft(processProperty);
                        pp.setValue(processProperty.getValue());
                        pp.setContainer(processProperty.getContainer());
                    } else {
                        // clone pp
                        ProcessProperty pnew = pp.getClone(processProperty.getContainer());
                        pnew.setProzesseigenschaft(processProperty);
                        pnew.setValue(processProperty.getValue());
                        pnew.setContainer(processProperty.getContainer());
                        if (logger.isDebugEnabled()) {
                            logger.debug("add property B " + pp.getName() + " - " + pp.getValue() + " - "
                                    + pp.getContainer());
                        }
                        properties.add(pnew);
                    }
                }
            }
        }
    }

    // add 'eigenschaft' to all ProcessProperties
    for (ProcessProperty pp : properties) {
        if (pp.getProzesseigenschaft() != null) {
            propertyList.remove(pp.getProzesseigenschaft());
        }
    }
    // create ProcessProperties to remaining 'eigenschaften'
    if (propertyList.size() > 0) {
        for (Property processProperty : propertyList) {
            ProcessProperty pp = new ProcessProperty();
            pp.setProzesseigenschaft(processProperty);
            pp.setName(processProperty.getTitle());
            pp.setValue(processProperty.getValue());
            pp.setContainer(processProperty.getContainer());
            pp.setType(Type.TEXT);
            if (logger.isDebugEnabled()) {
                logger.debug(
                        "add property C " + pp.getName() + " - " + pp.getValue() + " - " + pp.getContainer());
            }
            properties.add(pp);

        }
    }
    if (logger.isDebugEnabled()) {
        logger.debug("all properties are " + properties.size());
    }

    return properties;
}

From source file:org.grycap.gpf4med.conf.ConfigurationManager.java

private ConfigurationManager.Configuration configuration() {
    if (dont_use == null) {
        synchronized (ConfigurationManager.Configuration.class) {
            if (dont_use == null && urls != null) {
                try {
                    XMLConfiguration main = null;
                    // sorting secondary configurations ensures that combination 
                    // always result the same
                    final SortedMap<String, XMLConfiguration> secondary = new TreeMap<String, XMLConfiguration>();
                    // extract main configuration
                    for (final URL url : urls) {
                        final String filename = FilenameUtils.getName(url.getPath());
                        if (MAIN_CONFIGURATION.equalsIgnoreCase(filename)) {
                            main = new XMLConfiguration(url);
                            LOGGER.info("Loading main configuration from: " + url.toString());
                        } else if (!IGNORE_LIST.contains(FilenameUtils.getName(url.getPath()))) {
                            secondary.put(filename, new XMLConfiguration(url));
                            LOGGER.info("Loading secondary configuration from: " + url.toString());
                        } else {
                            LOGGER.info("Ignoring: " + url.toString());
                        }/*from  w w  w.  j av  a 2s . co m*/
                    }
                    if (main != null) {
                        final CombinedConfiguration configuration = new CombinedConfiguration(
                                new OverrideCombiner());
                        configuration.addConfiguration(main, MAIN_CONFIGURATION);
                        for (final Map.Entry<String, XMLConfiguration> entry : secondary.entrySet()) {
                            configuration.addConfiguration(entry.getValue(), entry.getKey());
                        }
                        if (LOGGER.isDebugEnabled()) {
                            String names = "";
                            for (final String name : configuration.getConfigurationNameList()) {
                                names += name + " ";
                            }
                            LOGGER.trace("Loading configuration from: " + names);
                        }
                        final List<String> foundNameList = new ArrayList<String>();
                        // get main property will fail if the requested property is missing
                        configuration.setThrowExceptionOnMissing(true);
                        final File rootDir = getFile("gpf4med-root", configuration, foundNameList, true, null);
                        final URL templatesUrl = getUrl("storage.templates", configuration, foundNameList,
                                null);
                        final URL connectorsUrl = getUrl("storage.connectors", configuration, foundNameList,
                                null);
                        final File localCacheDir = getFile("storage.local-cache", configuration, foundNameList,
                                true, null);
                        final File htdocsDir = getFile("storage.htdocs", configuration, foundNameList, false,
                                null);
                        final boolean encryptLocalStorage = getBoolean("security.encrypt-local-storage",
                                configuration, foundNameList, true);
                        final boolean useStrongCryptography = getBoolean("security.use-strong-cryptography",
                                configuration, foundNameList, false);
                        final String templatesVersion = getString("dicom.version", configuration, foundNameList,
                                null);
                        final URL templatesIndex = getUrl("dicom.index", configuration, foundNameList, null);
                        final String connectorsVersion = getString("graph.version", configuration,
                                foundNameList, null);
                        final URL connectorsIndex = getUrl("graph.index", configuration, foundNameList, null);
                        // get secondary property will return null if the requested property is missing
                        configuration.setThrowExceptionOnMissing(false);
                        final String containerHostname = getString("service-container.hostname", configuration,
                                foundNameList, null);
                        final int containerPort = getInteger("service-container.port", configuration,
                                foundNameList, new Integer(8080));
                        final String enactorProvider = getString("enactor.provider", configuration,
                                foundNameList, null);
                        final File enactorIdentity = getFile("enactor.identity", configuration, foundNameList,
                                false, null);
                        final File enactorCredential = getFile("enactor.credential", configuration,
                                foundNameList, false, null);
                        final String serverVersion = getString("container-server.version", configuration,
                                foundNameList, null);
                        final URL serverInstallerUrl = getUrl("container-server.installer.url", configuration,
                                foundNameList, null);
                        final File serverHome = getFile("container-server.home", configuration, foundNameList,
                                false, null);

                        // Add this for read the TRENCADIS configuration
                        final File trencadisConfiguration = getFile("trencadis.config-file", configuration,
                                foundNameList, false, null);
                        final String trencadisPassword = getString("trencadis.pass", configuration,
                                foundNameList, null);

                        // get other (free-format) properties
                        final Iterator<String> keyIterator = configuration.getKeys();
                        final Map<String, String> othersMap = new Hashtable<String, String>();
                        while (keyIterator.hasNext()) {
                            final String key = keyIterator.next();
                            if (key != null && !foundNameList.contains(key)) {
                                final String value = configuration.getString(key);
                                if (value != null) {
                                    othersMap.put(key, value);
                                }
                            }
                        }
                        dont_use = new Configuration(rootDir, templatesUrl, connectorsUrl, localCacheDir,
                                htdocsDir, encryptLocalStorage, useStrongCryptography, templatesVersion,
                                templatesIndex, connectorsVersion, connectorsIndex, containerHostname,
                                containerPort, enactorProvider, enactorIdentity, enactorCredential,
                                serverVersion, serverInstallerUrl, serverHome, trencadisConfiguration,
                                trencadisPassword, othersMap);
                        LOGGER.info(dont_use.toString());
                    } else {
                        throw new IllegalStateException("Main configuration not found");
                    }
                } catch (IllegalStateException e1) {
                    throw e1;
                } catch (ConfigurationException e2) {
                    throw new IllegalStateException(e2);
                } catch (Exception e) {
                    LOGGER.error("Failed to load configuration", e);
                }
            }
        }
    }
    return dont_use;
}

From source file:org.ihtsdo.classifier.ClassificationRunner.java

@SuppressWarnings("unchecked")
private void getParams() throws ConfigurationException {

    try {//from w  ww . ja  v a  2 s.  c  o  m
        xmlConfig = new XMLConfiguration(config);
    } catch (ConfigurationException e) {
        logger.info("ClassificationRunner - Error happened getting params file." + e.getMessage());
        throw e;
    }

    this.module = xmlConfig.getString(I_Constants.MODULEID);
    this.releaseDate = xmlConfig.getString(I_Constants.RELEASEDATE);
    this.equivalencyReport = xmlConfig.getString(I_Constants.EQUIVALENT_CONCEPTS_OUTPUT_FILE);
    this.newInferredRelationships = xmlConfig.getString(I_Constants.INFERRED_RELATIONSHIPS_OUTPUT_FILE);
    concepts = xmlConfig.getList(I_Constants.CONCEPT_SNAPSHOT_FILES);

    statedRelationships = xmlConfig.getList(I_Constants.RELATIONSHIP_SNAPSHOT_FILES);

    previousInferredRelationships = xmlConfig.getList(I_Constants.PREVIOUS_INFERRED_RELATIONSHIP_FILES);
    logger.info("Classification - Parameters:");
    logger.info("Module = " + module);
    logger.info("Release date = " + releaseDate);
    logger.info("Equivalent Concept Output file = " + equivalencyReport);
    logger.info("Previous Inferred Relationship file = " + previousInferredRelationships);
    logger.info("Inferred Relationship Output file = " + newInferredRelationships);
    logger.info("Concept files : ");
    for (String concept : concepts) {
        logger.info(concept);
    }
    logger.info("Stated Relationship files : ");
    for (String relFile : statedRelationships) {
        logger.info(relFile);
    }
    logger.info("Previous Relationship files : ");
    if (previousInferredRelationships != null) {
        for (String relFile : previousInferredRelationships) {
            logger.info(relFile);
        }
    }
}

From source file:org.ihtsdo.classifier.CycleCheck.java

@SuppressWarnings("unchecked")
private void getParams() throws ConfigurationException {

    try {//  w  w  w .j ava  2 s .  c o  m
        xmlConfig = new XMLConfiguration(config);
    } catch (ConfigurationException e) {
        logger.info("CycleCheck - Error happened getting params file." + e.getMessage());
        throw e;
    }
    conceptFilePaths = xmlConfig.getList(I_Constants.CONCEPT_SNAPSHOT_FILES);
    relationshipFilePaths = xmlConfig.getList(I_Constants.RELATIONSHIP_SNAPSHOT_FILES);
    outputFile = xmlConfig.getString(I_Constants.DETECTED_CYCLE_OUTPUT_FILE);

    logger.info("CheckCycle - Parameters:");
    logger.info("Concept files : ");
    for (String concept : conceptFilePaths) {
        logger.info(concept);
    }
    logger.info("Relationship files : ");
    for (String relFile : relationshipFilePaths) {
        logger.info(relFile);
    }
    logger.info("Detected cycle output file = " + outputFile);

}

From source file:org.ihtsdo.statistics.db.importer.ImportManager.java

/**
 * Execute.// w  w  w.ja v a  2 s .com
 *
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws Exception the exception
 */
public void execute() throws IOException, Exception {
    logger.info("Starting import manager process");

    createFolders();
    importer = new Importer();
    if (!existingTables()) {
        DbSetup dbSetup = new DbSetup(connection);
        dbSetup.execute();
        dbSetup = null;
    }
    XMLConfiguration xmlConfig;
    try {
        xmlConfig = new XMLConfiguration(configFile);
    } catch (ConfigurationException e) {
        logger.error("ClassificationRunner - Error happened getting params configFile." + e.getMessage());
        throw e;
    }

    releaseDependencies = CurrentFile.get().getReleaseDependenciesFullFolders() != null;
    this.releaseDate = xmlConfig.getString("releaseDate");
    this.previousReleaseDate = xmlConfig.getString("previousReleaseDate");

    this.reducedSnapshotFolder = new File("reducedSnapshotFolder");
    if (!reducedSnapshotFolder.exists()) {
        reducedSnapshotFolder.mkdirs();
    }
    this.previousReducedSnapshotFolder = new File("previousReducedSnapshotFolder");
    if (!previousReducedSnapshotFolder.exists()) {
        previousReducedSnapshotFolder.mkdirs();
    }

    List<HierarchicalConfiguration> fields = xmlConfig.configurationsAt("reports.reportDescriptor");

    if (fields != null) {
        for (HierarchicalConfiguration sub : fields) {

            String report = sub.getString("filename");
            String value = sub.getString("execute");

            if (value.toLowerCase().equals("true")) {
                logger.info("Getting config for report " + report);
                ReportConfig reportCfg = ResourceUtils.getReportConfig(report);

                for (TABLE table : reportCfg.getInputFile()) {
                    switch (table) {
                    case STATEDROOTDESC:
                        if (rootDesc) {
                            continue;
                        }
                        rootDesc = true;
                        break;
                    case CONCEPTS:
                        if (concepts) {
                            continue;
                        }
                        concepts = true;
                        break;

                    case DESCRIPTIONS:
                        if (descriptions) {
                            continue;
                        }
                        descriptions = true;
                        break;
                    case DESCRIPTIONS_PREVIOUS:
                        if (descriptions_pre) {
                            continue;
                        }
                        descriptions_pre = true;
                        break;

                    case RELATIONSHIPS:
                        if (relationships) {
                            continue;
                        }
                        relationships = true;
                        break;

                    case STATEDRELS:
                        if (statedRels) {
                            continue;
                        }
                        statedRels = true;
                        break;

                    case TCLOSUREINFERRED:
                        if (tClosureInferred) {
                            continue;
                        }
                        tClosureInferred = true;
                        break;

                    case TCLOSURESTATED:
                        if (tClosureStated) {
                            continue;
                        }
                        tClosureStated = true;
                        break;

                    case CONCEPTS_PREVIOUS:
                        if (concepts_pre) {
                            continue;
                        }
                        concepts_pre = true;
                        break;
                    case RELATIONSHIPS_PREVIOUS:
                        if (relationships_pre) {
                            continue;
                        }
                        relationships_pre = true;
                        break;
                    case STATEDRELS_PREVIOUS:
                        if (statedRels_pre) {
                            continue;
                        }
                        statedRels_pre = true;
                        break;

                    case TCLOSURESTATED_PREVIOUS:
                        if (tClosureStated_pre) {
                            continue;
                        }
                        tClosureStated_pre = true;
                        break;
                    case SAME_AS_ASSOCIATIONS:
                        if (same_associations) {
                            continue;
                        }
                        same_associations = true;
                        break;
                    }
                    ImportRf2Table(table);
                }
                System.out.println(report + " " + value);
            }
        }
    }
    logger.info("Updating date to " + releaseDate);
    saveNewDate(I_Constants.RELEASE_DATE, releaseDate);

    logger.info("Updating previous date to " + previousReleaseDate);
    saveNewDate(I_Constants.PREVIOUS_RELEASE_DATE, previousReleaseDate);

    fields = xmlConfig.configurationsAt("sp_params.param");

    params = new HashMap<String, String>();
    if (fields != null) {
        for (HierarchicalConfiguration sub : fields) {
            String paramName = sub.getString("name");
            String value = sub.getString("value");
            params.put(paramName, value);
        }
    }
    logger.info("End of import manager process");
}

From source file:org.ihtsdo.statistics.Processor.java

/**
 * Execute./*from w w w . j a v a2 s  .c om*/
 *
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws Exception the exception
 */
public void execute() throws IOException, Exception {
    logger.logInfo("Starting report execution");
    createFolders();
    XMLConfiguration xmlConfig;
    try {
        xmlConfig = new XMLConfiguration(configFile);
    } catch (ConfigurationException e) {
        logger.logInfo("ClassificationRunner - Error happened getting params configFile." + e.getMessage());
        throw e;
    }
    createDetails = xmlConfig.getString("createDetailReports");
    List<HierarchicalConfiguration> fields = xmlConfig.configurationsAt("reports.reportDescriptor");

    for (HierarchicalConfiguration sub : fields) {

        String report = sub.getString("filename");
        String value = sub.getString("execute");

        if (value.toLowerCase().equals("true")) {
            logger.logInfo("Getting report config for " + report);
            ReportConfig reportCfg = ResourceUtils.getReportConfig(report);
            logger.logInfo("Executing report " + report);
            long start = logger.startTime();
            executeReport(reportCfg);

            logger.logInfo("Writing report " + report);
            writeReports(reportCfg, report);

            String msg = logger.endTime(start);
            int posIni = msg.indexOf("ProcessingTime:") + 16;
            ReportInfo rInfo = new ReportInfo();
            rInfo.setName(reportCfg.getName());
            if (reportCfg.getOutputFile() != null) {
                for (OutputFileTableMap file : reportCfg.getOutputFile()) {
                    rInfo.getOutputFiles().add(file.getFile());
                }
            }
            if (reportCfg.getOutputDetailFile() != null) {
                for (OutputDetailFile file : reportCfg.getOutputDetailFile()) {
                    rInfo.getOutputDetailFiles().add(file.getFile());
                }
            }
            rInfo.setTimeTaken(msg.substring(posIni));
            OutputInfoFactory.get().getStatisticProcess().getReports().add(rInfo);
        }
        //            System.out.println(report + " " + value);
    }
}