aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderContext.java
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-26 12:02:47 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-11-26 12:02:47 +0000
commit06b900642342afb680aab3b36fba9247e1e29aa9 (patch)
treeb4d34d008b7d736c034caa81614a448c31af8fca /src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderContext.java
parent1b337e50a9edb280aea49879f901613e1fe17b55 (diff)
downloadpdf-as-3-06b900642342afb680aab3b36fba9247e1e29aa9.tar.gz
pdf-as-3-06b900642342afb680aab3b36fba9247e1e29aa9.tar.bz2
pdf-as-3-06b900642342afb680aab3b36fba9247e1e29aa9.zip
Placeholder-image handling
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@613 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderContext.java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderContext.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderContext.java b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderContext.java
new file mode 100644
index 0000000..e8c157c
--- /dev/null
+++ b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderContext.java
@@ -0,0 +1,49 @@
+package at.gv.egiz.pdfas.placeholder;
+
+/**
+ * Store and retrieve {@link SignaturePlaceholderData} in/from a thread local context.
+ *
+ * @author exthex
+ *
+ */
+public class SignaturePlaceholderContext {
+
+ private ThreadLocal sigHolder = new ThreadLocal();
+
+ private static SignaturePlaceholderContext instance = new SignaturePlaceholderContext();
+
+ /**
+ * Constructor. Private because this is a singleton.
+ */
+ private SignaturePlaceholderContext() {
+
+ }
+
+ /**
+ * Get the {@link SignaturePlaceholderData} which is currently bound to this thread.
+ * Might be null.
+ *
+ * @return
+ */
+ public static SignaturePlaceholderData getSignaturePlaceholderData(){
+ return (SignaturePlaceholderData)instance.sigHolder.get();
+ }
+
+ /**
+ *
+ * @return true if there is currently a {@link SignaturePlaceholderData} bound to this thread, false otherwise.
+ */
+ public static boolean isSignaturePlaceholderDataSet() {
+ return instance.sigHolder.get() != null;
+ }
+
+ /**
+ * Bind a {@link SignaturePlaceholderData} to this thread.
+ * If the given data is null, the context will be cleared.
+ *
+ * @param data if null, clears the ThreadLocal, else binds the data to the current thread.
+ */
+ public static void setSignaturePlaceholderData(SignaturePlaceholderData data) {
+ instance.sigHolder.set(data);
+ }
+}