summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/config/ConfigProviderImpl.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java35
3 files changed, 11 insertions, 32 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
index 29728caa..78e7b21d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/cliarguments/ConfigFileArgument.java
@@ -51,7 +51,7 @@ public class ConfigFileArgument extends Argument {
String configFile = args[argOffset + 1];
- getConfiguration().setConfigurationFile(configFile);
+ getConfiguration().setConfigurationFileName(configFile);
return argOffset + 1;
}
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 386f4763..2dfe879b 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
@@ -293,7 +293,7 @@ public class ConfigProviderImpl {
/* save to file */
public void saveCurrentConfiguration() throws IOException {
- String filename = this.getConfigurationFile();
+ String filename = this.getConfigurationFileName();
File configFile = new File(this.getConfigurationDirectory() + File.separator + filename);
Properties props = new Properties();
@@ -409,8 +409,8 @@ public class ConfigProviderImpl {
public String getConfigurationDirectory() { return Constants.CONFIG_DIRECTORY; }
// TODO review this
- public void setConfigurationFile(String configurationFile) { this.configurationFile = configurationFile; }
- public String getConfigurationFile() { return this.configurationFile; }
+ public void setConfigurationFileName(String configurationFile) { this.configurationFile = configurationFile; }
+ public String getConfigurationFileName() { return this.configurationFile; }
public void setDefaultBKU(BKUs bku) {
this.configuration.defaultBKU = bku;
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 616fa63f..3f4f9086 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
@@ -105,33 +105,13 @@ public class PrepareConfigurationState extends State {
this.configFileHandler.addCLIArgument(ConfigFileArgument.class);
}
- private void initializeFromConfigurationFile(String filename)
+ private void initializeFromConfigurationFile()
throws InitializationException {
try {
+ String filename = getStateMachine().configProvider.getConfigurationFileName();
+ getStateMachine().configProvider.loadConfiguration(new FileInputStream(getStateMachine().configProvider.getConfigurationDirectory() + FILE_SEPARATOR + filename));
- // TODO: move this to ConfigProviderImpl to mirror save logic
- try {
- getStateMachine().configProvider.loadConfiguration(new FileInputStream(getStateMachine().configProvider.getConfigurationDirectory() + FILE_SEPARATOR + filename));
-
- log.info("Loaded config from file : " + filename);
- } catch (FileNotFoundException ex) {
- if (filename.equals(Constants.DEFAULT_CONFIG_FILENAME)) {
- // we only check for resource config file if it is the
- // default value!
- try {
- InputStream is = getClass().getResourceAsStream(
- Constants.RES_PKG_PATH + filename);
- getStateMachine().configProvider
- .loadConfiguration(is);
-
- log.info("Loaded config from resource : " + filename);
- } catch (Exception eex) {
- throw ex;
- }
- } else {
- throw ex;
- }
- }
+ log.info("Loaded config from file : " + filename);
} catch (IOException ex) {
throw new InitializationException(
@@ -292,8 +272,7 @@ public class PrepareConfigurationState extends State {
}
private void initializeConfig() throws InitializationException {
- initializeFromConfigurationFile(getStateMachine()
- .configProvider.getConfigurationFile());
+ initializeFromConfigurationFile();
resetSignatureNoteField(getStateMachine().configProvider);
@@ -416,7 +395,7 @@ public class PrepareConfigurationState extends State {
}
- // Read cli arguments for config file first
+ // Read cli arguments for config file location first
try {
initializeFromArguments(stateMachine.cmdLineArgs, this.configFileHandler);
} catch (InitializationException e) {
@@ -430,7 +409,7 @@ public class PrepareConfigurationState extends State {
}
// initialize from config file
- initializeFromConfigurationFile(config.getConfigurationFile());
+ initializeFromConfigurationFile();
updateConfiguration();
// Read cli arguments