"Start with: soffice -accept=\"socket,host=127.0.0.1,port=" + port + ";urp;\"", connectException);
}
getLog().info("Converting documents from " + sourceDirectory + " to " + outputDirectory + " ...");
try {
DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
for (int inputIndex = 0; inputIndex < sourceNames.length; inputIndex++) {
String inputName = sourceNames[inputIndex];
File inputFile = FileUtils.resolveFile(sourceDirectory, inputName);
for (int formatIndex = 0; formatIndex < outputFormats.length; formatIndex++) {
String format = outputFormats[formatIndex];
String outputName = FileUtils.removeExtension(inputName) + "." + format;
File outputFile = FileUtils.resolveFile(outputDirectory, outputName);
getLog().info("converting " + inputName + " to " + outputName);
converter.convert(inputFile, outputFile);
}
}
} finally {
connection.disconnect();
}