diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-11-24 14:14:37 +0100 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-11-24 14:14:37 +0100 |
commit | f39ab43fc0120b7fa97028d40acd7851de8d4a99 (patch) | |
tree | 335caaa8b701395bae64fbf67ca9afb1776ae658 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments | |
parent | a4dd755534013449be5573102114d8dcfccba159 (diff) | |
download | pdf-over-master.tar.gz pdf-over-master.tar.bz2 pdf-over-master.zip |
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments')
22 files changed, 0 insertions, 1630 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/Argument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/Argument.java deleted file mode 100644 index 16a47a42..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/Argument.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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; - -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.commons.Messages; -import at.asit.pdfover.gui.workflow.StateMachine; -import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.gui.workflow.config.ConfigurationManager; - -/** - * CLI Argument base class - * - * Implementing arguments have to be registered in PrepareConfigurationState - */ -public abstract class Argument { - - private String helpTextKey = null; - - private String[] commandOptions = null; - - private StateMachine stateMachine; - - /** - * @param commandOptions - * @param helpTextKey - */ - protected Argument(String[] commandOptions, String helpTextKey) { - this.helpTextKey = helpTextKey; - this.commandOptions = commandOptions; - } - - /** - * Set the state machine - * Used for configuration overlay manipulator and status - * @param stateMachine the state machine - */ - protected void setStateMachine(StateMachine stateMachine) { - this.stateMachine = stateMachine; - } - - protected ConfigurationManager getConfiguration() { - return this.stateMachine.configProvider; - } - - /** - * Get the status - * @return the status - */ - protected Status getStatus() { - return this.stateMachine.status; - } - - /** - * Set help text key - * @param key - */ - protected void setHelpTextKey(String key) { - this.helpTextKey = key; - } - - /** - * Gets help text - * @return help text - */ - public String getHelpText() { - return Messages.getString(this.helpTextKey); - } - - /** - * Set the command option in format: -... - * - * Examples: -h - * - * @param value - */ - protected void setCommandOptions(String[] value) { - this.commandOptions = value; - } - - /** - * Get the command option - * - * Examples: -h - * @return the command option - */ - public String[] getCommandOptions() { - return this.commandOptions; - } - - /** - * 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 Argument was used. - * - * Example: - * args[] = { "-h", "-b", "LOCAL" } - * - * Help Argument call: - * offset = 0 - * returns 0 - * - * BKU Argument call: - * offset = 1 - * returns 2 - * - * @param args - * @param argOffset - * @param handler - * @return returns the argumentOffset ending the section of this Argument - * @throws InitializationException - */ - public abstract int handleArgument(String[] args, int argOffset, ArgumentHandler handler) throws InitializationException; -} 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 deleted file mode 100644 index 108ccb47..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ArgumentHandler.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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 java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.gui.workflow.StateMachine; - -/** - * Handler to process CLI Arguments - */ -public class ArgumentHandler { - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(ArgumentHandler.class); - - private Map<String, Argument> cliArguments = new LinkedHashMap<String, Argument>(); - - private StateMachine stateMachine = null; - - private boolean requiredExit = false; - - /** - * Constructor - * - * @param stateMachine - */ - public ArgumentHandler(StateMachine stateMachine) { - this.stateMachine = stateMachine; - } - - /** - * Gets available Arguments - * - * @return the list of available arguments - */ - public Set<Argument> getArguments() { - return new LinkedHashSet<Argument>(this.cliArguments.values()); - } - - /** - * Adds a CLIArgument to the handler - * - * @param cliArgument the CLIArgument subclass to add - */ - public void addCLIArgument(Class<? extends Argument> cliArgument) { - - Argument arg; - try { - arg = cliArgument.getDeclaredConstructor().newInstance(); - - arg.setStateMachine(this.stateMachine); - - String[] commandOptions = arg.getCommandOptions(); - - if (commandOptions == null) { - return; - } - - for (int i = 0; i < commandOptions.length; i++) { - this.cliArguments.put(commandOptions[i], arg); - } - } catch (Exception e) { - log.error("Error instantiating CLI argument" , e); - } - } - - /** - * Handle CLI Arguments - * - * @param args - * @throws InitializationException - */ - public void handleArguments(String[] args) throws InitializationException { - - for (int i = 0; i < args.length; i++) { - if (this.cliArguments.containsKey(args[i])) { - i = this.cliArguments.get(args[i]).handleArgument(args, i, this); - } else { - // Assume we got the document we want to sign - if (this.cliArguments.containsKey("-i")) { - i = this.cliArguments.get("-i").handleArgument(args, i-1, this); - } - } - } - } - - /** - * Set by a cli argument if it wants the program to exit - * - * @param requireExit - */ - public void setRequireExit(boolean requireExit) { - this.requiredExit = requireExit; - } - - /** - * Checks if one argument required the program to exit immediately - * - * @return true or false - */ - public boolean doesRequireExit() { - return this.requiredExit; - } -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/AutomaticPositioningArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/AutomaticPositioningArgument.java deleted file mode 100644 index 23d00c06..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/AutomaticPositioningArgument.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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; - -import at.asit.pdfover.gui.exceptions.InitializationException; - -/** - * CLI Argument to set the BKU to use - */ -public class AutomaticPositioningArgument extends Argument { - /** - * Constructor - */ - public AutomaticPositioningArgument() { - super(new String[] { "-a" }, "argument.help.autopos"); - } - - /* - * (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 { - getConfiguration().setAutoPositionSignatureOverlay(); - return argOffset; - } - -} 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 deleted file mode 100644 index e69383f7..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/BKUArgument.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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; - -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.commons.BKUs; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to set the BKU to use - */ -public class BKUArgument extends Argument { - /** - * Constructor - */ - public BKUArgument() { - super( - new String[] { "-b" }, "argument.help.bku"); - } - - /* - * (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) { - - BKUs argumentValue = BKUs.valueOf(args[argOffset + 1]); - - getConfiguration().setDefaultBKUOverlay(argumentValue); - - return argOffset + 1; - } - } catch (Exception ex) { - throw new InitializationException( - Messages.getString("argument.invalid.bku") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.bku") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index 725a28f9..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to set the configuration file - */ -public class ConfigFileArgument extends Argument { - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(ConfigFileArgument.class); - - /** - * Constructor - */ - public ConfigFileArgument() { - super(new String[] {"-c"}, "argument.help.config"); - } - - /* (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 configFile = args[argOffset + 1]; - - getConfiguration().setConfigurationFileName(configFile); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Configuration File Argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.config") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.config") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index fe88d37e..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/EmblemArgument.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 java.io.File; -import java.io.FileNotFoundException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to set the emblem file to use for signature - */ -public class EmblemArgument extends Argument { - /** - * Constructor - */ - public EmblemArgument() { - super(new String[] {"-e"}, "argument.help.emblem"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(EmblemArgument.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 emblem = args[argOffset + 1]; - - File emblemFile = new File(emblem); - - if(!emblemFile.exists()) { - throw new FileNotFoundException(emblem); - } - - getConfiguration().setDefaultEmblemOverlay(emblem); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Emblem argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.emblem") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.emblem") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index 0bcdaba6..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/HelpArgument.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 java.util.Iterator; -import java.util.Set; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.swt.widgets.Shell; - -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.commons.Constants; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to show the useage message - */ -public class HelpArgument extends Argument { - - /** - * Constructor - */ - public HelpArgument() { - super(new String[] {"-h", "-?", "--help" }, - "argument.help.help"); - } - - /* (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 { - Set<Argument> arguments = handler.getArguments(); - - Iterator<Argument> argumentIterator = arguments.iterator(); - - StringBuilder message = new StringBuilder(Messages.getString("argument.info.help")); - message.append("\n"); - - while(argumentIterator.hasNext()) { - Argument argument = argumentIterator.next(); - - for (int i = 0; i < argument.getCommandOptions().length; i++) { - message.append(argument.getCommandOptions()[i]); - - if(i < argument.getCommandOptions().length -1) { - message.append(", "); - } - } - - message.append(":\n"); - boolean first = true; - for (String line : argument.getHelpText().split("\\.\\s+")) { - message.append(" "); - if (first) first = false; else message.append(" "); - message.append(line); - message.append("\n"); - } - } - - String msg = message.toString(); - System.out.println(msg); - - Display display = Display.getCurrent(); - if (display != null) { - MessageBox box = new MessageBox(new Shell(display), SWT.ICON_INFORMATION | SWT.OK); - box.setText(Constants.APP_NAME_VERSION); - box.setMessage(msg); - box.open(); - } - - handler.setRequireExit(true); - - return argOffset; - } - -} 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 deleted file mode 100644 index b636b825..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InputDocumentArgument.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 java.io.File; -import java.io.FileNotFoundException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to set the input document to sign - */ -public class InputDocumentArgument extends Argument { - /** - * Constructor - */ - public InputDocumentArgument() { - super(new String[] {"-i"}, "argument.help.input"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(InputDocumentArgument.class); - - /* (non-Javadoc) - * @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, - ArgumentHandler handler) - throws InitializationException { - try { - if (args.length > argOffset + 1) { - - String signatureDocument = args[argOffset + 1]; - - File signatureDocumentFile = new File(signatureDocument); - - if(!signatureDocumentFile.exists()) { - throw new FileNotFoundException(signatureDocument); - } - - getStatus().document = signatureDocumentFile; - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Document to sign argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.input") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.input") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InvisibleProfile.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InvisibleProfile.java deleted file mode 100644 index f3e7c1e2..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/InvisibleProfile.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.commons.Messages; -import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; - -/** - * CLI Argument to set the visibility of signature - */ -public class InvisibleProfile extends Argument { - /** - * Constructor - */ - public InvisibleProfile() { - super(new String[] {"-v"}, "argument.help.vis"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(InvisibleProfile.class); - - /* (non-Javadoc) - * @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, - ArgumentHandler handler) - throws InitializationException { - try { - log.info("Set Profile Invisible"); - - if (args.length > argOffset + 1) { - // TODO: this is a colossal monumental terrible hack - PdfAs4SignatureParameter.PROFILE_VISIBILITY=false; - log.debug("We are setting the profile visibility to false"); - return argOffset + 1; - } - - } catch (Exception ex) { - log.error("Signature Profile Visibilty Error", ex); - throw new InitializationException( - Messages.getString("argument.invalid.vis") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.vis") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreAliasArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreAliasArgument.java deleted file mode 100644 index 1ef7531e..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreAliasArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to provide the keystore alias - */ -public class KeystoreAliasArgument extends Argument { - /** - * Constructor - */ - public KeystoreAliasArgument() { - super(new String[] {"-ksalias"}, "argument.help.keystorealias"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(KeystoreAliasArgument.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 ksAlias = args[argOffset + 1]; - - getConfiguration().setKeyStoreAliasOverlay(ksAlias); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Keystore alias argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.keystorealias") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.keystorealias") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index adc40dae..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreFileArgument.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 java.io.File; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.gui.exceptions.KeystoreDoesntExistException; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to provide the keystore file - */ -public class KeystoreFileArgument extends Argument { - /** - * Constructor - */ - public KeystoreFileArgument() { - super(new String[] {"-ks"}, "argument.help.keystorefile"); - } - - /** - * 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]; - - File ks = new File(ksFile); - if(!ks.exists() || !ks.isFile()) - throw new KeystoreDoesntExistException(ks, 0); - - getConfiguration().setKeyStoreFileOverlay(ksFile); - getConfiguration().setKeyStoreEnabledOverlay(true); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Keystore file argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.keystorefile") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.keystorefile") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreKeyPassArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreKeyPassArgument.java deleted file mode 100644 index f41bbeaa..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreKeyPassArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to provide the keystore key password - */ -public class KeystoreKeyPassArgument extends Argument { - /** - * Constructor - */ - public KeystoreKeyPassArgument() { - super(new String[] {"-kskeypass"}, "argument.help.keystorekeypass"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(KeystoreKeyPassArgument.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 ksKeyPass = args[argOffset + 1]; - - getConfiguration().setKeyStoreKeyPassOverlay(ksKeyPass); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Keystore key password argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.keystorekeypass") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.keystorekeypass") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreStorePassArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreStorePassArgument.java deleted file mode 100644 index 3c759743..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreStorePassArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to provide the keystore password - */ -public class KeystoreStorePassArgument extends Argument { - /** - * Constructor - */ - public KeystoreStorePassArgument() { - super(new String[] {"-kspass"}, "argument.help.keystorestorepass"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(KeystoreStorePassArgument.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 ksStorePass = args[argOffset + 1]; - - getConfiguration().setKeyStoreStorePassOverlay(ksStorePass); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Keystore password argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.keystorestorepass") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.keystorestorepass") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreTypeArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreTypeArgument.java deleted file mode 100644 index fa29ba5d..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/KeystoreTypeArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to provide the keystore type - */ -public class KeystoreTypeArgument extends Argument { - /** - * Constructor - */ - public KeystoreTypeArgument() { - super(new String[] {"-kstype"}, "argument.help.keystoretype"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(KeystoreTypeArgument.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 ksType = args[argOffset + 1]; - - getConfiguration().setKeyStoreTypeOverlay(ksType); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Keystore type argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.keystoretype") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.keystoretype") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index 047bf79c..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/OutputFolderArgument.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to show the usage message - */ -public class OutputFolderArgument extends Argument { - /** - * Constructor - */ - public OutputFolderArgument() { - super(new String[] {"-o"}, "argument.help.output"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(OutputFolderArgument.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 outputFolder = args[argOffset + 1]; - -// File outputFolderDir = new File(outputFolder); -// if(!outputFolderDir.exists()) { -// throw new FileNotFoundException(outputFolder); -// } -// if(!outputFolderDir.isDirectory()) { -// throw new IOException(outputFolderDir + Messages.getString("argument.error.output")); -// } - - getConfiguration().setDefaultOutputFolderOverlay(outputFolder); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Output folder argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.output") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.output") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index cbfb1925..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PasswordArgument.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.bku.mobile.MobileBKUValidator; -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to provide Mobile BKU password - */ -public class PasswordArgument extends Argument { - /** - * Constructor - */ - public PasswordArgument() { - super(new String[] {"-p"}, "argument.help.password"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(PasswordArgument.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 password = args[argOffset + 1]; - - MobileBKUValidator.validatePassword(password); - - getConfiguration().setDefaultMobilePasswordOverlay(password); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Mobile BKU password argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.password") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.password") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index cc43d7e3..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/PhoneNumberArgument.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.bku.mobile.MobileBKUValidator; -import at.asit.pdfover.gui.exceptions.InitializationException; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to provide Mobile BKU phone number to use - */ -public class PhoneNumberArgument extends Argument { - /** - * Constructor - */ - public PhoneNumberArgument() { - super(new String[] {"-n" }, "argument.help.number"); - } - - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(PhoneNumberArgument.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 number = args[argOffset + 1]; - - number = MobileBKUValidator.normalizeMobileNumber(number); - - getConfiguration().setDefaultMobileNumberOverlay(number); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Phone Number Argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.number") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.number") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index a77872e5..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyHostArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to provide the proxy host - */ -public class ProxyHostArgument extends Argument { - /** - * Constructor - */ - public ProxyHostArgument() { - super(new String[] {"-proxy"}, "argument.help.proxyhost"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(ProxyHostArgument.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 proxyHost = args[argOffset + 1]; - - getConfiguration().setProxyHostOverlay(proxyHost); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Proxy host argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.proxyhost") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.proxyhost") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPassArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPassArgument.java deleted file mode 100644 index f9c4e533..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPassArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to provide the proxy password - */ -public class ProxyPassArgument extends Argument { - /** - * Constructor - */ - public ProxyPassArgument() { - super(new String[] {"-proxypass"}, "argument.help.proxypass"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(ProxyPassArgument.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 proxyPass = args[argOffset + 1]; - - getConfiguration().setProxyPassOverlay(proxyPass); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Proxy password argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.proxypass") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.proxypass") + this.getHelpText(), null); - } - -} 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 deleted file mode 100644 index ff9e84df..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyPortArgument.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.exceptions.InvalidPortException; -import at.asit.pdfover.commons.Messages; - -/** - * CLI Argument to provide the proxy port - */ -public class ProxyPortArgument extends Argument { - /** - * Constructor - */ - public ProxyPortArgument() { - super(new String[] {"-proxyport"}, "argument.help.proxyport"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(ProxyPortArgument.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 proxyPortString = args[argOffset + 1]; - - int port = Integer.parseInt(proxyPortString); - - if(port <= 0 || port > 0xFFFF) { - throw new InvalidPortException(port); - } - - getConfiguration().setProxyPortOverlay(port); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Proxy port argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.proxyport") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.proxyport") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyUserArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyUserArgument.java deleted file mode 100644 index 82944f9b..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ProxyUserArgument.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.commons.Messages; - -/** - * CLI Argument to provide the proxy username - */ -public class ProxyUserArgument extends Argument { - /** - * Constructor - */ - public ProxyUserArgument() { - super(new String[] {"-proxyuser"}, "argument.help.proxyuser"); - } - - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(ProxyUserArgument.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 proxyUser = args[argOffset + 1]; - - getConfiguration().setProxyUserOverlay(proxyUser); - - return argOffset + 1; - } - } catch (Exception ex) { - log.error("Proxy username argument invalid!", ex); - throw new InitializationException( - Messages.getString("argument.invalid.proxyuser") + this.getHelpText(), ex); - } - - throw new InitializationException( - Messages.getString("argument.invalid.proxyuser") + this.getHelpText(), null); - } - -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/SkipFinishArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/SkipFinishArgument.java deleted file mode 100644 index 0c4247fd..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/SkipFinishArgument.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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; - -import at.asit.pdfover.gui.exceptions.InitializationException; - -/** - * CLI Argument to set the BKU to use - */ -public class SkipFinishArgument extends Argument { - /** - * Constructor - */ - public SkipFinishArgument() { - super(new String[] { "-s" }, "argument.help.skipfinish"); - } - - /* - * (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 { - getConfiguration().setSkipFinishOverlay(true); - return argOffset; - } -} |