Example usage for org.apache.commons.configuration BaseConfiguration getList

List of usage examples for org.apache.commons.configuration BaseConfiguration getList

Introduction

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

Prototype

public List getList(String key) 

Source Link

Usage

From source file:uk.ac.sanger.cgp.wwdocker.workflow.SangerWorkflow.java

@Override
public List filesToPush(File iniFile) {
    List files = new ArrayList();
    files.add(iniFile);/*from w w  w .  j a  v  a 2 s.  c o m*/
    logger.trace(iniFile);
    BaseConfiguration wkflConf = Config.loadConfig(iniFile.getAbsolutePath(), new Character(':'), false);
    if (wkflConf.getBoolean("testMode")) {
        logger.info(iniFile.getAbsolutePath() + " is set as testMode=true, no BAMs to transfer");
    } else {
        // Add construct the paths to the local files
        List analysisIds = wkflConf.getList("tumourAnalysisIds");
        analysisIds.add(wkflConf.getList("controlAnalysisId"));
        List bamFiles = wkflConf.getList("tumourBams");
        bamFiles.add(wkflConf.getList("controlBam"));
        if (analysisIds.size() != bamFiles.size()) {
            throw new RuntimeException(
                    "Number of *AnalysisId[s] is not equal to the number of *Bam[s] in workfile: "
                            + iniFile.getAbsolutePath());
        }
        for (int i = 0; i < analysisIds.size(); i++) {
            String analysisId = (String) analysisIds.get(i);
            String bamFile = (String) bamFiles.get(i);
            File bamPath = new File(
                    config.getString("data_root").concat("/").concat(analysisId).concat("/").concat(bamFile));
            if (!bamPath.exists()) {
                throw new RuntimeException("Unable to find BAM file (" + bamPath.getAbsolutePath()
                        + ") expected from worfile: " + iniFile.getAbsolutePath());
            }
            files.add(bamPath);
        }
    }
    return files;
}