}
public List<PackageContainer> execute() {
String[] plugins = configuration.getStringArray(CONFIG_INPUT_PLUGINS);
log.info("Using plugins: {}", (Object) plugins);
PluginFactory factory = new PluginFactory();
for (String p : plugins) {
try {
factory.registerInputPlugin(p);
} catch (Exception e) {
log.error("Error including input plugin " + p, e);
}
}
String[] packages = configuration.getStringArray(CONFIG_PACKAGES);
log.info("Scanning packages: {}", (Object) packages);
PackageParser parser = new PackageParser();
List<PackageContainer> parsedPackages = new ArrayList<PackageContainer>();
for (String p : packages) {
PackageContainer pk = parser.parse(p, factory);
parsedPackages.add(pk);
}
String confOutputDir = configuration.getString(CONFIG_BASE_OUTPUT_DIR);
if (confOutputDir == null) {
confOutputDir = System.getProperty("java.io.tmpdir");
}
File baseOutputDirectory = new File(confOutputDir);
String[] outputPlugins = configuration
.getStringArray(CONFIG_OUTPUT_PLUGINS);
log.info("Using output plugins: {}", (Object) outputPlugins);
for (String p : outputPlugins) {
try {
String[] splittedPackage = p.split(",");
// identifier is mandatory and it's always the first part
String identifier = splittedPackage[0];
String configResource = splittedPackage.length > 1 ? splittedPackage[1]
: null;
OutputPlugin pl = factory.initOutputPlugin(identifier,
configResource);
pl.process(parsedPackages, baseOutputDirectory);
} catch (Exception e) {
log.error("Error including or executing output plugin " + p, e);
}