From 7acdb4cb960e875bba892d9581d58a3aed9e0846 Mon Sep 17 00:00:00 2001 From: Tobias Kellner Date: Mon, 12 Oct 2015 04:23:04 +0200 Subject: add keystore alias --- .../composites/KeystoreConfigurationComposite.java | 3 ++ .../gui/workflow/config/ConfigManipulator.java | 6 +++ .../workflow/config/ConfigOverlayManipulator.java | 6 +++ .../gui/workflow/config/ConfigProvider.java | 6 +++ .../gui/workflow/config/ConfigProviderImpl.java | 51 ++++++++++++++++++++++ .../workflow/config/ConfigurationContainer.java | 11 +++++ .../config/ConfigurationContainerImpl.java | 19 ++++++++ .../workflow/config/PersistentConfigProvider.java | 6 +++ 8 files changed, 108 insertions(+) (limited to 'pdf-over-gui/src/main/java') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java index 9113d3bb..aa42a7bb 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/KeystoreConfigurationComposite.java @@ -180,6 +180,8 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite { provider.getKeyStoreFilePersistent()); this.configurationContainer.setKeyStoreType( provider.getKeyStoreTypePersistent()); + this.configurationContainer.setKeyStoreAlias( + provider.getKeyStoreAliasPersistent()); this.configurationContainer.setKeyStoreStorePass( provider.getKeyStoreStorePassPersistent()); this.configurationContainer.setKeyStoreKeyPass( @@ -204,6 +206,7 @@ public class KeystoreConfigurationComposite extends BaseConfigurationComposite { PersistentConfigProvider provider) { store.setKeyStoreFile(this.configurationContainer.getKeyStoreFile()); store.setKeyStoreType(this.configurationContainer.getKeyStoreType()); + store.setKeyStoreAlias(this.configurationContainer.getKeyStoreAlias()); store.setKeyStoreStorePass(this.configurationContainer.getKeyStoreStorePass()); store.setKeyStoreKeyPass(this.configurationContainer.getKeyStoreKeyPass()); } 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 index 701d0faf..f28358b8 100644 --- 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 @@ -135,6 +135,12 @@ public interface ConfigManipulator { */ 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 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 index 4eca4e4f..44c4a9c9 100644 --- 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 @@ -108,6 +108,12 @@ public interface ConfigOverlayManipulator { */ 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 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 index 30063efa..d00860e5 100644 --- 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 @@ -180,6 +180,12 @@ public interface ConfigProvider { */ public String getKeyStoreType(); + /** + * Gets the keystore alias + * @return the keystore alias + */ + public String getKeyStoreAlias(); + /** * Gets the keystore store password * @return the keystore store password 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 edc6e167..ad9c4580 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 @@ -282,6 +282,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, setKeyStoreFile(keystoreFile); String keystoreType = config.getProperty(Constants.CFG_KEYSTORE_TYPE); setKeyStoreType(keystoreType); + String keystoreAlias = config.getProperty(Constants.CFG_KEYSTORE_ALIAS); + setKeyStoreAlias(keystoreAlias); String keystoreStorePass = config.getProperty(Constants.CFG_KEYSTORE_STOREPASS); setKeyStoreStorePass(keystoreStorePass); String keystoreKeyPass = config.getProperty(Constants.CFG_KEYSTORE_KEYPASS); @@ -380,6 +382,9 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator, String keystoreType = getKeyStoreTypePersistent(); if (keystoreType != STRING_EMPTY) props.setProperty(Constants.CFG_KEYSTORE_TYPE, keystoreType); + String keystoreAlias = getKeyStoreAliasPersistent(); + if (keystoreAlias != STRING_EMPTY) + props.setProperty(Constants.CFG_KEYSTORE_ALIAS, keystoreAlias); String keystoreStorePass = getKeyStoreStorePassPersistent(); if (keystoreStorePass != STRING_EMPTY) props.setProperty(Constants.CFG_KEYSTORE_STOREPASS, keystoreStorePass); @@ -1226,6 +1231,52 @@ 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.setKeyStoreAlias(STRING_EMPTY); + } else { + this.configuration.setKeyStoreAlias(alias); + } + } + + /* (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.setKeyStoreAlias(STRING_EMPTY); + } else { + this.configurationOverlay.setKeyStoreAlias(alias); + } + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigProvider#getKeyStoreAlias() + */ + @Override + public String getKeyStoreAlias() { + String alias = this.configurationOverlay.getKeyStoreAlias(); + if (alias == null) + alias = getKeyStoreAliasPersistent(); + return alias; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.PersistentConfigProvider#getKeyStoreAliasPersistent() + */ + @Override + public String getKeyStoreAliasPersistent() { + String alias = this.configuration.getKeyStoreAlias(); + if (alias == null) + alias = STRING_EMPTY; + return alias; + } + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.config.ConfigManipulator#setKeyStoreStorePass(java.lang.String) */ diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java index 9b312ee6..95429296 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainer.java @@ -291,6 +291,17 @@ public interface ConfigurationContainer { */ public void setKeyStoreType(String type); + /** + * Gets the keystore alias + * @return the keystore alias + */ + public String getKeyStoreAlias(); + + /** + * Sets the keystore alias + * @param alias the keystore alias + */ + public void setKeyStoreAlias(String alias); /** * Gets the keystore store password * @return the keystore store password diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java index f1817c83..cbc4a90e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigurationContainerImpl.java @@ -118,6 +118,9 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { /** Keystore type */ protected String keystoreType = null; + /** Keystore alias */ + protected String keystoreAlias = null; + /** Keystore store password */ protected String keystoreStorePass = null; @@ -536,6 +539,22 @@ public class ConfigurationContainerImpl implements ConfigurationContainer { this.keystoreType = type; } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreAlias() + */ + @Override + public String getKeyStoreAlias() { + return this.keystoreAlias; + } + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#setKeyStoreAlias(java.lang.String) + */ + @Override + public void setKeyStoreAlias(String alias) { + this.keystoreAlias = alias; + } + /* (non-Javadoc) * @see at.asit.pdfover.gui.workflow.config.ConfigurationContainer#getKeyStoreStorePass() */ 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 index c3c78c75..cf355f34 100644 --- 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 @@ -151,6 +151,12 @@ public interface PersistentConfigProvider { */ public String getKeyStoreTypePersistent(); + /** + * Gets the keystore alias + * @return the keystore alias + */ + public String getKeyStoreAliasPersistent(); + /** * Gets the keystore store password * @return the keystore store password -- cgit v1.2.3