summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src
diff options
context:
space:
mode:
authorTobias Kellner <imcybot@gmail.com>2015-10-12 04:27:31 +0200
committerTobias Kellner <imcybot@gmail.com>2015-10-12 04:27:31 +0200
commit7a353422c92187b643377939ebd19429ab66e4bf (patch)
treeff5b93acc3891d9b7506c8929c3dcf7320f9f4ea /pdf-over-gui/src
parenteeb3ec439e67085c04849e24446936eba1d8171e (diff)
downloadmocca-7a353422c92187b643377939ebd19429ab66e4bf.tar.gz
mocca-7a353422c92187b643377939ebd19429ab66e4bf.tar.bz2
mocca-7a353422c92187b643377939ebd19429ab66e4bf.zip
Add keystore file argument
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreFileArgument.java68
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java17
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties2
-rw-r--r--pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties2
4 files changed, 74 insertions, 15 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreFileArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreFileArgument.java
new file mode 100644
index 00000000..e24f1663
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreFileArgument.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://joinup.ec.europa.eu/software/page/eupl
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ */
+package at.asit.pdfover.gui.cliarguments;
+
+// Imports
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.asit.pdfover.gui.exceptions.InitializationException;
+import at.asit.pdfover.gui.utils.Messages;
+
+/**
+ * CLI Argument to provide the keystore file
+ */
+public class KeystoreFileArgument extends Argument {
+ /**
+ * Constructor
+ */
+ public KeystoreFileArgument() {
+ super(new String[] {"-ks"}, "argument.help.keystorefile"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * SLF4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory
+ .getLogger(KeystoreFileArgument.class);
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.cliarguments.CLIArgument#handleArgument(java.lang.String[], int, at.asit.pdfover.gui.workflow.StateMachine, at.asit.pdfover.gui.cliarguments.ArgumentHandler)
+ */
+ @Override
+ public int handleArgument(String[] args, int argOffset,
+ ArgumentHandler handler)
+ throws InitializationException {
+ try {
+ if (args.length > argOffset + 1) {
+
+ String ksFile = args[argOffset + 1];
+
+ getConfiguration().setKeyStoreFileOverlay(ksFile);
+
+ return argOffset + 1;
+ }
+ } catch (Exception ex) {
+ log.error("Keystore file argument invalid!", ex); //$NON-NLS-1$
+ throw new InitializationException(
+ Messages.getString("argument.invalid.keystorefile") + this.getHelpText(), ex); //$NON-NLS-1$
+ }
+
+ throw new InitializationException(
+ Messages.getString("argument.invalid.keystorefile") + this.getHelpText(), null); //$NON-NLS-1$
+ }
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
index 3e5e7a2c..c919a9c4 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
@@ -40,21 +40,7 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.Constants;
import at.asit.pdfover.gui.bku.BKUHelper;
-import at.asit.pdfover.gui.cliarguments.ArgumentHandler;
-import at.asit.pdfover.gui.cliarguments.AutomaticPositioningArgument;
-import at.asit.pdfover.gui.cliarguments.BKUArgument;
-import at.asit.pdfover.gui.cliarguments.ConfigFileArgument;
-import at.asit.pdfover.gui.cliarguments.EmblemArgument;
-import at.asit.pdfover.gui.cliarguments.HelpArgument;
-import at.asit.pdfover.gui.cliarguments.InputDocumentArgument;
-import at.asit.pdfover.gui.cliarguments.OutputFolderArgument;
-import at.asit.pdfover.gui.cliarguments.PasswordArgument;
-import at.asit.pdfover.gui.cliarguments.PhoneNumberArgument;
-import at.asit.pdfover.gui.cliarguments.ProxyHostArgument;
-import at.asit.pdfover.gui.cliarguments.ProxyPassArgument;
-import at.asit.pdfover.gui.cliarguments.ProxyPortArgument;
-import at.asit.pdfover.gui.cliarguments.ProxyUserArgument;
-import at.asit.pdfover.gui.cliarguments.SkipFinishArgument;
+import at.asit.pdfover.gui.cliarguments.*;
import at.asit.pdfover.gui.controls.Dialog;
import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.controls.Dialog.ICON;
@@ -95,6 +81,7 @@ public class PrepareConfigurationState extends State {
this.handler.addCLIArgument(BKUArgument.class);
this.handler.addCLIArgument(PhoneNumberArgument.class);
this.handler.addCLIArgument(PasswordArgument.class);
+ this.handler.addCLIArgument(KeystoreFileArgument.class);
this.handler.addCLIArgument(ProxyHostArgument.class);
this.handler.addCLIArgument(ProxyPortArgument.class);
this.handler.addCLIArgument(ProxyUserArgument.class);
diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
index 52ae3d6a..5ca9051e 100644
--- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
+++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties
@@ -49,6 +49,7 @@ argument.help.config=Defines which configuration file to use. Example\: -c <conf
argument.help.emblem=Sets the signature logo file to use for the signature. Example\: -e <emblem file>
argument.help.help=Shows this help message
argument.help.input=Sets the document to sign. Example\: -i <input document>
+argument.help.keystorefile=Sets the keystore file. Example \: -ks <keystore file>
argument.help.number=Sets the telephone number to use for mobile CCE. Example\: -n <number>
argument.help.output=Sets the output folder or file to use. Example\: -o <folder>
argument.help.password=Sets the password to use for mobile CCE. Example\: -p <password>
@@ -62,6 +63,7 @@ argument.invalid.bku=CCE argument invalid\! Usage\:
argument.invalid.config=Configuration file argument invalid\! Usage\:
argument.invalid.emblem=Signature logo argument invalid\! Usage\:
argument.invalid.input=Document to sign argument invalid\! Usage\:
+argument.invalid.keystorefile=Keystore file invalid\! Usage\:
argument.invalid.number=Phone number argument invalid\! Usage\:
argument.invalid.output=Output folder argument invalid\! Usage\:
argument.invalid.password=Mobile CCE password invalid\! Usage\:
diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
index 8c02616a..fba8318e 100644
--- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
+++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties
@@ -49,6 +49,7 @@ argument.help.config=Auswahl der Konfigurationsdatei. Bsp.\: -c <Dateiname>
argument.help.emblem=W\u00E4hlt die Bildmarke f\u00FCr die Signatur. Bsp.\: -e <Dateiname>
argument.help.help=Zeigt diese Hilfe an
argument.help.input=W\u00E4hlt das zu signierende Dokument. Bsp.\: -i <Dateiname>
+argument.help.keystorefile=W\u00E4hlt die Keystore-Datei. Bsp.\: -ks <Dateiname>
argument.help.number=W\u00E4hlt die Telefonnummer f\u00FCr die Handy-BKU. Bsp.\: -n <Nummer>
argument.help.output=W\u00E4hlt den Ausgabeordner oder die Ausgabedatei. Bsp.\: -o <Ordner>
argument.help.password=W\u00E4hlt das Passwort f\u00FCr die Handy-BKU. Bsp.\: -p <Passwort>
@@ -62,6 +63,7 @@ argument.invalid.bku=BKU-Auswahl ung\u00FCltig\! Verwendung\:
argument.invalid.config=Konfigurationsdatei ung\u00FCltig\! Verwendung\:
argument.invalid.emblem=Bildmarke ung\u00FCltig\! Verwendung\:
argument.invalid.input=Dokument ung\u00FCltig\! Verwendung\:
+argument.invalid.keystorefile=Keystore-Datei ung\u00FCltig\! Verwendung\:
argument.invalid.number=Telefonnummer ung\u00FCltig\! Verwendung\:
argument.invalid.output=Ausgabeordner ung\u00FCltig\! Verwendung\:
argument.invalid.password=Handy-BKU Passwort ung\u00FCltig\! Verwendung\: