summaryrefslogtreecommitdiffstats
path: root/org/madore/damlengine/TodoItem.java
diff options
context:
space:
mode:
authorDavid A. Madore <david@procyon.(none)>2010-04-13 15:21:41 +0200
committerDavid A. Madore <david@procyon.(none)>2010-04-13 15:21:41 +0200
commite3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f (patch)
tree9a7f411ce9333aa6c67cd66522f4aaf60c35d194 /org/madore/damlengine/TodoItem.java
parent734a0b78ea5508f243caf18a50e36ac8918e11db (diff)
downloaddamlengine-e3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f.tar.gz
damlengine-e3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f.tar.bz2
damlengine-e3b7a9c657a6a5f5a7a8f3c7ee4fdff1aee6410f.zip
Framework for handling attributes.
Diffstat (limited to 'org/madore/damlengine/TodoItem.java')
-rw-r--r--org/madore/damlengine/TodoItem.java51
1 files changed, 2 insertions, 49 deletions
diff --git a/org/madore/damlengine/TodoItem.java b/org/madore/damlengine/TodoItem.java
index 941460e..677b3b1 100644
--- a/org/madore/damlengine/TodoItem.java
+++ b/org/madore/damlengine/TodoItem.java
@@ -1,54 +1,7 @@
package org.madore.damlengine;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-import java.util.HashMap;
-import org.w3c.dom.Node;
+public abstract class TodoItem {
-public class TodoItem {
-
- protected static Map<String,Method> damlHandlers;
- protected static Method defaultHandler;
-
- {
- Class[] handlerArgTypes = new Class[]{ TodoItem.class };
- damlHandlers = new HashMap<String,Method>();
- try {
- defaultHandler = DefaultHandler.class.getMethod("handle", handlerArgTypes);
- } catch (NoSuchMethodException e) {
- // FIXME: this isn't good...
- throw new Error("this is impossible");
- }
- }
-
- Node node;
- Map<String,Object> context;
- Map<String,Object> options;
-
- public TodoItem(Node node, Map<String,Object> context, Map<String,Object> options) {
- this.node = node;
- this.context = context;
- this.options = options;
- }
-
- public void dispatch() {
- Method handler;
- if ( node.getNamespaceURI().equals(DamlEngine.DAML_NS) ) {
- handler = damlHandlers.get(node.getLocalName());
- if ( handler == null )
- handler = defaultHandler;
- } else
- handler = defaultHandler;
- try {
- handler.invoke(null, new Object[]{this});
- } catch (IllegalAccessException e) {
- // FIXME: this isn't good...
- throw new Error("this is impossible");
- } catch (InvocationTargetException e) {
- // FIXME: this isn't good...
- throw new Error("this is impossible");
- }
- }
+ public abstract void dispatch();
}