/**
* Process single file
*/
public boolean spooler_process() {
Order order = null;
File inputFile = null;
File outputFile = null;
String inputFileSpec = "";
String url = "";
String contentType = "";
boolean rc = true;
try {
if (this.getOutputDirectory() != null && this.getOutputDirectory().length() > 0) {
outputFile = new File(this.getOutputDirectory());
}
getLogger().debug8("merging parameters...");
mergedVariables = spooler.create_variable_set();
Variable_set env = spooler_task.create_subprocess().env();
//this merge doesn't work:
//mergedVariables.merge(env);
String[] envVars = env.names().split(";");
for (int i =0; i<envVars.length; i++){
String currentName = envVars[i];
mergedVariables.set_var(currentName, env.value(currentName));
}
mergedVariables.merge(spooler_task.params());
// classic or order driven
if (spooler_task.job().order_queue() == null) {
if (!this.inputFileListIterator.hasNext()) return true;
inputFile = (File) this.inputFileListIterator.next();
rc = this.inputFileListIterator.hasNext();
if (inputFile == null)
throw new Exception("empty input file item was found.");
} else {
// input file migth be specified on startup for order driven jobs
if (this.inputFileListIterator != null && this.inputFileListIterator.hasNext()) {
inputFile = (File) this.inputFileListIterator.next();
}
order = spooler_task.order();
mergedVariables.merge(order.params());
if (order.params() != null) {
if ( order.params().value("input") != null && order.params().value("input").toString().length() > 0) {
inputFile = new File(order.params().value("input").toString());
spooler_log.info(".. order parameter [input]: " + order.params().value("input").toString());
} else if ( order.params().value("input_directory") != null && order.params().value("input_directory").toString().length() > 0) {
inputFile = new File(order.params().value("input_directory").toString());
spooler_log.info(".. order parameter [input_directory]: " + order.params().value("input_directory").toString());
}
if ( order.params().value("input_filespec") != null && order.params().value("input_filespec").toString().length() > 0) {
inputFileSpec = order.params().value("input_filespec").toString();
spooler_log.info(".. order parameter [input_filespec]: " + inputFileSpec);
}
if ( order.params().value("output") != null && order.params().value("output").toString().length() > 0) {
outputFile = new File((order.params().value("output").toString()));
spooler_log.info(".. order parameter [output]: " + order.params().value("output").toString());
} else if ( order.params().value("output_directory") != null && order.params().value("output_directory").toString().length() > 0) {
outputFile = new File((order.params().value("output_directory").toString()));
spooler_log.info(".. order parameter [output_directory]: " + order.params().value("output_directory").toString());
}
if ( order.params().value("url") != null && order.params().value("url").toString().length() > 0) {
url = order.params().value("url").toString();
spooler_log.info(".. order parameter [url]: " + url);
}
if ( order.params().value("content_type") != null && order.params().value("content_type").toString().length() > 0) {
contentType = order.params().value("content_type").toString();
spooler_log.info(".. order parameter [content_type]: " + contentType);
}
}
}