All - not sure if I'm on the right track with this or not, but here's what I have so far.
We have a processor that needs to go through and handle a series of files we specify in a config file.
XMLConfiguration config = new XMLConfiguration(CONFIG_FILE_DIR);
if (config != null) {
String filePath = config.getString("files.file.filepath");
String inputFile = config.getString("files.file.inputfile");
String outputFile = config.getString("files.file.outputfile");
String cellRange = config.getString("files.file.cellrange");
translateXLS(filePath, inputFile, outputFile, cellRange);
}
else {
System.out.println("CONFIG NOT SET");
}
The translate XLS method works great, and goes ahead and processes whatever file we gave it from a config file.
We have a bit of a problem when we want it to process multiple files though, as it will just simply take the last entry and use that. Obviously I don't have any looping mechanisms or arrays in place so that makes sense, but I am wondering if I need to use XPath or something along those lines to handle a sample config below:
<xml version="1.0" encoding="UTF-8">
<files>
<file>
<filepath>C:\sample\</filepath>
<inputfile>1.xls</inputfile>
<outputfile>1out.out</outputfile>
<cellrange>F1:I2</cellrange>
</file>
<file>
<filepath>C:\sample\</filepath>
<inputfile>2.xls</inputfile>
<outputfile>2out.out</outputfile>
<cellrange>A1:J2</cellrange>
</file>
</files>
</xml>
What would be the best option for storing something like a list or array of configs to loop through and perform actions on all files within the same config.xml?
I have mainly been using this for a reference. Technically I can set up something like the indexes they use here, but I would have to hard code exactly how many entries I have. It'd be nice if it were flexible enough to just go through every entry.
http://www.code-thrill.com/2012/05/configuration-that-rocks-with-apache.html