changeset 352:9c8d91708d28

Added DataProvider interface (interface for inter-facet communication). artifacts/trunk@3330 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 30 Nov 2011 08:20:15 +0000
parents eb1136134d09
children 33d7a6da1a05
files ChangeLog artifacts/src/main/java/de/intevation/artifacts/DataProvider.java
diffstat 2 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 30 08:13:48 2011 +0000
+++ b/ChangeLog	Wed Nov 30 08:20:15 2011 +0000
@@ -1,3 +1,12 @@
+2011-11-30	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Added DataProvider interface that defines api for inter-facet
+	communication.
+
+	* artifacts/src/main/java/de/intevation/artifacts/DataProvider.java:
+	  New interface to prepare inter-facet pre-rendering communication
+	  phase ('blackboard').
+
 2011-11-30	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Prepare inter-facet pre-rendering communication ('blackboard') phase.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/de/intevation/artifacts/DataProvider.java	Wed Nov 30 08:20:15 2011 +0000
@@ -0,0 +1,23 @@
+package de.intevation.artifacts;
+
+import de.intevation.artifacts.CallContext;
+
+/**
+ * DataProviders register on a Blackboard with a key (basically shouting
+ * "I can or know X!").
+ *
+ * Consumers look at the blackboard and then consume data from these
+ * DataProvider, passing them (optional) parameterization and the blackboard
+ * itself.
+ *
+ * Through the blackboard-passing-when-consuming, also recursive patterns can
+ * be modelled (but take care, there is no in-built cycle detection).
+ */
+public interface DataProvider {
+    /** Register this DataProvider on a blackboard under a key. */
+    public void register(CallContext blackboard);
+
+    /** Provide data, given parameterization and a "blackboard". */
+    public Object provideData(Object key, Object param, CallContext context);
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org