public ToolBelt(String configFile) throws FitsConfigurationException {
XMLConfiguration config = null;
try {
config = new XMLConfiguration(configFile);
} catch (ConfigurationException e) {
throw new FitsConfigurationException("Error reading "+configFile,e);
}
tools = new ArrayList<Tool>();
// get number of tools
int size = config.getList("tools.tool[@class]").size();
// for each tools get the class path and any excluded extensions
for(int i=0;i<size;i++) {
String tClass = config.getString("tools.tool("+i+")[@class]");
@SuppressWarnings("unchecked")
List<String> excludes = config.getList("tools.tool("+i+")[@exclude-exts]");
@SuppressWarnings("unchecked")
List<String> includes = config.getList("tools.tool("+i+")[@include-exts]");
Tool t = null;
try {
Class c = Class.forName(tClass);
t = (Tool)c.newInstance();
}
catch(Exception e) {
throw new FitsConfigurationException("Error initializing "+tClass,e);
}
if(t != null) {
for(String ext : excludes) {
t.addExcludedExtension(ext);
}