aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:26:19 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:26:19 +0000
commitfe1f6bed978d1fad7911d7c4569508bc240b6df0 (patch)
treefc38b6b71b64e719d51ade248ca9a77399e52bf8 /src/main/java/at/knowcenter
parentcd93f2465a1d4dee4e6a10771bbf5bd5bf73d7ae (diff)
downloadpdf-as-3-fe1f6bed978d1fad7911d7c4569508bc240b6df0.tar.gz
pdf-as-3-fe1f6bed978d1fad7911d7c4569508bc240b6df0.tar.bz2
pdf-as-3-fe1f6bed978d1fad7911d7c4569508bc240b6df0.zip
added DynamicSignatureProfile support
added override properties git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@634 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/cfg/OverridePropertyHolder.java41
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/cfg/PropertyTree.java4
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java24
3 files changed, 59 insertions, 10 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/OverridePropertyHolder.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/OverridePropertyHolder.java
new file mode 100644
index 0000000..33a0e4a
--- /dev/null
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/OverridePropertyHolder.java
@@ -0,0 +1,41 @@
+package at.knowcenter.wag.egov.egiz.cfg;
+
+import java.util.Properties;
+
+import at.gv.egiz.pdfas.api.sign.SignParameters;
+
+/**
+ * Thread local holder for profile override values.
+ * Don't use this class directly, use {@link SignParameters#setProfileOverrideValue(String, String)}
+ *
+ * @author exthex
+ *
+ */
+public class OverridePropertyHolder {
+
+ private static ThreadLocal propHolder = new ThreadLocal() {
+ protected Object initialValue() { return new Properties();};
+ };
+
+ public static Properties getOverrideProps() {
+ return (Properties) propHolder.get();
+ }
+
+ public static void setOverrideProps(Properties props) {
+ propHolder.set(props);
+ }
+
+ public static void setProperty(String key, String val) {
+ getOverrideProps().setProperty(key, val);
+ }
+
+ public static String getProperty(String key) {
+ return getOverrideProps().getProperty(key);
+ }
+
+ public static void removeProperties() {
+ propHolder.remove();
+ propHolder.set(new Properties());
+ }
+
+}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/PropertyTree.java b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/PropertyTree.java
index fd700fe..1922627 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/cfg/PropertyTree.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/cfg/PropertyTree.java
@@ -345,4 +345,8 @@ public class PropertyTree implements Serializable {
}
return os;
}
+
+ public void removeEntry(String key) {
+ this.keys_.remove(key);
+ }
} \ No newline at end of file
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 f4c28c7..6151b24 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
@@ -465,7 +465,10 @@ public class SettingsReader implements Serializable
*/
public String getSetting(String key) throws SettingNotFoundException
{
- String result = properties_.getProperty(key);
+ String result = OverridePropertyHolder.getProperty(key);
+ if (result == null) {
+ result = properties_.getProperty(key);
+ }
if (result == null)
{
String log_message = "Configuration key not found: '" + key + "'! Check '" + settingsFile_ + "' file.";
@@ -476,10 +479,7 @@ public class SettingsReader implements Serializable
SettingNotFoundException snf = new SettingNotFoundException(log_message);
throw snf;
}
-// if (logger_.isDebugEnabled())
-// {
-// logger_.debug("Get Property:" + key + "=" + result);
-// }
+
return result;
}
@@ -659,11 +659,11 @@ public class SettingsReader implements Serializable
*/
public String getValueFromKey(String key)
{
- String value = pTree_.getFirstValue(key);
-// if (logger_.isDebugEnabled())
-// {
-// logger_.debug("getValueFromKey:" + key + "=" + value);
-// }
+ String value = OverridePropertyHolder.getProperty(key);
+ if (value == null) {
+ value = pTree_.getFirstValue(key);
+ }
+
return value;
}
@@ -889,5 +889,9 @@ public class SettingsReader implements Serializable
String paddingString = StringUtils.repeat("*", versionString.length());
logger_.info("PDF-AS info\n" + paddingString + "\n" + versionString + "\n" + paddingString);
}
+
+ public Properties getProperties() {
+ return this.properties_;
+ }
} \ No newline at end of file