package org.madore.damlengine; import java.util.Map; import java.util.HashMap; import org.w3c.dom.Element; public abstract class TodoElement extends TodoItem { public static abstract class Factory { public abstract TodoElement newItem(Element node, Map context, Map options); } protected static Map damlFactories; protected static Factory damlDefaultFactory; static { damlFactories = new HashMap(); damlDefaultFactory = new TodoDefaultElement.Factory(); } Element node; Map context; Map options; public TodoElement(Element node, Map context, Map options) { this.node = node; this.context = context; this.options = options; } public static TodoElement getTodoElement(Element node, Map context, Map options) { Factory factory = null; String nsuri = node.getNamespaceURI(); if ( nsuri != null && nsuri.equals(DamlEngine.DAML_NS) ) factory = damlFactories.get(node.getLocalName()); if ( factory == null ) factory = damlDefaultFactory; return factory.newItem(node, context, options); } }