From c2602f46edd68e81cf66fffca3d0dccfdfab4ddc Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:28:04 +0000 Subject: Configuration overlay added * Commandline configuration will be stored in an overlay * This overlay won't be shown on the configuration page * This overlay won't be saved * Also slightly reworked CLI Argument creation git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@336 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../pdfover/gui/workflow/ConfigManipulator.java | 18 +- .../gui/workflow/ConfigOverlayManipulator.java | 73 ++++++++ .../pdfover/gui/workflow/ConfigProviderImpl.java | 196 ++++++++++++++++++++- .../gui/workflow/PersistentConfigProvider.java | 116 ++++++++++++ .../at/asit/pdfover/gui/workflow/StateMachine.java | 14 +- .../pdfover/gui/workflow/StateMachineImpl.java | 37 ++-- .../gui/workflow/states/ConfigurationUIState.java | 2 +- .../workflow/states/PrepareConfigurationState.java | 22 +-- 8 files changed, 433 insertions(+), 45 deletions(-) create mode 100644 pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigOverlayManipulator.java create mode 100644 pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java index b5cda279..80754f4b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java @@ -75,12 +75,6 @@ public interface ConfigManipulator { */ public void setProxyPort(int port); - /** - * Sets the configuration file - * @param configurationFile - */ - public void setConfigurationFile(String configurationFile); - /** * Sets the default output folder * @param outputFolder the default output folder @@ -93,12 +87,6 @@ public interface ConfigManipulator { */ public void setSignatureNote(String note); - /** - * Saves the current configuration to the current configuration file - * @throws IOException - */ - public void saveCurrentConfiguration() throws IOException; - /** * Sets the locale to be used * @param locale the locale @@ -116,4 +104,10 @@ public interface ConfigManipulator { * @param size a Point describing the size */ public void setMainWindowSize(Point size); + + /** + * Saves the current configuration to the current configuration file + * @throws IOException + */ + public void saveCurrentConfiguration() throws IOException; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigOverlayManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigOverlayManipulator.java new file mode 100644 index 00000000..a31309f3 --- /dev/null +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigOverlayManipulator.java @@ -0,0 +1,73 @@ +/* + * 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.workflow; + +import at.asit.pdfover.signator.BKUs; + +/** + * An interface for setting the configuration overlay + * + * This overlay overrides the actual configuration but will not be saved + */ +public interface ConfigOverlayManipulator { + /** + * Sets the default bku type + * @param bku the bku type + */ + public void setDefaultBKUOverlay(BKUs bku); + + /** + * Sets the default mobile number + * @param number the default mobile number + */ + public void setDefaultMobileNumberOverlay(String number); + + /** + * Sets the default password + * @param password the default password + */ + public void setDefaultMobilePasswordOverlay(String password); + + /** + * Sets the default emblem + * @param emblem the default emblem + */ + public void setDefaultEmblemOverlay(String emblem); + + /** + * Sets the proxy host + * @param host the proxy host + */ + public void setProxyHostOverlay(String host); + + /** + * Sets the proxy port + * @param port the proxy port + */ + public void setProxyPortOverlay(int port); + + /** + * Sets the default output folder + * @param outputFolder the default output folder + */ + public void setDefaultOutputFolderOverlay(String outputFolder); + + /** + * Sets the configuration file + * @param configurationFile + */ + public void setConfigurationFile(String configurationFile); +} 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 81749886..ea5e2629 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 @@ -41,7 +41,8 @@ import at.asit.pdfover.signator.SignaturePosition; /** * Implementation of the configuration provider and manipulator */ -public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { +public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, + ConfigOverlayManipulator, PersistentConfigProvider { /** * SLF4J Logger instance **/ @@ -57,11 +58,14 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { private ConfigurationContainer configuration; + private ConfigurationContainer configurationOverlay; + /** * Constructor */ public ConfigProviderImpl() { this.configuration = new ConfigurationContainerImpl(); + this.configurationOverlay = new ConfigurationContainerImpl(); } /* @@ -257,14 +261,14 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { Properties props = new Properties(); props.clear(); - props.setProperty(Constants.CFG_BKU, this.getDefaultBKU().toString()); - props.setProperty(Constants.CFG_PROXY_HOST, this.getProxyHost()); + props.setProperty(Constants.CFG_BKU, this.getDefaultBKUPersistent().toString()); + props.setProperty(Constants.CFG_PROXY_HOST, this.getProxyHostPersistent()); props.setProperty(Constants.CFG_PROXY_PORT, - Integer.toString(this.getProxyPort())); - props.setProperty(Constants.CFG_EMBLEM, this.getDefaultEmblem()); + Integer.toString(this.getProxyPortPersistent())); + props.setProperty(Constants.CFG_EMBLEM, this.getDefaultEmblemPersistent()); props.setProperty(Constants.CFG_SIGNATURE_NOTE, this.getSignatureNote()); - props.setProperty(Constants.CFG_MOBILE_NUMBER, this.getDefaultMobileNumber()); - props.setProperty(Constants.CFG_OUTPUT_FOLDER, this.getDefaultOutputFolder()); + props.setProperty(Constants.CFG_MOBILE_NUMBER, this.getDefaultMobileNumberPersistent()); + props.setProperty(Constants.CFG_OUTPUT_FOLDER, this.getDefaultOutputFolderPersistent()); props.setProperty(Constants.CFG_SIGNATURE_PLACEHOLDER_TRANSPARENCY, Integer.toString(this.getPlaceholderTransparency())); @@ -345,6 +349,15 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { this.configuration.setDefaultBKU(bku); } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultBKUOverlay(at.asit.pdfover.signator.BKUs) + */ + @Override + public void setDefaultBKUOverlay(BKUs bku) { + this.configurationOverlay.setDefaultBKU(bku); + + } + /* * (non-Javadoc) * @@ -352,6 +365,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { */ @Override public BKUs getDefaultBKU() { + BKUs bku = this.configurationOverlay.getDefaultBKU(); + if (bku == BKUs.NONE) + bku = this.configuration.getDefaultBKU(); + return bku; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultBKUPersistent() + */ + @Override + public BKUs getDefaultBKUPersistent() { return this.configuration.getDefaultBKU(); } @@ -423,6 +447,27 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultMobileNumberOverlay(java.lang.String) + */ + @Override + public void setDefaultMobileNumberOverlay(String number) { + try { + if (number == null || number.trim().isEmpty()) { + this.configurationOverlay.setMobileNumber(STRING_EMPTY); + } else { + this.configurationOverlay.setMobileNumber(number); + } + } catch (InvalidNumberException e) { + log.error("Error setting mobile number", e); //$NON-NLS-1$ + try { + this.configurationOverlay.setMobileNumber(STRING_EMPTY); + } catch (InvalidNumberException e1) { + // Ignore + } + } + } + /* * (non-Javadoc) * @@ -430,6 +475,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { */ @Override public String getDefaultMobileNumber() { + String number = this.configurationOverlay.getMobileNumber(); + if (number == null) + number = this.configuration.getMobileNumber(); + return number; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultMobileNumberPersistent() + */ + @Override + public String getDefaultMobileNumberPersistent() { return this.configuration.getMobileNumber(); } @@ -448,6 +504,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultMobilePasswordOverlay(java.lang.String) + */ + @Override + public void setDefaultMobilePasswordOverlay(String password) { + if (password == null || password.trim().isEmpty()) { + this.configurationOverlay.setMobilePassword(STRING_EMPTY); + } else { + this.configurationOverlay.setMobilePassword(password); + } + } + /* * (non-Javadoc) * @@ -455,6 +523,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { */ @Override public String getDefaultMobilePassword() { + String password = this.configurationOverlay.getMobilePassword(); + if (password == null) + password = this.configuration.getMobilePassword(); + return password; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultMobilePasswordPersistent() + */ + @Override + public String getDefaultMobilePasswordPersistent() { return this.configuration.getMobilePassword(); } @@ -482,6 +561,27 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultEmblemOverlay(java.lang.String) + */ + @Override + public void setDefaultEmblemOverlay(String emblem) { + try { + if (emblem == null || emblem.trim().isEmpty()) { + this.configurationOverlay.setEmblem(STRING_EMPTY); + } else { + this.configurationOverlay.setEmblem(emblem); + } + } catch (InvalidEmblemFile e) { + log.error("Error setting emblem file", e); //$NON-NLS-1$ + try { + this.configurationOverlay.setEmblem(STRING_EMPTY); + } catch (InvalidEmblemFile e1) { + // Ignore + } + } + } + /* * (non-Javadoc) * @@ -489,6 +589,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { */ @Override public String getDefaultEmblem() { + String emblem = this.configurationOverlay.getEmblem(); + if (emblem == null) + emblem = this.configuration.getEmblem(); + return emblem; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultEmblemPersistent() + */ + @Override + public String getDefaultEmblemPersistent() { return this.configuration.getEmblem(); } @@ -507,6 +618,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setProxyHostOverlay(java.lang.String) + */ + @Override + public void setProxyHostOverlay(String host) { + if (host == null || host.trim().isEmpty()) { + this.configurationOverlay.setProxyHost(STRING_EMPTY); + } else { + this.configurationOverlay.setProxyHost(host); + } + } + /* * (non-Javadoc) * @@ -514,6 +637,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { */ @Override public String getProxyHost() { + String host = this.configurationOverlay.getProxyHost(); + if (host == null) + host = this.configuration.getProxyHost(); + return host; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getProxyHostPersistent() + */ + @Override + public String getProxyHostPersistent() { return this.configuration.getProxyHost(); } @@ -533,6 +667,19 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setProxyPortOverlay(int) + */ + @Override + public void setProxyPortOverlay(int port) { + try { + this.configurationOverlay.setProxyPort(port); + } catch (InvalidPortException e) { + log.error("Error setting proxy port" , e); //$NON-NLS-1$ + // ignore + } + } + /* * (non-Javadoc) * @@ -540,6 +687,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { */ @Override public int getProxyPort() { + int port = this.configurationOverlay.getProxyPort(); + if (port == -1) + port = this.configuration.getProxyPort(); + return this.configuration.getProxyPort(); + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getProxyPortPersistent() + */ + @Override + public int getProxyPortPersistent() { return this.configuration.getProxyPort(); } @@ -559,6 +717,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { } } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultOutputFolderOverlay(java.lang.String) + */ + @Override + public void setDefaultOutputFolderOverlay(String outputFolder) { + if (outputFolder == null || outputFolder.trim().isEmpty()) { + this.configurationOverlay.setOutputFolder(STRING_EMPTY); + } else { + this.configurationOverlay.setOutputFolder(outputFolder); + } + } + /* * (non-Javadoc) * @@ -566,6 +736,17 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { */ @Override public String getDefaultOutputFolder() { + String outputFolder = this.configurationOverlay.getOutputFolder(); + if (outputFolder == null) + outputFolder = this.configuration.getOutputFolder(); + return outputFolder; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultOutputFolderPersistent() + */ + @Override + public String getDefaultOutputFolderPersistent() { return this.configuration.getOutputFolder(); } @@ -662,5 +843,4 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { public Point getMainWindowSize() { return this.configuration.getMainWindowSize(); } - } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java new file mode 100644 index 00000000..c9c02b63 --- /dev/null +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/PersistentConfigProvider.java @@ -0,0 +1,116 @@ +/* + * 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.workflow; + +import java.util.Locale; + +import org.eclipse.swt.graphics.Point; + +import at.asit.pdfover.signator.BKUs; +import at.asit.pdfover.signator.SignaturePosition; + +/** + * An interface for reading the persistent configuration + * + * This reads the configuration that will be saved + */ +public interface PersistentConfigProvider { + /** + * Get the default configured BKU + * @return the default configured BKU + */ + public BKUs getDefaultBKUPersistent(); + + /** + * Gets the default Mobile number + * @return the default mobile number + */ + public String getDefaultMobileNumberPersistent(); + + /** + * Gets the password to use for Mobile BKU + * @return the password + */ + public String getDefaultMobilePasswordPersistent(); + + /** + * Gets the filename of the default emblem + * @return the emblem + */ + public String getDefaultEmblemPersistent(); + + /** + * Gets the proxy host + * @return the proxy hostname or ip address + */ + public String getProxyHostPersistent(); + + /** + * Gets the proxy port + * @return the proxy port + */ + public int getProxyPortPersistent(); + + /** + * Gets the default output folder for signed documents + * @return the default output folder + */ + public String getDefaultOutputFolderPersistent(); + + // Declare the other configuration getters for convenience + + /** + * Get the default configured SignaturePosition + * @return the default configured SignaturePosition or null if not configured + */ + public SignaturePosition getDefaultSignaturePosition(); + + /** + * Get the transparency of the signature placeholder + * @return the transparency of the signature placeholder + */ + public int getPlaceholderTransparency(); + + /** + * Gets the mobile BKU URL + * @return the mobile BKU URL + */ + public String getMobileBKUURL(); + + /** + * Get the signature note text to use + * @return the signature note text + */ + public String getSignatureNote(); + + /** + * Gets the configured locale + * @return the configured locale + */ + public Locale getConfigLocale(); + + /** + * Gets the configured locale + * @return the configured locale + */ + public Locale getSignLocale(); + + /** + * Gets the configured MainWindow size + * @return the configured MainWindow size + */ + public Point getMainWindowSize(); +} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java index 9bcc757e..a054daaf 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java @@ -27,12 +27,24 @@ public interface StateMachine { */ public ConfigProvider getConfigProvider(); + /** + * Get the PersistentConfigProvider + * @return the PersistentConfigProvider + */ + public PersistentConfigProvider getPersistentConfigProvider(); + /** * Gets the Config Manipulator * @return the config manipulator */ public ConfigManipulator getConfigManipulator(); - + + /** + * Gets the Config Overlay Manipulator + * @return the config overlay manipulator + */ + public ConfigOverlayManipulator getConfigOverlayManipulator(); + /** * Get the PDF Signer * @return the PDF Signer diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java index 18943cbe..1da947f9 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java @@ -268,7 +268,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { /* * (non-Javadoc) - * * @see at.asit.pdfover.gui.workflow.StateMachine#getConfigProvider() */ @Override @@ -278,7 +277,31 @@ public class StateMachineImpl implements StateMachine, GUIProvider { /* * (non-Javadoc) - * + * @see at.asit.pdfover.gui.workflow.StateMachine#getConfigProvider() + */ + @Override + public PersistentConfigProvider getPersistentConfigProvider() { + return this.configProvider; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.StateMachine#getConfigManipulator() + */ + @Override + public ConfigManipulator getConfigManipulator() { + return this.configProvider; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.StateMachine#getConfigOverlayManipulator() + */ + @Override + public ConfigOverlayManipulator getConfigOverlayManipulator() { + return this.configProvider; + } + + /* + * (non-Javadoc) * @see at.asit.pdfover.gui.workflow.StateMachine#getStatus() */ @Override @@ -288,7 +311,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { /* * (non-Javadoc) - * * @see at.asit.pdfover.gui.workflow.StateMachine#getPDFSigner() */ @Override @@ -298,7 +320,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { /* * (non-Javadoc) - * * @see at.asit.pdfover.gui.workflow.StateMachine#getGUIProvider() */ @Override @@ -332,14 +353,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { return this.cmdLineArgs; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.StateMachine#getConfigManipulator() - */ - @Override - public ConfigManipulator getConfigManipulator() { - return this.configProvider; - } - /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.GUIProvider#getMainShell() */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java index 57a7aa9b..47c21063 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java @@ -45,7 +45,7 @@ public class ConfigurationUIState extends State { this.configurationComposite = this.stateMachine.getGUIProvider().createComposite(ConfigurationComposite.class, SWT.RESIZE, this); this.configurationComposite.setConfigManipulator(this.stateMachine.getConfigManipulator()); - this.configurationComposite.setConfigProvider(this.stateMachine.getConfigProvider()); + this.configurationComposite.setConfigProvider(this.stateMachine.getPersistentConfigProvider()); this.configurationComposite.setSigner(this.stateMachine.getPDFSigner()); } 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 e726d7b4..955d125a 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 @@ -71,20 +71,20 @@ public class PrepareConfigurationState extends State { public PrepareConfigurationState(StateMachine stateMachine) { super(stateMachine); this.handler = new ArgumentHandler(this.stateMachine); - this.handler.addCLIArgument(new HelpArgument()); - this.handler.addCLIArgument(new BKUArgument()); - this.handler.addCLIArgument(new PhoneNumberArgument()); - this.handler.addCLIArgument(new EmblemArgument()); - this.handler.addCLIArgument(new PasswordArgument()); - this.handler.addCLIArgument(new ProxyHostArgument()); - this.handler.addCLIArgument(new ProxyPortArgument()); - this.handler.addCLIArgument(new OutputFolderArgument()); - this.handler.addCLIArgument(new InputDocumentArgument()); + this.handler.addCLIArgument(HelpArgument.class); + this.handler.addCLIArgument(BKUArgument.class); + this.handler.addCLIArgument(PhoneNumberArgument.class); + this.handler.addCLIArgument(EmblemArgument.class); + this.handler.addCLIArgument(PasswordArgument.class); + this.handler.addCLIArgument(ProxyHostArgument.class); + this.handler.addCLIArgument(ProxyPortArgument.class); + this.handler.addCLIArgument(OutputFolderArgument.class); + this.handler.addCLIArgument(InputDocumentArgument.class); // adding config file argument to this handler so it appears in help - this.handler.addCLIArgument(new ConfigFileArgument()); + this.handler.addCLIArgument(ConfigFileArgument.class); this.configFileHandler = new ArgumentHandler(this.stateMachine); - this.configFileHandler.addCLIArgument(new ConfigFileArgument()); + this.configFileHandler.addCLIArgument(ConfigFileArgument.class); } private void initializeFromConfigurationFile(String filename) -- cgit v1.2.3