aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java52
1 files changed, 16 insertions, 36 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
index 31ca5e1..c7e5933 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java
@@ -152,11 +152,6 @@ public class SettingsReader implements Serializable
// private static final String TEMP_FILE_PATH =
// System.getProperty("java.io.tmpdir");
- /**
- * The current user path
- */
- private static final String USER_DIR = System.getProperty("user.dir");
-
// /**
// * The home path of the tomcat webaplication
// */
@@ -400,7 +395,14 @@ public class SettingsReader implements Serializable
logger_.info(" certstore path = \"" + CERT_PATH + "\"");
logger_.info(" temporary path = \"" + TMP_PATH + "\"");
logger_.info(StringUtils.repeat("*", length + 25));
- instance_ = new SettingsReader(settingsFile);
+
+ IAIK.addAsProvider();
+ ECCProvider.addAsProvider();
+ // Does not conform with PKIX, but is used by belgium citizen card
+// log.info("Registering RDN \"SERIALNUMBER\" as " + ObjectID.serialNumber + ".");
+ RFC2253NameParser.register("SERIALNUMBER", ObjectID.serialNumber);
+
+ instance_ = new SettingsReader(settingsFile);
}
return instance_;
}
@@ -681,17 +683,6 @@ public class SettingsReader implements Serializable
TempDirHelper.clearTemporaryDirectory();
}
- private static String assertFileSeparator(String path) {
- if (path == null) {
- throw new NullPointerException("Path must not be null.");
- }
- if (path.endsWith(File.separator) || path.endsWith("/") || path.endsWith("\\")) {
- return path;
- } else {
- return (path + File.separator);
- }
- }
-
public static synchronized void initialize(String configdir, String tmpdir) {
String defaultConfigDeployedTo = null;
@@ -710,7 +701,7 @@ public class SettingsReader implements Serializable
if (userHome == null || userHome.length() == 0) {
throw new RuntimeException("Unable to resolve user's home directory.");
}
- configdir = assertFileSeparator(userHome) + Constants.USERHOME_CONFIG_FOLDER;
+ configdir = ConfigUtils.assertFileSeparator(userHome) + Constants.USERHOME_CONFIG_FOLDER;
try {
defaultConfigDeployedTo = ConfigUtils.deployDefaultConfiguration(configdir, false);
} catch (ConfigUtilsException e) {
@@ -732,9 +723,9 @@ public class SettingsReader implements Serializable
}
File configdirFile = new File(StrSubstitutor.replaceSystemProperties(configdir));
try {
- configdir = assertFileSeparator(configdirFile.getCanonicalPath());
+ configdir = ConfigUtils.assertFileSeparator(configdirFile.getCanonicalPath());
} catch (IOException e) {
- configdir = assertFileSeparator(configdirFile.getPath());
+ configdir = ConfigUtils.assertFileSeparator(configdirFile.getPath());
}
if (!configdirFile.isDirectory())
{
@@ -752,26 +743,20 @@ public class SettingsReader implements Serializable
} else {
logger_.debug("Temporary directory explicitely set.");
}
- File tmpdirFile = new File(StrSubstitutor.replaceSystemProperties(assertFileSeparator(tmpdir) + Constants.TEMP_DIR_NAME));
+ File tmpdirFile = new File(StrSubstitutor.replaceSystemProperties(ConfigUtils.assertFileSeparator(tmpdir) + Constants.TEMP_DIR_NAME));
try {
- tmpdir = assertFileSeparator(tmpdirFile.getCanonicalPath());
+ tmpdir = ConfigUtils.assertFileSeparator(tmpdirFile.getCanonicalPath());
} catch (IOException e) {
- tmpdir = assertFileSeparator(tmpdirFile.getPath());
+ tmpdir = ConfigUtils.assertFileSeparator(tmpdirFile.getPath());
}
RESOURCES_PATH = configdir;
TMP_PATH = tmpdir;
CONFIG_PATH = RESOURCES_PATH + CFG + FILE_SEP;
CERT_PATH = RESOURCES_PATH + CERT + FILE_SEP;
+
+// ConfigUtils.printConfigInfo(logger_);
- int length = Utils.max(new int[] { RESOURCES_PATH.length(), TMP_PATH.length(), CONFIG_PATH.length(), CERT_PATH.length() });
-
- logger_.debug(StringUtils.repeat("*", length + 25));
- logger_.debug(" resources path = \"" + RESOURCES_PATH + "\"");
- logger_.debug(" configuration path = \"" + CONFIG_PATH + "\"");
- logger_.debug(" certstore path = \"" + CERT_PATH + "\"");
- logger_.debug(" temporary path = \"" + TMP_PATH + "\"");
- logger_.debug(StringUtils.repeat("*", length + 25));
if (defaultConfigDeployedTo != null) {
logger_.debug("** Default configuration successfully deployed to \"" + defaultConfigDeployedTo + "\" **");
}
@@ -805,11 +790,6 @@ public class SettingsReader implements Serializable
}
static {
- IAIK.addAsProvider();
- ECCProvider.addAsProvider();
- // Does not conform with PKIX, but is used by belgium citizen card
-// log.info("Registering RDN \"SERIALNUMBER\" as " + ObjectID.serialNumber + ".");
- RFC2253NameParser.register("SERIALNUMBER", ObjectID.serialNumber);
String versionString = "* PDF-AS library version " + PdfAS.PDFAS_VERSION + " *";
String paddingString = StringUtils.repeat("*", versionString.length());