Mercurial > dive4elements > river
annotate 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 |
rev | line source |
---|---|
118
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.services; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import org.apache.log4j.Logger; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.w3c.dom.Document; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import org.w3c.dom.Element; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.CallMeta; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.common.utils.XMLUtils; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifactdatabase.DefaultService; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 /** |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 * This service provides information about the supported rivers by this |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 * application. |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 * |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 */ |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public class RiverService extends DefaultService { |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 /** The logger used in this service.*/ |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 private static Logger logger = Logger.getLogger(RiverService.class); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 /** |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 * The default constructor. |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 */ |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 public RiverService() { |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 } |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 public Document process( |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 Document data, |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 Object globalContext, |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 CallMeta callMeta) |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 { |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 logger.debug("RiverService.process"); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 Document result = XMLUtils.newDocument(); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 result, |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 ArtifactNamespaceContext.NAMESPACE_URI, |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 // TODO fetch the rivers from database |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 Element rivers = ec.create("rivers"); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 Element saar = ec.create("river"); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 ec.addAttr(saar, "name", "Saar", true); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 Element mosel = ec.create("river"); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 ec.addAttr(mosel, "name", "Mosel", true); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 rivers.appendChild(saar); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 rivers.appendChild(mosel); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 result.appendChild(rivers); |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 return result; |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 } |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
888e3b1dcdd9
Added a RiverService (/service/rivers) that retrieves a list of provided rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |