aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-02-04 14:03:57 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-02-04 14:03:57 +0000
commit9157b45f59fd7f5f2f30f56f6100b0a9a6df8d3f (patch)
tree8459264ad24747e059f3403b3699eebd6bc37ab0
parente446d29fcd5142aeda14683b543c5ea89f3c5ad4 (diff)
downloadpdf-as-3-9157b45f59fd7f5f2f30f56f6100b0a9a6df8d3f.tar.gz
pdf-as-3-9157b45f59fd7f5f2f30f56f6100b0a9a6df8d3f.tar.bz2
pdf-as-3-9157b45f59fd7f5f2f30f56f6100b0a9a6df8d3f.zip
Minor updates for commandline invokation.
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@328 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r--src/main/distribution/pdf-as.bat9
-rw-r--r--src/main/java/at/gv/egiz/pdfas/commandline/Main.java72
-rw-r--r--src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java2
-rw-r--r--src/site/changes.xml1
4 files changed, 61 insertions, 23 deletions
diff --git a/src/main/distribution/pdf-as.bat b/src/main/distribution/pdf-as.bat
index 4f9d641..88eb615 100644
--- a/src/main/distribution/pdf-as.bat
+++ b/src/main/distribution/pdf-as.bat
@@ -1 +1,8 @@
-java -Dpdf-as.work-dir=. -jar ${project.build.finalName}.jar %* \ No newline at end of file
+@echo off
+
+rem Deploy embedded default configuration to current folder
+rem Note: Configuration is not deployed if it already exists.
+rem java -Dpdf-as.work-dir=. -jar ${project.build.finalName}.jar -ddc
+
+rem Start commandline
+java -Dpdf-as.work-dir=. -jar ${project.build.finalName}.jar %*
diff --git a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
index 44a472b..b552a0b 100644
--- a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
+++ b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -214,6 +215,8 @@ public abstract class Main
try
{
+ // force settings preload
+ SettingsReader.getInstance();
// for (int i = 0; i < args.length; i++)
// {
@@ -848,31 +851,58 @@ public abstract class Main
writer.print(" " + PARAMETER_CONNECTOR + " ");
ConnectorInformation[] ci = ConnectorFactory.getConnectorInformationArray();
- for (int i = 0; i < ci.length; i++)
- {
- String id = ci[i].getIdentifier();
- if (!ConnectorFactory.isAvailableForCommandline(id))
- {
- continue;
- }
- writer.print(id);
- if (i < ci.length - 1)
- {
- writer.print("|");
- }
+
+ // prepare list of connectors available for commandline
+ ArrayList ciList = new ArrayList();
+ for (int i = 0; i < ci.length; i++) {
+ String id = ci[i].getIdentifier();
+ if (ConnectorFactory.isAvailableForCommandline(id)) {
+ ciList.add(ci[i]);
+ }
}
+
+ // list available connectors wrapped in <...|...>
+ Iterator ciIt = ciList.iterator();
+ writer.print("<");
+ while (ciIt.hasNext()) {
+ writer.print(((ConnectorInformation) ciIt.next()).getIdentifier());
+ if (ciIt.hasNext()) {
+ writer.print("|");
+ }
+ }
+ writer.print(">");
writer.println();
- for (int i = 0; i < ci.length; i++)
- {
- String id = ci[i].getIdentifier();
- if (!ConnectorFactory.isAvailableForCommandline(id))
- {
- continue;
- }
- writer.println(" " + id + " ... " + ci[i].getDescription());
+
+// for (int i = 0; i < ci.length; i++)
+// {
+// String id = ci[i].getIdentifier();
+// if (!ConnectorFactory.isAvailableForCommandline(id))
+// {
+// continue;
+// }
+// writer.print(id);
+// if (i < ci.length - 1)
+// {
+// writer.print("|");
+// }
+// }
+ ciIt = ciList.iterator();
+ while (ciIt.hasNext()) {
+ ConnectorInformation cinf = (ConnectorInformation) ciIt.next();
+ writer.println(" " + cinf.getIdentifier() + " ... " + cinf.getDescription());
}
- writer.println(" Resp. required UTILity OPTIONS");
+// for (int i = 0; i < ci.length; i++)
+// {
+// String id = ci[i].getIdentifier();
+// if (!ConnectorFactory.isAvailableForCommandline(id))
+// {
+// continue;
+// }
+// writer.println(" " + id + " ... " + ci[i].getDescription());
+// }
+
+ writer.println(" UTILity OPTIONS");
writer.println(" " + PARAMETER_DEPLOY_DEFAULT_CONFIGURATION + " ... deploys the default configuration to the current user's home");
diff --git a/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java b/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java
index 34de789..88e597b 100644
--- a/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java
+++ b/src/main/java/at/gv/egiz/pdfas/utils/ConfigUtils.java
@@ -245,7 +245,7 @@ public final class ConfigUtils {
loggerConfiguration = assertFileSeparator(SettingsReader.CONFIG_PATH) + "log4j.properties";
File loggerConfigFile = new File(loggerConfiguration);
if (!loggerConfigFile.exists()) {
- logger_.info("No PDF-AS logger configured because there is no log4j.properties within the pdf-as work dir. Maybe the logger configuration is handled by an outside application (e.g. a web aplication).");
+ logger_.info("No PDF-AS logger configured because there is no log4j.properties within the pdf-as work dir. Maybe the logger configuration is handled by an outside application (e.g. a web application).");
return;
}
logger_.info("Initializing PDF-AS logger (configuration = \"" + loggerConfiguration + "\").");
diff --git a/src/site/changes.xml b/src/site/changes.xml
index c5b9241..674b19a 100644
--- a/src/site/changes.xml
+++ b/src/site/changes.xml
@@ -14,6 +14,7 @@
-->
<release version="3.0.9-20090203" date="2009-02-04" description="subsequent release">
+ <action dev="tknall" type="fix">Minor updates for commandline invokation.</action>
<action dev="tknall" type="fix">Restored compatibility for old PdfAS.commandline(...) method invokation. This method is used by external tools (Open Office plugin for instance.)</action>
<action dev="tknall" type="add">Some more log messages (e.g. encoding related issues).</action>
<action dev="tknall" type="update">Updating web application (in external invocation mode) enhancing support for being used within an iframe.</action>