view flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java @ 126:b18aebd1342f

Added an abstract base class DefaultState for States. flys-artifacts/trunk@1466 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 14 Mar 2011 15:43:12 +0000
parents 888e3b1dcdd9
children d6197a05a87c
line wrap: on
line source
package de.intevation.flys.artifacts.services;

import org.apache.log4j.Logger;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

import de.intevation.artifacts.CallMeta;

import de.intevation.artifacts.common.ArtifactNamespaceContext;
import de.intevation.artifacts.common.utils.XMLUtils;

import de.intevation.artifactdatabase.DefaultService;


/**
 * This service provides information about the supported rivers by this
 * application.
 *
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class RiverService extends DefaultService {

    /** The logger used in this service.*/
    private static Logger logger = Logger.getLogger(RiverService.class);


    /**
     * The default constructor.
     */
    public RiverService() {
    }


    public Document process(
        Document data,
        Object   globalContext,
        CallMeta callMeta)
    {
        logger.debug("RiverService.process");

        Document result = XMLUtils.newDocument();

        XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
            result,
            ArtifactNamespaceContext.NAMESPACE_URI,
            ArtifactNamespaceContext.NAMESPACE_PREFIX);

        // TODO fetch the rivers from database
        Element rivers = ec.create("rivers");

        Element saar = ec.create("river");
        ec.addAttr(saar, "name", "Saar", true);

        Element mosel = ec.create("river");
        ec.addAttr(mosel, "name", "Mosel", true);

        rivers.appendChild(saar);
        rivers.appendChild(mosel);
        result.appendChild(rivers);

        return result;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org