# HG changeset patch # User Ingo Weinzierl # Date 1299604957 0 # Node ID 888e3b1dcdd9c4b92ad18695e3b465d5d7cd4831 # Parent 1a025ff0f7fda6fff4f28ce9d9a03c5492c33114 Added a RiverService (/service/rivers) that retrieves a list of provided rivers. flys-artifacts/trunk@1429 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 1a025ff0f7fd -r 888e3b1dcdd9 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Mar 07 14:43:14 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Mar 08 17:22:37 2011 +0000 @@ -1,3 +1,10 @@ +2011-03-08 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/services/RiverService.java: + New. This service will retrieve a list of provided rivers. + + * doc/conf/conf.xml: Added a configuration for the RiverService. + 2011-03-07 Ingo Weinzierl * doc/conf/conf.xml: Added a section user-factory and collection-factory in diff -r 1a025ff0f7fd -r 888e3b1dcdd9 flys-artifacts/doc/conf/conf.xml --- a/flys-artifacts/doc/conf/conf.xml Mon Mar 07 14:43:14 2011 +0000 +++ b/flys-artifacts/doc/conf/conf.xml Tue Mar 08 17:22:37 2011 +0000 @@ -18,6 +18,14 @@ de.intevation.artifactdatabase.DefaultUserFactory + + + de.intevation.artifactdatabase.DefaultServiceFactory + + diff -r 1a025ff0f7fd -r 888e3b1dcdd9 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/RiverService.java Tue Mar 08 17:22:37 2011 +0000 @@ -0,0 +1,65 @@ +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 Ingo Weinzierl + */ +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 :