ingo@118: package de.intevation.flys.artifacts.services; ingo@118: ingo@133: import java.util.List; ingo@133: ingo@118: import org.apache.log4j.Logger; ingo@118: ingo@118: import org.w3c.dom.Document; ingo@118: import org.w3c.dom.Element; ingo@118: ingo@118: import de.intevation.artifacts.CallMeta; sascha@966: import de.intevation.artifacts.GlobalContext; ingo@118: ingo@118: import de.intevation.artifacts.common.ArtifactNamespaceContext; ingo@118: import de.intevation.artifacts.common.utils.XMLUtils; ingo@118: ingo@133: import de.intevation.flys.model.River; ingo@133: ingo@133: import de.intevation.flys.artifacts.model.RiverFactory; ingo@133: ingo@118: ingo@118: /** ingo@118: * This service provides information about the supported rivers by this ingo@118: * application. ingo@118: * ingo@118: * @author Ingo Weinzierl ingo@118: */ ingo@1631: public class RiverService extends FLYSService { ingo@118: ingo@118: /** The logger used in this service.*/ ingo@118: private static Logger logger = Logger.getLogger(RiverService.class); ingo@118: ingo@118: ingo@1631: protected Document doProcess( sascha@966: Document data, sascha@966: GlobalContext globalContext, sascha@966: CallMeta callMeta sascha@966: ) { ingo@118: logger.debug("RiverService.process"); ingo@118: ingo@118: Document result = XMLUtils.newDocument(); ingo@118: ingo@118: XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( ingo@118: result, ingo@118: ArtifactNamespaceContext.NAMESPACE_URI, ingo@118: ArtifactNamespaceContext.NAMESPACE_PREFIX); ingo@118: ingo@1631: List allRivers = RiverFactory.getRivers(); ingo@118: ingo@1631: Element rivers = ec.create("rivers"); sascha@314: ingo@1631: for (River river: allRivers) { ingo@1631: Element r = ec.create("river"); ingo@1631: ec.addAttr(r, "name", river.getName(), true); sascha@314: ingo@1631: rivers.appendChild(r); ingo@133: } ingo@1631: ingo@1631: result.appendChild(rivers); ingo@118: ingo@118: return result; ingo@118: } ingo@118: } ingo@118: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :