diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 12:57:59 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 12:57:59 +0200 |
commit | 3c1e373f9fdf83da4b2083101c77a664ea756091 (patch) | |
tree | 006f866de8ffc24d3bab5fb1a37a1d17ea1d6ec2 /pdf-over-gui/src | |
parent | 5555d3c73c2b4b9e1f9341be9053dde91a02af6a (diff) | |
download | pdf-over-3c1e373f9fdf83da4b2083101c77a664ea756091.tar.gz pdf-over-3c1e373f9fdf83da4b2083101c77a664ea756091.tar.bz2 pdf-over-3c1e373f9fdf83da4b2083101c77a664ea756091.zip |
YAGNI: the four different Config* interfaces that are only implemented once
Diffstat (limited to 'pdf-over-gui/src')
22 files changed, 47 insertions, 1407 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java index 20f645a2..7a51a961 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/ATrustStatus.java @@ -16,11 +16,10 @@ package at.asit.pdfover.gui.bku.mobile;
// Imports
-import org.apache.commons.httpclient.Cookie;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.config.ConfigProvider;
+import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl;
/**
* A-Trust MobileBKUStatus implementation
@@ -53,7 +52,7 @@ public class ATrustStatus extends MobileBKUStatus { * Constructor
* @param provider the ConfigProvider
*/
- public ATrustStatus(ConfigProvider provider) {
+ public ATrustStatus(ConfigProviderImpl provider) {
this.phoneNumber = provider.getDefaultMobileNumber();
this.mobilePassword = provider.getDefaultMobilePassword();
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java index cb131012..cb150327 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/IAIKStatus.java @@ -15,21 +15,12 @@ */ package at.asit.pdfover.gui.bku.mobile; -// Imports -import org.apache.commons.httpclient.Cookie; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.asit.pdfover.gui.workflow.config.ConfigProvider; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; /** * IAIK MobileBKUStatus implementation */ public class IAIKStatus extends MobileBKUStatus { - /** - * SLF4J Logger instance - **/ - private static final Logger log = LoggerFactory.getLogger(IAIKStatus.class); /** Maximum number of TAN tries */ public static final int MOBILE_MAX_TAN_TRIES = 3; @@ -40,7 +31,7 @@ public class IAIKStatus extends MobileBKUStatus { * Constructor * @param provider the ConfigProvider */ - public IAIKStatus(ConfigProvider provider) { + public IAIKStatus(ConfigProviderImpl provider) { this.phoneNumber = provider.getDefaultMobileNumber(); this.mobilePassword = provider.getDefaultMobilePassword(); } 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 index 9fbe6eba..bf82177e 100644 --- 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 @@ -19,7 +19,7 @@ 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.ConfigOverlayManipulator; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; /** * CLI Argument base class @@ -52,11 +52,7 @@ public abstract class Argument { this.stateMachine = stateMachine; } - /** - * Get the configuration overlay manipulator - * @return the configuration overlay manipulator - */ - protected ConfigOverlayManipulator getConfiguration() { + protected ConfigProviderImpl getConfiguration() { return this.stateMachine.configProvider; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index dd40bb83..10d0541c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -59,8 +59,7 @@ public class ConfigurationComposite extends StateComposite { /** * SLF4J Logger instance **/ - static final Logger log = LoggerFactory - .getLogger(ConfigurationComposite.class); + static final Logger log = LoggerFactory.getLogger(ConfigurationComposite.class); /** * configuration provider diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java index 6377a548..7eac256a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AboutComposite.java @@ -22,7 +22,6 @@ import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; -import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; public class AboutComposite extends ConfigurationCompositeBase { static final Logger log = LoggerFactory.getLogger(AboutComposite.class); @@ -138,7 +137,7 @@ public class AboutComposite extends ConfigurationCompositeBase { protected void signerChanged() {} @Override - public void initConfiguration(PersistentConfigProvider provider) {} + public void initConfiguration(ConfigProviderImpl provider) {} @Override public void loadConfiguration() {} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java index f8e8eb5a..baba386a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/AdvancedConfigurationComposite.java @@ -55,7 +55,6 @@ import at.asit.pdfover.gui.exceptions.OutputfolderDoesntExistException; import at.asit.pdfover.gui.exceptions.OutputfolderNotADirectoryException; import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; -import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.BKUs; import at.asit.pdfover.signator.SignaturePosition; @@ -647,15 +646,8 @@ public class AdvancedConfigurationComposite extends ConfigurationCompositeBase { // Nothing to do here } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.composites.BaseConfigurationComposite#initConfiguration( - * at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) - */ @Override - public void initConfiguration(PersistentConfigProvider provider) { + public void initConfiguration(ConfigProviderImpl provider) { this.configurationContainer.defaultSignaturePosition = provider.getDefaultSignaturePositionPersistent(); this.configurationContainer.setUseMarker(provider.getUseMarker()); this.configurationContainer.setUseSignatureFields(provider.getUseSignatureFields()); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java index 2c871e3e..d3e458db 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/ConfigurationCompositeBase.java @@ -22,7 +22,6 @@ import at.asit.pdfover.gui.composites.StateComposite; import at.asit.pdfover.gui.workflow.PDFSigner; import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; -import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; /** @@ -72,10 +71,10 @@ public abstract class ConfigurationCompositeBase extends StateComposite { } /** - * Initialize ConfigurationContainer from PersistentConfigProvider - * @param provider the PersistentConfigProvider to load config from + * Initialize ConfigurationContainer from ConfigProviderImpl + * @param provider the ConfigProviderImpl to load config from */ - public abstract void initConfiguration(PersistentConfigProvider provider); + public abstract void initConfiguration(ConfigProviderImpl provider); /** * Load configuration from ConfigurationContainer @@ -84,7 +83,7 @@ public abstract class ConfigurationCompositeBase extends StateComposite { /** * Store configuration from ConfigurationContainer to ConfigProvider - * @param store the ConfigProvider to store config to + * @param store the ConfigProviderImpl to store config to */ public abstract void storeConfiguration(ConfigProviderImpl store); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java index dba585fa..597112df 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java @@ -57,7 +57,6 @@ import at.asit.pdfover.gui.exceptions.KeystoreKeyPasswordException; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; -import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; import iaik.security.provider.IAIK; @@ -380,12 +379,8 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { layout(true, true); } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#initConfiguration(at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) - */ @Override - public void initConfiguration(PersistentConfigProvider provider) { + public void initConfiguration(ConfigProviderImpl provider) { ConfigurationContainer config = this.configurationContainer; config.keystoreFile = provider.getKeyStoreFilePersistent(); config.keystoreType = provider.getKeyStoreTypePersistent(); @@ -418,9 +413,6 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase { performKeystoreKeyPassChanged(config.keystoreKeyPass); } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration(at.asit.pdfover.gui.workflow.config.ConfigManipulator, at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) - */ @Override public void storeConfiguration(ConfigProviderImpl store) { ConfigurationContainer config = this.configurationContainer; diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index 49a9260f..257f9cc6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -65,7 +65,6 @@ import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.utils.ImageConverter; import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.gui.workflow.config.ConfigurationContainer; -import at.asit.pdfover.gui.workflow.config.PersistentConfigProvider; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.CachedFileNameEmblem; import at.asit.pdfover.signator.SignatureParameter; @@ -607,18 +606,12 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { layout(true, true); } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#initConfiguration(at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) - */ @Override - public void initConfiguration(PersistentConfigProvider provider) { - this.configurationContainer.setMobileNumber( - provider.getDefaultMobileNumberPersistent()); + public void initConfiguration(ConfigProviderImpl provider) { + this.configurationContainer.setMobileNumber(provider.getDefaultMobileNumberPersistent()); try { - this.configurationContainer.setEmblem( - provider.getDefaultEmblemPersistent()); + this.configurationContainer.setEmblem(provider.getDefaultEmblemPersistent()); } catch (InvalidEmblemFile e) { log.error("Failed to set emblem!", e); } @@ -669,9 +662,6 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.composites.BaseConfigurationComposite#storeConfiguration(at.asit.pdfover.gui.workflow.config.ConfigManipulator, at.asit.pdfover.gui.workflow.config.PersistentConfigProvider) - */ @Override public void storeConfiguration(ConfigProviderImpl store) { store.setDefaultMobileNumber(this.configurationContainer.getMobileNumber()); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java deleted file mode 100644 index 2a34b440..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigManipulator.java +++ /dev/null @@ -1,210 +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.workflow.config; - -import java.io.IOException; -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 setting the configuration - */ -public interface ConfigManipulator { - /** - * Sets the default bku type - * @param bku the bku type - */ - public void setDefaultBKU(BKUs bku); - - /** - * Sets the default signature position - * @param signaturePosition the default signature position - */ - public void setDefaultSignaturePosition(SignaturePosition signaturePosition); - - /** - * Sets the signature placeholder transparency - * @param transparency the signature placeholder transparency - */ - void setPlaceholderTransparency(int transparency); - - /** - * Sets the default mobile number - * @param number the default mobile number - */ - public void setDefaultMobileNumber(String number); - - /** - * Sets the default password - * @param password the default password - */ - public void setDefaultMobilePassword(String password); - - /** - * Sets the default emblem - * @param emblem the default emblem - */ - public void setDefaultEmblem(String emblem); - - /** - * Sets the proxy host - * @param host the proxy host - */ - public void setProxyHost(String host); - - /** - * Sets the proxy port - * @param port the proxy port - */ - public void setProxyPort(int port); - - /** - * Sets the proxy username - * @param user the proxy username - */ - public void setProxyUser(String user); - - /** - * Sets the proxy password - * @param pass the proxy password - */ - public void setProxyPass(String pass); - - /** - * Sets the default output folder - * @param outputFolder the default output folder - */ - public void setDefaultOutputFolder(String outputFolder); - - /** - * Sets the signature note text - * @param note the signature note text - */ - public void setSignatureNote(String note); - - /** - * Sets the locale to be used - * @param locale the locale - */ - public void setLocale(Locale locale); - - /** - * Sets the signature locale to be used - * @param locale the signature locale - */ - public void setSignatureLocale(Locale locale); - - /** - * Set the signature PDF/A compatibility setting - * @param compat whether to use PDF/A compatibility - */ - public void setSignaturePdfACompat(boolean compat); - - /** - * Sets whether keystore signing is enabled - * @param enabled whether keystore signing is enabled - */ - public void setKeyStoreEnabled(Boolean enabled); - - /** - * Sets the keystore file - * @param file the keystore file - */ - public void setKeyStoreFile(String file); - - /** - * Sets the keystore type - * @param type the keystore type - */ - public void setKeyStoreType(String type); - - /** - * Sets the keystore alias - * @param alias the keystore alias - */ - public void setKeyStoreAlias(String alias); - - /** - * Sets the keystore store password - * @param storePass the keystore store password - */ - public void setKeyStoreStorePass(String storePass); - - /** - * Sets the keystore key password - * @param keyPass the keystore key password - */ - public void setKeyStoreKeyPass(String keyPass); - - /** - * Sets whether to automatically check for application updates - * @param checkUpdate whether to automatically check for application updates - */ - public void setUpdateCheck(boolean checkUpdate); - - /** - * Sets the default main window size - * @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; - - - /** - * Sets whether to use an existing signaturemarker. - * QR-Code only - * - * @param useMarker - * whether to use an existing signaturemarker - */ - public void setUseMarker(boolean useMarker); - - - /** - * Sets the use of signature fields as signature marker - * @param useFields - */ - public void setUseSignatureFields(boolean useFields); - - /** - * @param bool - */ - public void setEnablePlaceholderUsage(boolean bool); - - /** - * @return - */ - public boolean getEnablePlaceholderUsage(); - - /** - * @param profile - */ - public void setSignatureProfile(String profile); - - public void setSaveFilePostFix(String postFix); - -} - - diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java deleted file mode 100644 index 9c82845d..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigOverlayManipulator.java +++ /dev/null @@ -1,140 +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.workflow.config; - -import at.asit.pdfover.signator.BKUs; -import at.asit.pdfover.signator.SignaturePosition; - -/** - * 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 proxy username - * @param user the proxy username - */ - public void setProxyUserOverlay(String user); - - /** - * Sets the proxy password - * @param pass the proxy password - */ - public void setProxyPassOverlay(String pass); - - /** - * Sets the default output folder - * @param outputFolder the default output folder - */ - public void setDefaultOutputFolderOverlay(String outputFolder); - - /** - * Sets the signature position - * @param position the signature position - */ - public void setDefaultSignaturePositionOverlay(SignaturePosition position); - - /** - * Sets whether to skip the finish screen - * @param skipFinish whether to skip the finish screen - */ - public void setSkipFinishOverlay(boolean skipFinish); - - /** - * Sets whether keystore signing is enabled - * @param enabled whether keystore signing is enabled - */ - public void setKeyStoreEnabledOverlay(Boolean enabled); - - /** - * Sets the keystore file - * @param file the keystore file - */ - public void setKeyStoreFileOverlay(String file); - - /** - * Sets the keystore type - * @param type the keystore type - */ - public void setKeyStoreTypeOverlay(String type); - - /** - * Sets the keystore alias - * @param alias the keystore alias - */ - public void setKeyStoreAliasOverlay(String alias); - - /** - * Sets the keystore store password - * @param storePass the keystore store password - */ - public void setKeyStoreStorePassOverlay(String storePass); - - /** - * Sets the keystore key password - * @param keyPass the keystore key password - */ - public void setKeyStoreKeyPassOverlay(String keyPass); - - /** - * Sets the configuration file - * @param configurationFile - */ - public void setConfigurationFile(String configurationFile); - - /** - * - * @param profile - */ - public void setSignatureProfile(String profile); -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java deleted file mode 100644 index 3dd0dd7c..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProvider.java +++ /dev/null @@ -1,283 +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.workflow.config; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Locale; - -import org.eclipse.swt.graphics.Point; - -import at.asit.pdfover.gui.bku.mobile.MobileBKUs; -import at.asit.pdfover.signator.BKUs; -import at.asit.pdfover.signator.SignaturePosition; - -/** - * An interface for reading the configuration - */ -public interface ConfigProvider { - /** - * RegEx for parsing signature position - */ - public static final String SIGN_POS_REGEX = "(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?);p=(\\d))|(auto)|(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?))"; - - /** - * Loads the configuration from a configuration file - * - * @param configSource - * the configuration file - * @throws IOException - */ - public void loadConfiguration(InputStream configSource) throws IOException; - - /** - * Gets the configuration file - * - * @return the configuration file - */ - public String getConfigurationFile(); - - /** - * Gets the configuration directory - * - * @return the configuration directory - */ - public String getConfigurationDirectory(); - - /** - * Gets the default Mobile number - * - * @return the default mobile number - */ - public String getDefaultMobileNumber(); - - /** - * Gets the password to use for Mobile BKU - * - * @return the password - */ - public String getDefaultMobilePassword(); - - /** - * Gets the filename of the default emblem - * - * @return the emblem - */ - public String getDefaultEmblem(); - - /** - * Gets the proxy host - * - * @return the proxy hostname or ip address - */ - public String getProxyHost(); - - /** - * Gets the proxy port - * - * @return the proxy port - */ - public int getProxyPort(); - - /** - * Gets the proxy username - * - * @return the proxy username - */ - public String getProxyUser(); - - /** - * Gets the proxy password - * - * @return the proxy password - */ - public String getProxyPass(); - - /** - * Get the default configured BKU - * - * @return the default configured BKU - */ - public BKUs getDefaultBKU(); - - /** - * 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 default output folder for signed documents - * - * @return the default output folder - */ - public String getDefaultOutputFolder(); - - /** - * Gets the mobile BKU URL - * - * @return the mobile BKU URL - */ - public String getMobileBKUURL(); - - /** - * Gets the mobile BKU type - * - * @return the mobile BKU type - */ - public MobileBKUs getMobileBKUType(); - - /** - * Gets the mobile BKU BASE64 setting - * - * @return the mobile BKU BASE64 setting - */ - public boolean getMobileBKUBase64(); - - /** - * 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 getLocale(); - - /** - * Gets the configured locale - * - * @return the configured locale - */ - public Locale getSignatureLocale(); - - /** - * Get the signature PDF/A compatibility setting - * - * @return the signature PDF/A compatibility setting - */ - public boolean getSignaturePdfACompat(); - - /** - * Gets whether keystore signing is enabled - * - * @return whether keystore signing is enabled - */ - public Boolean getKeyStoreEnabled(); - - /** - * Gets the keystore file - * - * @return the keystore file - */ - public String getKeyStoreFile(); - - /** - * Gets the keystore type - * - * @return the keystore type - */ - public String getKeyStoreType(); - - /** - * Gets the keystore alias - * - * @return the keystore alias - */ - public String getKeyStoreAlias(); - - /** - * Gets the keystore store password - * - * @return the keystore store password - */ - public String getKeyStoreStorePass(); - - /** - * Gets the keystore key password - * - * @return the keystore key password - */ - public String getKeyStoreKeyPass(); - - /** - * Gets whether to automatically check for application updates - * - * @return whether to automatically check for application updates - */ - public boolean getUpdateCheck(); - - /** - * Gets the configured MainWindow size - * - * @return the configured MainWindow size - */ - public Point getMainWindowSize(); - - /** - * Gets whether to skip the finish screen - * - * @return whether to skip the finish screen - */ - public boolean getSkipFinish(); - - /** - * Gets whether to use signature markers. - * - * @return whether to use a signature maker - */ - public boolean getUseMarker(); - - /** - * Gets whether to use signature fileds instead of QR code. - * - * @return boolean - */ - public boolean getUseSignatureFields(); - - /** - * @return - */ - public boolean getEnablePlaceholderUsage(); - - /** - * @param profile - */ - public void setSignatureProfile(String profile); - - - /** - * @return - */ - public String getSignatureProfile(); - - public String getSaveFilePostFix(); -} - - diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java index 69978e27..386f4763 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java @@ -39,11 +39,12 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.signator.BKUs; import at.asit.pdfover.signator.SignaturePosition; +// TODO: review which properties use the overlay in this file (also: remove unneeded setters/getters, maybe template impl for overlays?) + /** * Implementation of the configuration provider and manipulator */ -public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, - ConfigOverlayManipulator, PersistentConfigProvider { +public class ConfigProviderImpl { /** Default Mobile BKU type */ @@ -77,14 +78,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, this.configurationOverlay = new ConfigurationContainer(); } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigProvider#loadConfiguration(java.io - * .InputStream) - */ - @Override + /* load from disk (file input stream) */ public void loadConfiguration(InputStream configSource) throws IOException { Properties config = new Properties(); @@ -237,7 +231,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, if (signaturePosition != null && !signaturePosition.trim().isEmpty()) { signaturePosition = signaturePosition.trim().toLowerCase(); - Pattern pattern = Pattern.compile(SIGN_POS_REGEX); + Pattern pattern = Pattern.compile("(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?);p=(\\d))|(auto)|(x=(\\d\\.?\\d?);y=(\\d\\.?\\d?))"); Matcher matcher = pattern.matcher(signaturePosition); if (matcher.matches()) { if (matcher.groupCount() == 8) { @@ -297,18 +291,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setUpdateCheck(!updateCheck.equalsIgnoreCase(Constants.FALSE)); } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigManipulator#saveCurrentConfiguration() - */ - @Override + /* save to file */ public void saveCurrentConfiguration() throws IOException { String filename = this.getConfigurationFile(); - - File configFile = new File(this.getConfigurationDirectory() - + File.separator + filename); + File configFile = new File(this.getConfigurationDirectory() + File.separator + filename); Properties props = new Properties(); props.clear(); @@ -420,65 +406,20 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigProvider#getConfigurationDirectory() - */ - @Override - public String getConfigurationDirectory() { - return Constants.CONFIG_DIRECTORY; - } + public String getConfigurationDirectory() { return Constants.CONFIG_DIRECTORY; } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigManipulator#setConfigurationFile(java - * .lang.String) - */ - @Override - public void setConfigurationFile(String configurationFile) { - this.configurationFile = configurationFile; - } + // TODO review this + public void setConfigurationFile(String configurationFile) { this.configurationFile = configurationFile; } + public String getConfigurationFile() { return this.configurationFile; } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigurationFile() - */ - @Override - public String getConfigurationFile() { - return this.configurationFile; - } - - /** - * Sets the default bku type - * - * @param bku - * the bku type - */ - @Override public void setDefaultBKU(BKUs bku) { this.configuration.defaultBKU = bku; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigOverlayManipulator#setDefaultBKUOverlay(at.asit.pdfover.signator.BKUs) - */ - @Override public void setDefaultBKUOverlay(BKUs bku) { this.configurationOverlay.defaultBKU = bku; - } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultBKU() - */ - @Override public BKUs getDefaultBKU() { BKUs bku = this.configurationOverlay.defaultBKU; if (bku == BKUs.NONE) @@ -486,41 +427,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return bku; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultBKUPersistent() - */ - @Override public BKUs getDefaultBKUPersistent() { return this.configuration.defaultBKU; } - /** - * Sets the default signature position - * - * @param signaturePosition - * the default signature position - */ - @Override public void setDefaultSignaturePosition(SignaturePosition signaturePosition) { this.configuration.defaultSignaturePosition = signaturePosition; } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setDefaultSignaturePositionOverlay(at.asit.pdfover.signator.SignaturePosition) - */ - @Override public void setDefaultSignaturePositionOverlay(SignaturePosition signaturePosition) { this.configurationOverlay.defaultSignaturePosition = signaturePosition; } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultSignaturePosition() - */ - @Override public SignaturePosition getDefaultSignaturePosition() { SignaturePosition position = this.configurationOverlay.defaultSignaturePosition; if (position == null) @@ -528,43 +446,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return position; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getDefaultSignaturePositionPersistent() - */ - @Override public SignaturePosition getDefaultSignaturePositionPersistent() { return this.configuration.defaultSignaturePosition; } - /** - * Sets the signature placeholder transparency - * - * @param transparency - * the signature placeholder transparency - */ - @Override public void setPlaceholderTransparency(int transparency) { this.configuration.placeholderTransparency = transparency; } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigProvider#getPlaceholderTransparency() - */ - @Override public int getPlaceholderTransparency() { return this.configuration.placeholderTransparency; } - /** - * Sets the default mobile number - * - * @param number - * the default mobile number - */ - @Override public void setDefaultMobileNumber(String number) { if (number == null || number.trim().isEmpty()) { this.configuration.setMobileNumber(STRING_EMPTY); @@ -573,10 +466,6 @@ 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) { if (number == null || number.trim().isEmpty()) { this.configurationOverlay.setMobileNumber(STRING_EMPTY); @@ -585,12 +474,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultMobileNumber() - */ - @Override public String getDefaultMobileNumber() { String number = this.configurationOverlay.getMobileNumber(); if (number == null) @@ -598,10 +481,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return number; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultMobileNumberPersistent() - */ - @Override public String getDefaultMobileNumberPersistent() { String number = this.configuration.getMobileNumber(); if (number == null) @@ -609,13 +488,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return number; } - /** - * Sets the default mobile password - * - * @param password - * the default password - */ - @Override public void setDefaultMobilePassword(String password) { if (password == null || password.trim().isEmpty()) { this.configuration.mobilePassword = STRING_EMPTY; @@ -624,10 +496,6 @@ 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.mobilePassword = STRING_EMPTY; @@ -636,12 +504,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultPassword() - */ - @Override public String getDefaultMobilePassword() { String password = this.configurationOverlay.mobilePassword; if (password == null) @@ -649,10 +511,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return password; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultMobilePasswordPersistent() - */ - @Override public String getDefaultMobilePasswordPersistent() { String password = this.configuration.mobilePassword; if (password == null) @@ -660,13 +518,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return password; } - /** - * Sets the default emblem - * - * @param emblem - * the default emblem - */ - @Override public void setDefaultEmblem(String emblem) { try { if (emblem == null || emblem.trim().isEmpty()) { @@ -684,10 +535,6 @@ 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()) { @@ -705,12 +552,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultEmblem() - */ - @Override public String getDefaultEmblem() { String emblem = this.configurationOverlay.getEmblem(); if (emblem == null) @@ -718,10 +559,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return emblem; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultEmblemPersistent() - */ - @Override public String getDefaultEmblemPersistent() { String emblem = this.configuration.getEmblem(); if (emblem == null) @@ -729,18 +566,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return emblem; } - /*@Override - public String getDownloadURL() { - return Constants.CERTIFICATE_DOWNLOAD_XML_URL; - }*/ - - /** - * Sets the proxy host - * - * @param host - * the proxy host - */ - @Override public void setProxyHost(String host) { if (host == null || host.trim().isEmpty()) { this.configuration.proxyHost = STRING_EMPTY; @@ -749,10 +574,6 @@ 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.proxyHost = STRING_EMPTY; @@ -761,12 +582,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getProxyHost() - */ - @Override public String getProxyHost() { String host = this.configurationOverlay.proxyHost; if (host == null) @@ -774,10 +589,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return host; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getProxyHostPersistent() - */ - @Override public String getProxyHostPersistent() { String host = this.configuration.proxyHost; if (host == null) @@ -785,13 +596,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return host; } - /** - * Sets the proxy port - * - * @param port - * the proxy port - */ - @Override public void setProxyPort(int port) { try { this.configuration.setProxyPort(port); @@ -801,10 +605,6 @@ 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); @@ -814,12 +614,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getProxyPort() - */ - @Override public int getProxyPort() { int port = this.configurationOverlay.getProxyPort(); if (port == -1) @@ -827,21 +621,10 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return port; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getProxyPortPersistent() - */ - @Override public int getProxyPortPersistent() { return this.configuration.getProxyPort(); } - /** - * Sets the proxy username - * - * @param user - * the proxy username - */ - @Override public void setProxyUser(String user) { if (user == null || user.trim().isEmpty()) { this.configuration.proxyUser = STRING_EMPTY; @@ -850,10 +633,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setProxyUserOverlay(java.lang.String) - */ - @Override public void setProxyUserOverlay(String user) { if (user == null || user.trim().isEmpty()) { this.configurationOverlay.proxyUser = STRING_EMPTY; @@ -862,10 +641,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getProxyUser() - */ - @Override public String getProxyUser() { String user = this.configurationOverlay.proxyUser; if (user == null) @@ -873,10 +648,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return user; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getProxyUserPersistent() - */ - @Override public String getProxyUserPersistent() { String user = this.configuration.proxyUser; if (user == null) @@ -884,13 +655,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return user; } - /** - * Sets the proxy password - * - * @param pass - * the proxy password - */ - @Override public void setProxyPass(String pass) { if (pass == null || pass.trim().isEmpty()) { this.configuration.proxyPass = STRING_EMPTY; @@ -899,10 +663,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setProxyPassOverlay(java.lang.String) - */ - @Override public void setProxyPassOverlay(String pass) { if (pass == null || pass.trim().isEmpty()) { this.configurationOverlay.proxyPass = STRING_EMPTY; @@ -911,10 +671,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getProxyPass() - */ - @Override public String getProxyPass() { String pass = this.configurationOverlay.proxyPass; if (pass == null) @@ -922,10 +678,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return pass; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getProxyPassPersistent() - */ - @Override public String getProxyPassPersistent() { String pass = this.configuration.proxyPass; if (pass == null) @@ -933,14 +685,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return pass; } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigManipulator#setDefaultOutputFolder - * (java.lang.String) - */ - @Override public void setDefaultOutputFolder(String outputFolder) { if (outputFolder == null || outputFolder.trim().isEmpty()) { this.configuration.outputFolder = STRING_EMPTY; @@ -949,10 +693,6 @@ 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.outputFolder = STRING_EMPTY; @@ -961,12 +701,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getDefaultOutputFolder() - */ - @Override public String getDefaultOutputFolder() { String outputFolder = this.configurationOverlay.outputFolder; if (outputFolder == null) @@ -974,10 +708,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return outputFolder; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.PersistentConfigProvider#getDefaultOutputFolderPersistent() - */ - @Override public String getDefaultOutputFolderPersistent() { String outputFolder = this.configuration.outputFolder; if (outputFolder == null) @@ -985,41 +715,18 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return outputFolder; } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getMobileBKUURL() - */ - @Override public String getMobileBKUURL() { return this.configuration.mobileBKUURL; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getMobileBKUType() - */ - @Override public MobileBKUs getMobileBKUType() { return this.configuration.mobileBKUType; } - - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getMobileBKUBase64() - */ - @Override public boolean getMobileBKUBase64() { return this.configuration.mobileBKUBase64; } - /* - * (non-Javadoc) - * - * @see - * at.asit.pdfover.gui.workflow.ConfigManipulator#setSignatureNote(java. - * lang.String) - */ - @Override public void setSignatureNote(String note) { if (note == null || note.trim().isEmpty()) { this.configuration.signatureNote = STRING_EMPTY; @@ -1028,12 +735,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSignatureNote() - */ - @Override public String getSignatureNote() { String note = this.configuration.signatureNote; if (note == null) @@ -1041,10 +742,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return note; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigManipulator#setLocale(java.util.Locale) - */ - @Override public void setLocale(Locale locale) { if(locale == null) { this.configuration.locale = Messages.getDefaultLocale(); @@ -1055,10 +752,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getConfigLocale() - */ - @Override public Locale getLocale() { Locale locale = this.configuration.locale; if (locale == null) @@ -1066,10 +759,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return locale; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigManipulator#setSignatureLocale(java.util.Locale) - */ - @Override public void setSignatureLocale(Locale locale) { if(locale == null) { this.configuration.signatureLocale = Messages.getDefaultLocale(); @@ -1078,10 +767,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getSignatureLocale() - */ - @Override public Locale getSignatureLocale() { Locale locale = this.configuration.signatureLocale; if (locale == null) @@ -1089,42 +774,22 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return locale; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setSignaturePdfACompat(boolean) - */ - @Override public void setSignaturePdfACompat(boolean compat) { this.configuration.signaturePDFACompat = compat; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getSignaturePdfACompat() - */ - @Override public boolean getSignaturePdfACompat() { return this.configuration.signaturePDFACompat; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreEnabled(boolean) - */ - @Override public void setKeyStoreEnabled(Boolean enabled) { this.configuration.keystoreEnabled = enabled; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreEnabledOverlay(boolean) - */ - @Override public void setKeyStoreEnabledOverlay(Boolean enabled) { this.configurationOverlay.keystoreEnabled = enabled; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreEnabled() - */ - @Override public Boolean getKeyStoreEnabled() { Boolean enabled = this.configurationOverlay.keystoreEnabled; if (enabled == null) @@ -1132,10 +797,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return enabled; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreEnabledPersistent() - */ - @Override public Boolean getKeyStoreEnabledPersistent() { Boolean enabled = this.configuration.keystoreEnabled; if (enabled == null) @@ -1143,10 +804,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return enabled; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreFile(java.lang.String) - */ - @Override public void setKeyStoreFile(String file) { if (file == null || file.trim().isEmpty()) { this.configuration.keystoreFile = STRING_EMPTY; @@ -1155,10 +812,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreFileOverlay(java.lang.String) - */ - @Override public void setKeyStoreFileOverlay(String file) { if (file == null || file.trim().isEmpty()) { this.configurationOverlay.keystoreFile = STRING_EMPTY; @@ -1167,10 +820,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreFile() - */ - @Override public String getKeyStoreFile() { String file = this.configurationOverlay.keystoreFile; if (file == null) @@ -1178,10 +827,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return file; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreFilePersistent() - */ - @Override public String getKeyStoreFilePersistent() { String file = this.configuration.keystoreFile; if (file == null) @@ -1189,10 +834,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return file; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreType(java.lang.String) - */ - @Override public void setKeyStoreType(String type) { if (type == null || type.trim().isEmpty()) { this.configuration.keystoreType = STRING_EMPTY; @@ -1201,10 +842,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreTypeOverlay(java.lang.String) - */ - @Override public void setKeyStoreTypeOverlay(String type) { if (type == null || type.trim().isEmpty()) { this.configurationOverlay.keystoreType = STRING_EMPTY; @@ -1213,10 +850,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreType() - */ - @Override public String getKeyStoreType() { String type = this.configurationOverlay.keystoreType; if (type == null) @@ -1224,10 +857,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return type; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreTypePersistent() - */ - @Override public String getKeyStoreTypePersistent() { String type = this.configuration.keystoreType; if (type == null) @@ -1235,10 +864,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return type; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreAlias(java.lang.String) - */ - @Override public void setKeyStoreAlias(String alias) { if (alias == null || alias.trim().isEmpty()) { this.configuration.keystoreAlias = STRING_EMPTY; @@ -1247,10 +872,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreAliasOverlay(java.lang.String) - */ - @Override public void setKeyStoreAliasOverlay(String alias) { if (alias == null || alias.trim().isEmpty()) { this.configurationOverlay.keystoreAlias = STRING_EMPTY; @@ -1259,10 +880,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreAlias() - */ - @Override public String getKeyStoreAlias() { String alias = this.configurationOverlay.keystoreAlias; if (alias == null) @@ -1270,10 +887,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return alias; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreAliasPersistent() - */ - @Override public String getKeyStoreAliasPersistent() { String alias = this.configuration.keystoreAlias; if (alias == null) @@ -1281,10 +894,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return alias; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreStorePass(java.lang.String) - */ - @Override public void setKeyStoreStorePass(String storePass) { if (storePass == null || storePass.trim().isEmpty()) { this.configuration.keystoreStorePass = STRING_EMPTY; @@ -1293,10 +902,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreStorePassOverlay(java.lang.String) - */ - @Override public void setKeyStoreStorePassOverlay(String storePass) { if (storePass == null || storePass.trim().isEmpty()) { this.configurationOverlay.keystoreStorePass = STRING_EMPTY; @@ -1305,10 +910,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreStorePass() - */ - @Override public String getKeyStoreStorePass() { String storePass = this.configurationOverlay.keystoreStorePass; if (storePass != null) @@ -1316,10 +917,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return getKeyStoreStorePassPersistent(); } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreStorePassPersistent() - */ - @Override public String getKeyStoreStorePassPersistent() { String storePass = this.configuration.keystoreStorePass; if (storePass == null) @@ -1327,10 +924,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return storePass; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreKeyPass(java.lang.String) - */ - @Override public void setKeyStoreKeyPass(String keyPass) { if (keyPass == null || keyPass.trim().isEmpty()) { this.configuration.keystoreKeyPass = STRING_EMPTY; @@ -1339,10 +932,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setKeyStoreKeyPassOverlay(java.lang.String) - */ - @Override public void setKeyStoreKeyPassOverlay(String keyPass) { if (keyPass == null || keyPass.trim().isEmpty()) { this.configurationOverlay.keystoreKeyPass = STRING_EMPTY; @@ -1351,10 +940,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, } } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreKeyPass() - */ - @Override public String getKeyStoreKeyPass() { String keyPass = this.configurationOverlay.keystoreKeyPass; if (keyPass != null) @@ -1362,10 +947,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return getKeyStoreKeyPassPersistent(); } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreKeyPassPersistent() - */ - @Override public String getKeyStoreKeyPassPersistent() { String keyPass = this.configuration.keystoreKeyPass; if (keyPass == null) @@ -1373,120 +954,68 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, return keyPass; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setUpdateCheck(boolean) - */ - @Override public void setUpdateCheck(boolean checkUpdate) { this.configuration.updateCheck = checkUpdate; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getUpdateCheck() - */ - @Override public boolean getUpdateCheck() { return this.configuration.updateCheck; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigManipulator#setMainWindowSize(org.eclipse.swt.graphics.Point) - */ - @Override public void setMainWindowSize(Point size) { this.configuration.mainWindowSize = size; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.ConfigProvider#getMainWindowSize() - */ - @Override public Point getMainWindowSize() { return this.configuration.mainWindowSize; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getSkipFinish() - */ - @Override public boolean getSkipFinish() { return this.configurationOverlay.skipFinish; } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.ConfigOverlayManipulator#setSkipFinishOverlay(boolean) - */ - @Override public void setSkipFinishOverlay(boolean skipFinish) { this.configurationOverlay.skipFinish = skipFinish; } - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getUseMarker() - */ - @Override public boolean getUseMarker() { return this.configurationOverlay.getUseMarker(); } - /* (non-Javadoc) - * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getUseSignatureFields() - */ - @Override public boolean getUseSignatureFields() { return this.configurationOverlay.getUseSignatureFields(); } - - - - /* - * (non-Javadoc) - * - * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setUseMarker( - * boolean) - */ - @Override public void setUseMarker(boolean useMarker) { this.configurationOverlay.setUseMarker(useMarker); if (useMarker) setUseSignatureFields(false); } - @Override public void setUseSignatureFields(boolean useFields) { this.configurationOverlay.setUseSignatureFields(useFields); if (useFields) setUseMarker(false); } - @Override public void setSignatureProfile(String profile) { this.configurationOverlay.setSignatureProfile(Profile.getProfile(profile)); } - @Override public void setSaveFilePostFix(String postFix) { this.configurationOverlay.saveFilePostFix = postFix; } - @Override public String getSaveFilePostFix(){ return this.configurationOverlay.saveFilePostFix; } - @Override public String getSignatureProfile() { return this.configurationOverlay.getSignatureProfile().name(); } - - @Override public void setEnablePlaceholderUsage(boolean bool) { this.configurationOverlay.enabledPlaceholderUsage = bool; } - @Override public boolean getEnablePlaceholderUsage() { return this.configurationOverlay.enabledPlaceholderUsage; } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java deleted file mode 100644 index 9bf81a05..00000000 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/PersistentConfigProvider.java +++ /dev/null @@ -1,210 +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.workflow.config; - -import java.util.Locale; - -import org.eclipse.swt.graphics.Point; - -import at.asit.pdfover.gui.bku.mobile.MobileBKUs; -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 proxy username - * @return the proxy username - */ - public String getProxyUserPersistent(); - - /** - * Gets the proxy password - * @return the proxy password - */ - public String getProxyPassPersistent(); - - /** - * Gets the default output folder for signed documents - * @return the default output folder - */ - public String getDefaultOutputFolderPersistent(); - - /** - * Get the default configured SignaturePosition - * @return the default configured SignaturePosition or null if not configured - */ - public SignaturePosition getDefaultSignaturePositionPersistent(); - - // Declare the other configuration getters for convenience - - /** - * 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(); - - /** - * Gets the mobile BKU type - * @return the mobile BKU type - */ - public MobileBKUs getMobileBKUType(); - - /** - * 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 getLocale(); - - /** - * Gets the configured locale - * @return the configured locale - */ - public Locale getSignatureLocale(); - - /** - * Get the signature PDF/A compatibility setting - * @return the signature PDF/A compatibility setting - */ - public boolean getSignaturePdfACompat(); - - /** - * Gets whether keystore signing is enabled - * @return whether keystore signing is enabled - */ - public Boolean getKeyStoreEnabledPersistent(); - - /** - * Gets the keystore file - * @return the keystore file - */ - public String getKeyStoreFilePersistent(); - - /** - * Gets the keystore type - * @return the keystore type - */ - public String getKeyStoreTypePersistent(); - - /** - * Gets the keystore alias - * @return the keystore alias - */ - public String getKeyStoreAliasPersistent(); - - /** - * Gets the keystore store password - * @return the keystore store password - */ - public String getKeyStoreStorePassPersistent(); - - /** - * Gets the keystore key password - * @return the keystore key password - */ - public String getKeyStoreKeyPassPersistent(); - - /** - * Gets whether to automatically check for application updates - * @return whether to automatically check for application updates - */ - public boolean getUpdateCheck(); - - /** - * Gets the configured MainWindow size - * @return the configured MainWindow size - */ - public Point getMainWindowSize(); - - /** - * Gets whether to use an existing singature marker. - * - * @return whether to use an existing singature marker - */ - public boolean getUseMarker(); - - /** - * Gets whether to use an existing signature fields. - * - * @return boolean - */ - public boolean getUseSignatureFields(); - - /** - * @return - */ - public boolean getEnablePlaceholderUsage(); - - /*** - * - * @return the signature profile - */ - public String getSignatureProfile(); - - public String getSaveFilePostFix(); -} diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java index 01df1863..5023781a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java @@ -27,7 +27,6 @@ import at.asit.pdfover.gui.MainWindowBehavior; import at.asit.pdfover.gui.composites.BKUSelectionComposite; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.gui.workflow.config.ConfigProvider; import at.asit.pdfover.signator.BKUs; /** @@ -76,8 +75,7 @@ public class BKUSelectionState extends State { )) { status.bku = BKUs.NONE; } else if(!(status.getPreviousState() instanceof BKUSelectionState)) { - ConfigProvider config = getStateMachine().configProvider; - status.bku = config.getDefaultBKU(); + getStateMachine().configProvider.getDefaultBKU(); } if(status.bku == BKUs.NONE) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java index 94171262..3e74f9ec 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java @@ -30,7 +30,7 @@ import at.asit.pdfover.gui.controls.PasswordInputDialog; 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.ConfigProvider; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.signator.SignatureException; import at.asit.pdfover.signator.SigningState; @@ -64,7 +64,7 @@ public class KSState extends State { Status status = getStateMachine().status; SigningState signingState = status.signingState; - ConfigProvider config = getStateMachine().configProvider; + ConfigProviderImpl config = getStateMachine().configProvider; try { String file = config.getKeyStoreFile(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java index 6d59dfd5..3595e003 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java @@ -46,7 +46,7 @@ import at.asit.pdfover.gui.controls.Dialog.BUTTONS; import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.commons.Messages;
import at.asit.pdfover.gui.workflow.StateMachine;
-import at.asit.pdfover.gui.workflow.config.ConfigProvider;
+import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl;
import at.asit.pdfover.signator.SigningState;
/**
@@ -64,7 +64,7 @@ public class MobileBKUState extends State { public MobileBKUState(StateMachine stateMachine) {
super(stateMachine);
- ConfigProvider provider = stateMachine.configProvider;
+ ConfigProviderImpl provider = stateMachine.configProvider;
switch(provider.getMobileBKUType()) {
case A_TRUST:
this.status = new ATrustStatus(provider);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java index 4457f902..77e1edf4 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OpenState.java @@ -40,7 +40,7 @@ import at.asit.pdfover.gui.composites.DataSourceSelectComposite; 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.ConfigProvider; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.signator.SignaturePosition; import at.gv.egiz.pdfas.lib.impl.placeholder.SignaturePlaceholderData; @@ -81,7 +81,7 @@ public class OpenState extends State { @Override public void run() { - ConfigProvider config = getStateMachine().configProvider; + ConfigProviderImpl config = getStateMachine().configProvider; Status status = getStateMachine().status; if (!(status.getPreviousState() instanceof PrepareConfigurationState) && !(status.getPreviousState() instanceof OpenState)) { diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index e8b9402d..0a6db176 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -28,7 +28,7 @@ import at.asit.pdfover.gui.controls.Dialog.BUTTONS; 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.ConfigProvider; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; /** * Produces the output of the signature process. (save file, open file) @@ -49,7 +49,7 @@ public class OutputState extends State { this.outputComposite = getStateMachine() .createComposite(OutputComposite.class, SWT.RESIZE, this); - ConfigProvider config = getStateMachine().configProvider; + ConfigProviderImpl config = getStateMachine().configProvider; Status status = getStateMachine().status; File tmpDir = new File(config.getConfigurationDirectory() + File.separator + "tmp"); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java index 6d00cce0..84d61cb0 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java @@ -35,7 +35,7 @@ import at.asit.pdfover.commons.Messages; import at.asit.pdfover.gui.utils.SignaturePlaceholderCache; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.gui.workflow.config.ConfigProvider; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.signator.CachedFileNameEmblem; import at.asit.pdfover.signator.Emblem; import at.asit.pdfover.signator.SignatureParameter; @@ -119,7 +119,7 @@ public class PositioningState extends State { this.positionComposite.displayDocument(document); } // Update possibly changed values - ConfigProvider config = stateMachine.configProvider; + ConfigProviderImpl config = stateMachine.configProvider; SignatureParameter param = stateMachine.pdfSigner.getPDFSigner().newParameter(); Emblem emblem = new CachedFileNameEmblem(config.getDefaultEmblem()); param.setEmblem(emblem); 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 451f2b55..616fa63f 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 @@ -53,7 +53,7 @@ import at.asit.pdfover.gui.utils.Zipper; import at.asit.pdfover.gui.workflow.GUIProvider; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; -import at.asit.pdfover.gui.workflow.config.ConfigProvider; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.signator.Signator; /** @@ -109,10 +109,9 @@ public class PrepareConfigurationState extends State { throws InitializationException { try { + // TODO: move this to ConfigProviderImpl to mirror save logic try { - getStateMachine().configProvider.loadConfiguration( - new FileInputStream( - getStateMachine().configProvider.getConfigurationDirectory() + FILE_SEPARATOR + filename)); + getStateMachine().configProvider.loadConfiguration(new FileInputStream(getStateMachine().configProvider.getConfigurationDirectory() + FILE_SEPARATOR + filename)); log.info("Loaded config from file : " + filename); } catch (FileNotFoundException ex) { @@ -144,7 +143,7 @@ public class PrepareConfigurationState extends State { * Update configuration values as necessary */ private void updateConfiguration() { - ConfigProvider config = getStateMachine().configProvider; + ConfigProviderImpl config = getStateMachine().configProvider; //Update signature note if old default is used String note = config.getSignatureNote(); @@ -155,7 +154,7 @@ public class PrepareConfigurationState extends State { resetSignatureNoteField(config); } - private void resetSignatureNoteField(ConfigProvider config){ + private void resetSignatureNoteField(ConfigProviderImpl config){ getStateMachine().configProvider.setSignatureNote( Profile.getProfile(config.getSignatureProfile()).getDefaultSignatureBlockNote(config.getLocale()) ); @@ -399,7 +398,7 @@ public class PrepareConfigurationState extends State { // Read config file try { StateMachine stateMachine = getStateMachine(); - ConfigProvider config = stateMachine.configProvider; + ConfigProviderImpl config = stateMachine.configProvider; final GUIProvider gui = stateMachine; String cDir = config.getConfigurationDirectory(); File configDir = new File(cDir); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index 5bc9ec54..364da8c7 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -31,7 +31,7 @@ import at.asit.pdfover.gui.controls.ErrorDialog; 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.ConfigProvider; +import at.asit.pdfover.gui.workflow.config.ConfigProviderImpl; import at.asit.pdfover.signator.CachedFileNameEmblem; import at.asit.pdfover.signator.PDFFileDocumentSource; import at.asit.pdfover.signator.SignatureParameter; @@ -69,7 +69,7 @@ public class PrepareSigningState extends State { Status status = this.state.getStateMachine().status; - ConfigProvider configuration = this.state.getStateMachine().configProvider; + ConfigProviderImpl configuration = this.state.getStateMachine().configProvider; // SET PROXY HOST and PORT settings final String proxyHost = configuration.getProxyHost(); |