Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/DummyMetaDataService.java @ 597:cf38b983d1f3
Added the Implementation of the MetaDataService which will deliver FIS and Parameters that match to Mapservices, Region and Layers that were sent to the Service.
gnv-artifacts/trunk@653 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 01 Feb 2010 14:52:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
596:75ef37387e84 | 597:cf38b983d1f3 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.artifacts.services; | |
5 | |
6 import java.util.ArrayList; | |
7 import java.util.Collection; | |
8 import java.util.Iterator; | |
9 | |
10 import org.apache.log4j.Logger; | |
11 | |
12 import com.vividsolutions.jts.geom.Geometry; | |
13 | |
14 import de.intevation.gnv.artifacts.services.requestobjects.DefaultFIS; | |
15 import de.intevation.gnv.artifacts.services.requestobjects.DefaultParameter; | |
16 import de.intevation.gnv.artifacts.services.requestobjects.FIS; | |
17 import de.intevation.gnv.artifacts.services.requestobjects.Layer; | |
18 import de.intevation.gnv.artifacts.services.requestobjects.MapService; | |
19 import de.intevation.gnv.artifacts.services.requestobjects.Parameter; | |
20 | |
21 /** | |
22 * Dummy of the MetaDataWebservice to simulate an answering Service | |
23 * until the Databasebackend will serve the required Data. | |
24 * bb | |
25 * @author Tim Englich <tim.englich@intevation.de> | |
26 * | |
27 */ | |
28 public class DummyMetaDataService extends MetaDataService{ | |
29 | |
30 /** | |
31 * the logger, used to log exceptions and additionally information | |
32 */ | |
33 private static Logger log = Logger.getLogger(DummyMetaDataService.class); | |
34 /** | |
35 * The UID of this Class. | |
36 */ | |
37 private static final long serialVersionUID = 4712607258043392650L; | |
38 | |
39 /** | |
40 * Constructor | |
41 */ | |
42 public DummyMetaDataService() { | |
43 super(); | |
44 } | |
45 | |
46 /** | |
47 * @see de.intevation.gnv.artifacts.services.MetaDataService#getFIS(java.util.Collection) | |
48 */ | |
49 @Override | |
50 protected Collection<FIS> getFIS(Collection<MapService> mapServices) | |
51 throws MetaDataServiceException { | |
52 log.debug("DummyMetaDataService.getFIS ==> MapServices"); | |
53 Collection<FIS> returnValue = null; | |
54 if (mapServices != null && !mapServices.isEmpty()){ | |
55 returnValue = new ArrayList<FIS>(mapServices.size()); | |
56 Iterator<MapService> mit = mapServices.iterator(); | |
57 while(mit.hasNext()){ | |
58 MapService mapService = mit.next(); | |
59 Collection<Layer> layer = mapService.getLayer(); | |
60 Collection<Parameter> parameter = | |
61 new ArrayList<Parameter>(layer.size()); | |
62 if (layer != null){ | |
63 Iterator<Layer> layerIt = layer.iterator(); | |
64 while (layerIt.hasNext()){ | |
65 Layer tmpLayer = layerIt.next(); | |
66 if (!tmpLayer.isGroupLayer()){ | |
67 parameter.add(new DefaultParameter(tmpLayer.getID(), | |
68 tmpLayer.getName())); | |
69 } | |
70 } | |
71 } | |
72 returnValue.add(new DefaultFIS(mapService.getID(),parameter)); | |
73 } | |
74 } | |
75 return returnValue; | |
76 } | |
77 | |
78 /** | |
79 * @see de.intevation.gnv.artifacts.services.MetaDataService#getFIS(com.vividsolutions.jts.geom.Geometry) | |
80 */ | |
81 @Override | |
82 protected Collection<FIS> getFIS(Geometry g) | |
83 throws MetaDataServiceException { | |
84 log.debug("DummyMetaDataService.getFIS ==> Geometry"); | |
85 Collection<FIS> returnValue = null; | |
86 if (g != null){ | |
87 returnValue = new ArrayList<FIS>(2); | |
88 returnValue.add(new DefaultFIS("fis_modeldata")); | |
89 returnValue.add(new DefaultFIS("fis_marnet")); | |
90 } | |
91 return returnValue; | |
92 } | |
93 } |