summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java5
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java17
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java16
6 files changed, 30 insertions, 38 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
index 3879e79e..2ee314db 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
@@ -15,6 +15,7 @@
*/
package at.asit.pdfover.gui;
+import java.io.File;
import java.util.Locale;
import org.eclipse.swt.graphics.Color;
@@ -78,4 +79,18 @@ public class Constants {
/** File suffix for the signed document */
public final static String SIGNED_SUFFIX = "_signed"; //$NON-NLS-1$
+
+ /** Default Mobile BKU URL */
+ public static final String DEFAULT_MOBILE_BKU_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
+
+ /** Configuration directory */
+ public static String CONFIG_DIRECTORY = System.getProperty("user.home") + File.separator + ".pdfover"; //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ /** The default configuration file name */
+ public static final String DEFAULT_CONFIG_FILENAME = "PDFOver.config"; //$NON-NLS-1$
+
+ /** The default log4j file name */
+ public static final String DEFAULT_LOG4J_FILENAME = "log4j.properties"; //$NON-NLS-1$
+
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
index 26db8bce..d2c1b42c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
@@ -22,7 +22,6 @@ import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachineImpl;
/**
@@ -46,12 +45,12 @@ public class DeveloperMain {
// Set PDF-AS log4j configuration:
//System.setProperty("log4j.configuration", "log4j.properties");
- File configDir = new File(System.getProperty("user.home")+"/.pdfover"); //$NON-NLS-1$//$NON-NLS-2$
+ File configDir = new File(Constants.CONFIG_DIRECTORY);
if(!configDir.exists()) {
configDir.mkdir();
}
- File log4j = new File(configDir.getAbsolutePath() + "/" + ConfigManipulator.DEFAULT_LOG4J_FILE); //$NON-NLS-1$
+ File log4j = new File(configDir.getAbsolutePath() + File.separator + Constants.DEFAULT_LOG4J_FILENAME);
if(log4j.exists()) {
PropertyConfigurator.configure(log4j.getAbsolutePath());
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
index 1b7a3116..4ff52ae7 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Main.java
@@ -27,7 +27,6 @@ import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.utils.Messages;
import at.asit.pdfover.gui.utils.SWTLoader;
-import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachineImpl;
/**
@@ -55,12 +54,12 @@ public class Main {
JOptionPane.ERROR_MESSAGE);
}
- File configDir = new File(System.getProperty("user.home")+"/.pdfover"); //$NON-NLS-1$//$NON-NLS-2$
+ File configDir = new File(Constants.CONFIG_DIRECTORY);
if(!configDir.exists()) {
configDir.mkdir();
}
- File log4j = new File(configDir.getAbsolutePath() + "/" + ConfigManipulator.DEFAULT_LOG4J_FILE); //$NON-NLS-1$
+ File log4j = new File(configDir.getAbsolutePath() + File.separator + Constants.DEFAULT_LOG4J_FILENAME);
if(log4j.exists()) {
PropertyConfigurator.configure(log4j.getAbsolutePath());
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java
index c3a88fe5..bf7cbab3 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java
@@ -27,16 +27,6 @@ import at.asit.pdfover.signator.SignaturePosition;
public interface ConfigManipulator {
/**
- * The default config file location
- */
- public static final String DEFAULT_CONFIG_FILE = "PDFOver.config"; //$NON-NLS-1$
-
- /**
- * The default log4j file
- */
- public static final String DEFAULT_LOG4J_FILE = "log4j.properties"; //$NON-NLS-1$
-
- /**
* The bku config parameter
*/
public static final String BKU_CONFIG = "BKU"; //$NON-NLS-1$
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
index 6fa7c603..55df1b57 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java
@@ -28,6 +28,7 @@ import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Constants;
import at.asit.pdfover.gui.utils.LocaleSerializer;
import at.asit.pdfover.gui.utils.Messages;
import at.asit.pdfover.signator.BKUs;
@@ -45,16 +46,6 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
private BKUs defaultBKU = BKUs.NONE;
- /**
- * PDFOver config directory
- */
- public static String CONFIG_DIRECTORY = System.getProperty("user.home") + "/.pdfover"; //$NON-NLS-1$ //$NON-NLS-2$
-
- /**
- * Gets the Default Mobile URL
- */
- public static final String DEFAULT_MOBILE_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$
-
private SignaturePosition defaultSignaturePosition = null;
/**
@@ -73,11 +64,11 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
private String proxyHost = STRING_EMPTY;
- private String configurationFile = ConfigManipulator.DEFAULT_CONFIG_FILE;
+ private String configurationFile = Constants.DEFAULT_CONFIG_FILENAME;
private int proxyPort = -1;
- private String mobileBKU = DEFAULT_MOBILE_URL;
+ private String mobileBKU = Constants.DEFAULT_MOBILE_BKU_URL;
private String outputFolder = STRING_EMPTY;
@@ -315,7 +306,7 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator {
*/
@Override
public String getConfigurationDirectory() {
- return CONFIG_DIRECTORY;
+ return Constants.CONFIG_DIRECTORY;
}
/*
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 6c8181d4..152a7c38 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
@@ -26,6 +26,7 @@ import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.asit.pdfover.gui.Constants;
import at.asit.pdfover.gui.cliarguments.ArgumentHandler;
import at.asit.pdfover.gui.cliarguments.BKUArgument;
import at.asit.pdfover.gui.cliarguments.ConfigFileArgument;
@@ -42,7 +43,6 @@ import at.asit.pdfover.gui.controls.Dialog.BUTTONS;
import at.asit.pdfover.gui.exceptions.InitializationException;
import at.asit.pdfover.gui.utils.Messages;
import at.asit.pdfover.gui.utils.Unzipper;
-import at.asit.pdfover.gui.workflow.ConfigManipulator;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.signator.Signator;
@@ -98,7 +98,7 @@ public class PrepareConfigurationState extends State {
log.info("Loaded config from file : " + filename); //$NON-NLS-1$
} catch (FileNotFoundException ex) {
- if (filename.equals(ConfigManipulator.DEFAULT_CONFIG_FILE)) {
+ if (filename.equals(Constants.DEFAULT_CONFIG_FILENAME)) {
// we only check for resource config file if it is the
// default value!
try {
@@ -138,7 +138,7 @@ public class PrepareConfigurationState extends State {
File configDir = new File(this.stateMachine.getConfigProvider().getConfigurationDirectory());
File configFile = new File(this.stateMachine.getConfigProvider().getConfigurationDirectory() + "/" //$NON-NLS-1$
- + ConfigManipulator.DEFAULT_CONFIG_FILE);
+ + Constants.DEFAULT_CONFIG_FILENAME);
if (!configDir.exists() || !configFile.exists()) {
boolean allOK = false;
@@ -158,10 +158,9 @@ public class PrepareConfigurationState extends State {
FileOutputStream pdfOverConfig = null;
try {
inputStream = this.getClass().getResourceAsStream(
- "/" + ConfigManipulator.DEFAULT_CONFIG_FILE); //$NON-NLS-1$
+ "/" + Constants.DEFAULT_CONFIG_FILENAME); //$NON-NLS-1$
pdfOverConfig = new FileOutputStream(this.stateMachine.getConfigProvider().getConfigurationDirectory()
- + "/" //$NON-NLS-1$
- + ConfigManipulator.DEFAULT_CONFIG_FILE);
+ + "/" + Constants.DEFAULT_CONFIG_FILENAME); //$NON-NLS-1$
while ((byteCount = inputStream.read(buffer)) >= 0) {
pdfOverConfig.write(buffer, 0, byteCount);
@@ -196,10 +195,9 @@ public class PrepareConfigurationState extends State {
pdfOverConfig = null;
try {
inputStream = this.getClass().getResourceAsStream(
- "/" + ConfigManipulator.DEFAULT_LOG4J_FILE); //$NON-NLS-1$
+ "/" + Constants.DEFAULT_LOG4J_FILENAME); //$NON-NLS-1$
pdfOverConfig = new FileOutputStream(this.stateMachine.getConfigProvider().getConfigurationDirectory()
- + "/" //$NON-NLS-1$
- + ConfigManipulator.DEFAULT_LOG4J_FILE);
+ + "/" + Constants.DEFAULT_LOG4J_FILENAME); //$NON-NLS-1$
while ((byteCount = inputStream.read(buffer)) >= 0) {
pdfOverConfig.write(buffer, 0, byteCount);