aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:18:23 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-29 14:18:23 +0000
commitb88f9c59491c19f6a47aa4cfac48d43b1da5d8c6 (patch)
tree2e965b26163f3629027439a323396d8c5b06e7fb /src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java
parent2643dec4ecd56620d35d96518b76932dfe0419bb (diff)
downloadpdf-as-3-b88f9c59491c19f6a47aa4cfac48d43b1da5d8c6.tar.gz
pdf-as-3-b88f9c59491c19f6a47aa4cfac48d43b1da5d8c6.tar.bz2
pdf-as-3-b88f9c59491c19f6a47aa4cfac48d43b1da5d8c6.zip
added DynamicSignatureProfile support
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@618 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java b/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java
new file mode 100644
index 0000000..fbcfaf9
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java
@@ -0,0 +1,68 @@
+package at.gv.egiz.pdfas.api.commons;
+
+import at.gv.egiz.pdfas.api.PdfAs;
+import at.gv.egiz.pdfas.api.sign.SignParameters;
+
+/**
+ * A dynamic signature profile. It is used to define a signature profile like the ones from pdf-as/config.properties at runtime.
+ * After creation via {@link PdfAs} you can set properties via {@link #setPropertyRaw(String, String)}
+ * or {@link #setFieldValue(String, String)}.<br>
+ * You have to call {@link #apply()} to use the profile. The identifying name (e.g. for {@link SignParameters#setSignatureProfileId(String)}
+ * can be obtained via {@link #getName()}.<br>
+ * Depending on the {@link DynamicSignatureLifetimeEnum} the profile can be alive and usable till you {@link #dispose()} it manually.
+ *
+ * @author exthex
+ *
+ */
+public interface DynamicSignatureProfile {
+
+ /**
+ * Get the name of the dynamic signature profile. Equals the <b>SignatureProfileId</b>
+ * @return
+ */
+ public abstract String getName();
+
+ /**
+ * Set a field value for the profile. Use {@link #setPropertyRaw(String, String)} for setting any property.<br>
+ * For example to set <code>sig_obj.MEIN_DYN_SIGNATURBLOCK.value.SIG_META</code> just use <code>SIG_META</code> as fieldName.
+ * @param fieldName the name of the field
+ * @param value the value to set
+ */
+ public abstract void setFieldValue(String fieldName, String value);
+
+ /**
+ * Get a field value from the profile. See {@link #setFieldValue(String, String)}
+ * @param fieldName
+ * @return
+ */
+ public abstract String getFieldValue(String fieldName);
+
+ /**
+ * Set any property for the signature profile.
+ * Uses the same keys as the property file without the "prefix" for the profile.
+ * For example to set <code>sig_obj.MEIN_DYN_SIGNATURBLOCK.key.SIG_META</code> use <code>key.SIG_META</code>
+ * @param key property key
+ * @param val property value
+ */
+ public void setPropertyRaw(String key, String val);
+
+ /**
+ * Get any property from the signature profile. See {@link #setPropertyRaw(String, String)} for details.
+ * @param key
+ * @return
+ */
+ public String getPropertyRaw(String key);
+
+ /**
+ * Apply the signature profile. Call this after all properties are set and you want to use the profile. It is then added
+ * to the globally available signature profiles. Depending on the lifetime model {@link DynamicSignatureLifetimeEnum} you
+ * have to {@link #dispose()} it manually when not needed anymore.
+ */
+ public abstract void apply();
+
+ /**
+ * Disposes the signature profile from the global store. Call this for {@link DynamicSignatureLifetimeEnum#MANUAL} only.
+ */
+ public abstract void dispose();
+
+} \ No newline at end of file