ingo@105: /*
ingo@105: * Copyright (c) 2011 by Intevation GmbH
ingo@105: *
ingo@105: * This program is free software under the LGPL (>=v2.1)
ingo@105: * Read the file LGPL.txt coming with the software for details
ingo@105: * or visit http://www.gnu.org/licenses/ if it does not exist.
ingo@105: */
ingo@105: package de.intevation.artifactdatabase.state;
ingo@105:
ingo@209: import java.util.ArrayList;
ingo@105: import java.util.HashMap;
ingo@209: import java.util.List;
ingo@105: import java.util.Map;
ingo@105:
ingo@106: import javax.xml.xpath.XPathConstants;
ingo@106:
ingo@226: import org.apache.log4j.Logger;
ingo@226:
ingo@105: import org.w3c.dom.Document;
ingo@205: import org.w3c.dom.Element;
ingo@105: import org.w3c.dom.Node;
ingo@209: import org.w3c.dom.NodeList;
ingo@105:
ingo@209: import de.intevation.artifacts.ArtifactNamespaceContext;
ingo@105: import de.intevation.artifacts.CallContext;
ingo@105:
ingo@106: import de.intevation.artifacts.common.utils.XMLUtils;
ingo@106:
ingo@105: import de.intevation.artifactdatabase.data.StateData;
ingo@105:
ingo@105:
ingo@105: /**
ingo@105: * An abstract implementation of a {@link State}. It implements some basic
ingo@105: * methods that return the id, description and data. The methods
ingo@105: * describe()
and setup()
depend on the concrete class
ingo@105: * and need to be implemented by those.
ingo@105: */
ingo@105: public abstract class AbstractState implements State {
ingo@105:
ingo@106: /** The XPath to the ID of the state relative to the state node in the
ingo@106: * configuration. */
ingo@106: public static final String XPATH_ID = "@id";
ingo@106:
ingo@106: /** The XPath to the description of the state relative to the state node in
ingo@106: * the configuration. */
ingo@106: public static final String XPATH_DESCRIPTION = "@description";
ingo@106:
ingo@209: /** The XPath to the output nodes of the state configuration.*/
ingo@209: public static final String XPATH_OUTPUT_MODES = "outputmodes/outputmode";
ingo@209:
ingo@226: /** The XPath to the list of facets relative to the output mode it belongs
ingo@226: * to.*/
ingo@226: public static final String XPATH_FACETS = "facets/facet";
ingo@226:
ingo@226:
ingo@226: /** The logger that is used in this class.*/
ingo@226: private static Logger logger = Logger.getLogger(AbstractState.class);
ingo@226:
ingo@106:
ingo@105: /** The ID of the state. */
ingo@105: protected String id;
ingo@105:
ingo@105: /** The description of the state. */
ingo@105: protected String description;
ingo@105:
ingo@105: /** The data provided by this state. */
ingo@105: protected Map data;
ingo@105:
ingo@209: /** A list of output modes which are available for this state.*/
ingo@209: protected List