summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/Argument.java (renamed from pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/CLIArgument.java)26
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java18
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java8
13 files changed, 49 insertions, 51 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/CLIArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/Argument.java
index 4c471118..761e5dc3 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/CLIArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/Argument.java
@@ -16,6 +16,7 @@
package at.asit.pdfover.gui.cliarguments;
import at.asit.pdfover.gui.exceptions.InitializationException;
+import at.asit.pdfover.gui.utils.Messages;
import at.asit.pdfover.gui.workflow.ConfigOverlayManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.Status;
@@ -23,9 +24,9 @@ import at.asit.pdfover.gui.workflow.Status;
/**
* CLI Argument base class
*/
-public abstract class CLIArgument {
+public abstract class Argument {
- private String helpText = null;
+ private String helpTextKey = null;
private String[] commandOptions = null;
@@ -33,10 +34,10 @@ public abstract class CLIArgument {
/**
* @param commandOptions
- * @param helpText
+ * @param helpTextKey
*/
- protected CLIArgument(String[] commandOptions, String helpText) {
- this.helpText = helpText;
+ protected Argument(String[] commandOptions, String helpTextKey) {
+ this.helpTextKey = helpTextKey;
this.commandOptions = commandOptions;
}
@@ -65,23 +66,20 @@ public abstract class CLIArgument {
return this.stateMachine.getStatus();
}
-
/**
- * Set help text
- *
- * @param value
+ * Set help text key
+ * @param key
*/
- protected void setHelpText(String value) {
- this.helpText = value;
+ protected void setHelpTextKey(String key) {
+ this.helpTextKey = key;
}
/**
* Gets help text
- *
* @return help text
*/
public String getHelpText() {
- return this.helpText;
+ return Messages.getString(this.helpTextKey);
}
/**
@@ -108,7 +106,7 @@ public abstract class CLIArgument {
/**
* Invokes the argument to set stuff within the stateMachine
*
- * It should return the offset within the args array where the last used argument of this CLIArgument was used.
+ * It should return the offset within the args array where the last used argument of this Argument was used.
*
* Example:
* args[] = { "-h", "-b", "LOCAL" }
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java
index 378588eb..9fb6f7ab 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java
@@ -37,7 +37,7 @@ public class ArgumentHandler {
private static final Logger log = LoggerFactory
.getLogger(ArgumentHandler.class);
- private Map<String, CLIArgument> cliArguments = new HashMap<String, CLIArgument>();
+ private Map<String, Argument> cliArguments = new HashMap<String, Argument>();
private StateMachine stateMachine = null;
@@ -57,8 +57,8 @@ public class ArgumentHandler {
*
* @return the list of available arguments
*/
- public Set<CLIArgument> getArguments() {
- return new HashSet<CLIArgument>(this.cliArguments.values());
+ public Set<Argument> getArguments() {
+ return new HashSet<Argument>(this.cliArguments.values());
}
/**
@@ -66,9 +66,9 @@ public class ArgumentHandler {
*
* @param cliArgument the CLIArgument subclass to add
*/
- public void addCLIArgument(Class<? extends CLIArgument> cliArgument) {
+ public void addCLIArgument(Class<? extends Argument> cliArgument) {
- CLIArgument arg;
+ Argument arg;
try {
arg = cliArgument.newInstance();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java
index b1902cb1..058d84cf 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java
@@ -22,13 +22,13 @@ import at.asit.pdfover.signator.BKUs;
/**
* CLI Argument to set the BKU to use
*/
-public class BKUArgument extends CLIArgument {
+public class BKUArgument extends Argument {
/**
* Constructor
*/
public BKUArgument() {
super(
- new String[] { "-b" }, Messages.getString("argument.help.bku")); //$NON-NLS-1$ //$NON-NLS-2$
+ new String[] { "-b" }, "argument.help.bku"); //$NON-NLS-1$ //$NON-NLS-2$
}
/*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
index 7fd3acef..0f73143d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
@@ -25,7 +25,7 @@ import at.asit.pdfover.gui.utils.Messages;
/**
* CLI Argument to set the configuration file
*/
-public class ConfigFileArgument extends CLIArgument {
+public class ConfigFileArgument extends Argument {
/**
* SLF4J Logger instance
**/
@@ -36,7 +36,7 @@ public class ConfigFileArgument extends CLIArgument {
* Constructor
*/
public ConfigFileArgument() {
- super(new String[] {"-c"}, Messages.getString("argument.help.config")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-c"}, "argument.help.config"); //$NON-NLS-1$ //$NON-NLS-2$
}
/* (non-Javadoc)
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java
index 98401b16..96b3690b 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java
@@ -28,12 +28,12 @@ import at.asit.pdfover.gui.utils.Messages;
/**
* CLI Argument to set the emblem file to use for signature
*/
-public class EmblemArgument extends CLIArgument {
+public class EmblemArgument extends Argument {
/**
* Constructor
*/
public EmblemArgument() {
- super(new String[] {"-e"}, Messages.getString("argument.help.emblem")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-e"}, "argument.help.emblem"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java
index 3160b4e4..77d95ae9 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java
@@ -25,14 +25,14 @@ import at.asit.pdfover.gui.utils.Messages;
/**
* CLI Argument to show the useage message
*/
-public class HelpArgument extends CLIArgument {
+public class HelpArgument extends Argument {
/**
* Constructor
*/
public HelpArgument() {
super(new String[] {"-h", "-?", "--help" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Messages.getString("argument.help.help")); //$NON-NLS-1$
+ "argument.help.help"); //$NON-NLS-1$
}
/* (non-Javadoc)
@@ -42,26 +42,26 @@ public class HelpArgument extends CLIArgument {
public int handleArgument(String[] args, int argOffset,
ArgumentHandler handler)
throws InitializationException {
- Set<CLIArgument> arguments = handler.getArguments();
+ Set<Argument> arguments = handler.getArguments();
- Iterator<CLIArgument> argumentIterator = arguments.iterator();
+ Iterator<Argument> argumentIterator = arguments.iterator();
System.out.println(Messages.getString("argument.info.help")); //$NON-NLS-1$
while(argumentIterator.hasNext()) {
- CLIArgument agrument = argumentIterator.next();
+ Argument argument = argumentIterator.next();
StringBuilder sb = new StringBuilder();
- for(int i = 0; i < agrument.getCommandOptions().length; i++) {
- sb.append(agrument.getCommandOptions()[i]);
+ for(int i = 0; i < argument.getCommandOptions().length; i++) {
+ sb.append(argument.getCommandOptions()[i]);
- if(i < agrument.getCommandOptions().length -1) {
+ if(i < argument.getCommandOptions().length -1) {
sb.append(", "); //$NON-NLS-1$
}
}
System.out.println(sb.toString() + ":"); //$NON-NLS-1$
- System.out.println("\t" + agrument.getHelpText()); //$NON-NLS-1$
+ System.out.println("\t" + argument.getHelpText()); //$NON-NLS-1$
}
handler.setRequireExit(true);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java
index efb2c3aa..37c0c81c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java
@@ -28,12 +28,12 @@ import at.asit.pdfover.gui.utils.Messages;
/**
* CLI Argument to set the input document to sign
*/
-public class InputDocumentArgument extends CLIArgument {
+public class InputDocumentArgument extends Argument {
/**
* Constructor
*/
public InputDocumentArgument() {
- super(new String[] {"-i"}, Messages.getString("argument.help.input")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-i"}, "argument.help.input"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -43,7 +43,7 @@ public class InputDocumentArgument extends CLIArgument {
.getLogger(InputDocumentArgument.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)
+ * @see at.asit.pdfovewr.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,
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java
index 037a4226..7bce81c1 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java
@@ -25,12 +25,12 @@ import at.asit.pdfover.gui.utils.Messages;
/**
* CLI Argument to show the usage message
*/
-public class OutputFolderArgument extends CLIArgument {
+public class OutputFolderArgument extends Argument {
/**
* Constructor
*/
public OutputFolderArgument() {
- super(new String[] {"-o"}, Messages.getString("argument.help.output")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-o"}, "argument.help.output"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java
index 1f90cda2..268468d9 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java
@@ -26,12 +26,12 @@ import at.asit.pdfover.gui.workflow.states.mobilebku.MobileBKUHelper;
/**
* CLI Argument to provide Mobile BKU password
*/
-public class PasswordArgument extends CLIArgument {
+public class PasswordArgument extends Argument {
/**
* Constructor
*/
public PasswordArgument() {
- super(new String[] {"-p"}, Messages.getString("argument.help.password")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-p"}, "argument.help.password"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java
index a6a1cb79..afaa01c7 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java
@@ -26,12 +26,12 @@ import at.asit.pdfover.gui.workflow.states.mobilebku.MobileBKUHelper;
/**
* CLI Argument to provide Mobile BKU phone number to use
*/
-public class PhoneNumberArgument extends CLIArgument {
+public class PhoneNumberArgument extends Argument {
/**
* Constructor
*/
public PhoneNumberArgument() {
- super(new String[] {"-n" }, Messages.getString("argument.help.number")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-n" }, "argument.help.number"); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java
index cc50705e..779d6cee 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java
@@ -25,12 +25,12 @@ import at.asit.pdfover.gui.utils.Messages;
/**
* CLI Argument to provide the proxy host
*/
-public class ProxyHostArgument extends CLIArgument {
+public class ProxyHostArgument extends Argument {
/**
* Constructor
*/
public ProxyHostArgument() {
- super(new String[] {"-proxy"}, Messages.getString("argument.help.proxyhost")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-proxy"}, "argument.help.proxyhost"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java
index a9bceead..5f5db33a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java
@@ -26,12 +26,12 @@ import at.asit.pdfover.gui.utils.Messages;
/**
* CLI Argument to provide the proxy port
*/
-public class ProxyPortArgument extends CLIArgument {
+public class ProxyPortArgument extends Argument {
/**
* Constructor
*/
public ProxyPortArgument() {
- super(new String[] {"-proxyport"}, Messages.getString("argument.help.proxyport")); //$NON-NLS-1$ //$NON-NLS-2$
+ super(new String[] {"-proxyport"}, "argument.help.proxyport"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
index e9fbe1c2..ec0be92d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
@@ -103,17 +103,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator,
this.setDefaultOutputFolder(config
.getProperty(Constants.CFG_OUTPUT_FOLDER));
- String localString = config.getProperty(Constants.CFG_LOCALE);
+ String localeString = config.getProperty(Constants.CFG_LOCALE);
- Locale targetLocale = LocaleSerializer.parseFromString(localString);
- if(targetLocale != null) {
+ Locale targetLocale = LocaleSerializer.parseFromString(localeString);
+ if (targetLocale != null) {
this.setLocale(targetLocale);
}
String signlocalString = config.getProperty(Constants.CFG_SIGN_LOCALE);
Locale signtargetLocale = LocaleSerializer.parseFromString(signlocalString);
- if(signtargetLocale != null) {
+ if (signtargetLocale != null) {
this.setSignLocale(signtargetLocale);
}