System.exit(1);
}
}
Environment env = Application.getEnvironment();
DataProcessor process = new DataProcessor();
for (String task : tasks) {
// TODO: With Java7 we can make this a switch case
if (task.equals("stage")) {
process.stage(env.getStagingDirectory(), env.getWorkingDirectory());
}
else if (task.equals("collate")) {
process.collate(env.getWorkingDirectory());
}
else if (task.equals("ingest")) {
process.ingest(env.getWorkingDirectory(), Application.getStorage());
if (changeFile != null) {
ChangeLogger.writeToFile(changeFile);
}
}
else if (task.equals("push")) {
if (ChangeLogger.getChangeLog().isEmpty()) {
if (changeFile != null) {
ChangeLogger.readFromFile(changeFile);
}
else {
System.err.println("Unable to push with an empty change log.");
}
}
process.push(Application.getStorage(), ChangeLogger.getEntries(), services);
}
else if (task.equalsIgnoreCase("archive")) {
process.archive(env.getWorkingDirectory(), env.getArchiveDirectory());
}
else {
System.err.println("Invalid task.");
System.exit(1);
}