diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 13:55:58 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 13:55:58 +0200 |
commit | 67be1fda9ffe39c01ce5374c88c6142a8c7a7fa4 (patch) | |
tree | eaa96d0cc536c76b8d3609f3f8dc6bd51bd28990 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java | |
parent | 25bbd0eeca461fb5d501854c14ecec797603d8cc (diff) | |
download | pdf-over-67be1fda9ffe39c01ce5374c88c6142a8c7a7fa4.tar.gz pdf-over-67be1fda9ffe39c01ce5374c88c6142a8c7a7fa4.tar.bz2 pdf-over-67be1fda9ffe39c01ce5374c88c6142a8c7a7fa4.zip |
simply configuration loading
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java | 22 |
1 files changed, 12 insertions, 10 deletions
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 2dfe879b..2e120b1d 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 @@ -17,9 +17,9 @@ package at.asit.pdfover.gui.workflow.config; // Imports import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.util.Locale; import java.util.Properties; import java.util.regex.Matcher; @@ -78,19 +78,17 @@ public class ConfigProviderImpl { this.configurationOverlay = new ConfigurationContainer(); } - /* load from disk (file input stream) */ - public void loadConfiguration(InputStream configSource) throws IOException { + /* load from disk */ + public void loadConfiguration() throws IOException { Properties config = new Properties(); - config.load(configSource); + config.load(new FileInputStream(Constants.CONFIG_DIRECTORY + File.separator + getConfigurationFileName())); setDefaultEmblem(config.getProperty(Constants.CFG_EMBLEM)); setDefaultMobileNumber(config.getProperty(Constants.CFG_MOBILE_NUMBER)); - setSignatureNote(config.getProperty(Constants.CFG_SIGNATURE_NOTE)); - setProxyHost(config.getProperty(Constants.CFG_PROXY_HOST)); setProxyUser(config.getProperty(Constants.CFG_PROXY_USER)); setProxyPass(config.getProperty(Constants.CFG_PROXY_PASS)); @@ -138,6 +136,11 @@ public class ConfigProviderImpl { } } + if (config.containsKey(Constants.CFG_SIGNATURE_NOTE)) + setSignatureNote(config.getProperty(Constants.CFG_SIGNATURE_NOTE)); + else + setSignatureNote(Profile.getProfile(getSignatureProfile()).getDefaultSignatureBlockNote(getSignatureLocale())); + String compat = config.getProperty(Constants.CFG_SIGNATURE_PDFA_COMPAT); if (compat != null) setSignaturePdfACompat(compat.equalsIgnoreCase(Constants.TRUE)); @@ -289,12 +292,14 @@ public class ConfigProviderImpl { String updateCheck = config.getProperty(Constants.CFG_UPDATE_CHECK); if (updateCheck != null) setUpdateCheck(!updateCheck.equalsIgnoreCase(Constants.FALSE)); + + log.info("Successfully loaded config from: " + getConfigurationFileName()); } /* save to file */ public void saveCurrentConfiguration() throws IOException { String filename = this.getConfigurationFileName(); - File configFile = new File(this.getConfigurationDirectory() + File.separator + filename); + File configFile = new File(Constants.CONFIG_DIRECTORY + File.separator + filename); Properties props = new Properties(); props.clear(); @@ -405,9 +410,6 @@ public class ConfigProviderImpl { log.info("Configuration file saved to " + configFile.getAbsolutePath()); } - - public String getConfigurationDirectory() { return Constants.CONFIG_DIRECTORY; } - // TODO review this public void setConfigurationFileName(String configurationFile) { this.configurationFile = configurationFile; } public String getConfigurationFileName() { return this.configurationFile; } |