annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java @ 4353:daf0919df76d

Ignore comments in meta data xml template Comments should not be send to the client. Therefore ignore them when building the nodes.
author Björn Ricks <bjoern.ricks@intevation.de>
date Thu, 01 Nov 2012 15:16:01 +0100
parents 9fac337192c9
children a2735a4bf75e
rev   line source
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
3019
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
3 import java.io.File;
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
4
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.ArrayList;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import java.util.List;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
8 import java.util.regex.Pattern;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
9 import java.util.regex.Matcher;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
10
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.w3c.dom.Document;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import org.apache.log4j.Logger;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
15 import org.hibernate.impl.SessionFactoryImpl;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
16
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import com.vividsolutions.jts.geom.Envelope;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.artifacts.Artifact;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import de.intevation.artifacts.ArtifactFactory;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.artifacts.CallMeta;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
3019
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
23 import de.intevation.artifacts.common.utils.FileTools;
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
24
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 import de.intevation.artifactdatabase.data.DefaultStateData;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 import de.intevation.artifactdatabase.state.Facet;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 import de.intevation.artifactdatabase.state.State;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
30 import de.intevation.flys.backend.SessionFactoryProvider;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
31
2683
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
32 import de.intevation.flys.artifacts.resources.Resources;
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import de.intevation.flys.artifacts.states.DefaultState;
3302
453d2d0c4258 Organized and added missing imports.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3087
diff changeset
34 import de.intevation.flys.artifacts.model.map.WMSDBLayerFacet;
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
35 import de.intevation.flys.utils.FLYSUtils;
3019
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
36 import de.intevation.flys.utils.MapfileGenerator;
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public abstract class WMSDBArtifact extends StaticFLYSArtifact {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 private static final Logger logger = Logger.getLogger(WMSDBArtifact.class);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
43 public static final Pattern DB_URL_PATTERN =
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
44 Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z]+)");
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
45
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
46 public static final Pattern DB_PSQL_URL_PATTERN =
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
47 Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z0-9]+)");
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
48
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 @Override
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 public void setup(
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 String identifier,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 ArtifactFactory factory,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 Object context,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 CallMeta callMeta,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 Document data)
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 logger.debug("WMSDBArtifact.setup");
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 super.setup(identifier, factory, context, callMeta, data);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
2741
0251393f037c Refactor usage of now static xpath, other artifacts will follow in later commits.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2740
diff changeset
62 String ids = getDatacageIDValue(data);
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 if (ids != null && ids.length() > 0) {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 addData("ids", new DefaultStateData("ids", null, null, ids));
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 else {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 throw new IllegalArgumentException("No attribute 'ids' found!");
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 List<Facet> fs = new ArrayList<Facet>();
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 WMSDBState state = (WMSDBState) getCurrentState(context);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 state.computeInit(this, hash(), context, callMeta, fs);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 if (!fs.isEmpty()) {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 facets.put(getCurrentStateId(), fs);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 @Override
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 protected void initialize(
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 Artifact artifact,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 Object context,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 CallMeta callMeta)
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 // do nothing
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91
3019
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
92 @Override
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
93 protected State getState(Object context, String stateID) {
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
94 return getCurrentState(context);
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
95 }
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
96
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
97
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 /**
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 * Get a list containing the one and only State.
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 * @param context ignored.
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 * @return list with one and only state.
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 */
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 @Override
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 protected List<State> getStates(Object context) {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 ArrayList<State> states = new ArrayList<State>();
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 states.add(getCurrentState(context));
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 return states;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 public static abstract class WMSDBState extends DefaultState {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 private static final Logger logger = Logger.getLogger(WMSDBState.class);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
116 protected FLYSArtifact artifact;
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117
2672
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
118 protected String name;
2683
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
119 protected int riverId;
2672
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
120
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
121
2082
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1917
diff changeset
122 public WMSDBState() {}
007a8f5ed9f1 Implemented new module "new map".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1917
diff changeset
123
2089
0da8874bd378 Added initial state to map artifact to be able to advance and step back.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2082
diff changeset
124 public WMSDBState(FLYSArtifact artifact) {
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 this.artifact = artifact;
2672
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
126 this.name = null;
2683
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
127 this.riverId = 0;
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 @Override
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 public Object computeInit(
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 FLYSArtifact artifact,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 String hash,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 Object context,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 CallMeta meta,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 List<Facet> facets
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 ) {
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 logger.debug("WMSDBState.computeInit");
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 String type = getFacetType();
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 WMSDBLayerFacet facet = new WMSDBLayerFacet(
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 0,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 type,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 getTitle(meta),
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 ComputeType.INIT,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 getID(), hash,
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 getUrl());
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149
1917
71139016cd0f Avoid WMS layer names that begin with digits to ensure valid WMS GetFeatureInfo responses.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1876
diff changeset
150 String name = type + "-" + artifact.identifier();
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 facet.addLayer(name);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 facet.setExtent(getExtent());
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
154 facet.setOriginalExtent(getExtent(true));
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 facet.setSrid(getSrid());
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 facet.setData(getDataString());
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 facet.setFilter(getFilter());
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1805
diff changeset
158 facet.setGeometryType(getGeometryType());
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
159 facet.setConnection(getConnection());
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
160 facet.setConnectionType(getConnectionType());
1876
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1854
diff changeset
161 facet.setLabelItem(getLabelItem());
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 facets.add(facet);
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 return null;
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
168 /**
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
169 * This method returns a connection string for databases used by
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
170 * Mapserver's Mapfile.
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
171 *
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
172 * @return A connection string for Mapserver.
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
173 */
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
174 protected String getConnection() {
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
175 SessionFactoryImpl sf = (SessionFactoryImpl)
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
176 SessionFactoryProvider.getSessionFactory();
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
177
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
178 String user = SessionFactoryProvider.getUser(sf);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
179 String pass = SessionFactoryProvider.getPass(sf);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
180 String url = SessionFactoryProvider.getURL(sf);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
181
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
182 logger.debug("Parse connection url: " + url);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
183
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
184 Matcher m = DB_URL_PATTERN.matcher(url);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
185 if (!m.matches()) {
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
186 logger.warn("Could not parse Connection string." +
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
187 "Try to parse PostgreSQL string.");
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
188 // maybe this is a PostgreSQL connection...
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
189 return getPostgreSQLConnection();
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
190 }
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
191
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
192 logger.debug("Groups for connection string: " + m.groupCount());
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
193 int groups = m.groupCount();
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
194
3087
4a76da133144 Removed repeated x.size() calls from for loops.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3019
diff changeset
195 for (int i = 0; i <= groups; i++) {
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
196 logger.debug("Group " + i + ": " + m.group(i));
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
197 }
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
198
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
199 String connection = null;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
200
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
201 if (FLYSUtils.isUsingOracle()) {
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
202 if (groups < 3) {
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
203 logger.warn("Could only partially parse connection string.");
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
204 return null;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
205 }
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
206
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
207 String host = m.group(2);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
208 String port = m.group(3);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
209
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
210 connection = user + "/" + pass + "@" + host;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
211 }
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
212 else {
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
213 if (groups < 4) {
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
214 logger.warn("Could only partially parse connection string.");
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
215 return null;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
216 }
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
217
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
218 String host = m.group(2);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
219 String port = m.group(3);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
220 String db = m.group(4);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
221
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
222 StringBuilder sb = new StringBuilder();
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
223 sb.append("dbname=" + db);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
224 sb.append("host='" + host + "'");
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
225 sb.append("port=" + port);
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
226 sb.append("password='" + pass + "'");
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
227 sb.append("sslmode=disable");
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
228
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
229 connection = sb.toString();
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
230 }
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
231
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
232 logger.debug("Created connection: '" + connection + "'");
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
233
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
234 return connection;
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
235 }
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
236
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
237 protected String getPostgreSQLConnection() {
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
238 SessionFactoryImpl sf = (SessionFactoryImpl)
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
239 SessionFactoryProvider.getSessionFactory();
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
240
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
241 String user = SessionFactoryProvider.getUser(sf);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
242 String pass = SessionFactoryProvider.getPass(sf);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
243 String url = SessionFactoryProvider.getURL(sf);
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
244
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
245 Matcher m = DB_PSQL_URL_PATTERN.matcher(url);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
246 if (!m.matches()) {
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
247 logger.warn("Could not parse PostgreSQL Connection string.");
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
248 return null;
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
249 }
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
250
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
251 int groups = m.groupCount();
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
252 logger.debug("Groups for PostgreSQL connection string: " + groups);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
253
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
254 if (logger.isDebugEnabled()) {
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
255 for (int i = 0; i <= groups; i++) {
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
256 logger.debug("Group " + i + ": " + m.group(i));
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
257 }
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
258 }
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
259
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
260 String connection = null;
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
261
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
262 if (groups < 4) {
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
263 logger.warn("Could only partially parse connection string.");
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
264 return null;
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
265 }
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
266
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
267 String host = m.group(2);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
268 String port = m.group(3);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
269 String db = m.group(4);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
270
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
271 StringBuilder sb = new StringBuilder();
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
272 sb.append("dbname=" + db);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
273 sb.append(" host='" + host + "'");
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
274 sb.append(" port=" + port);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
275 sb.append(" user=" + user);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
276 sb.append(" password='" + pass + "'");
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
277 sb.append(" sslmode=disable");
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
278
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
279 connection = sb.toString();
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
280
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
281 logger.debug("Created connection: '" + connection + "'");
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
282
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
283 return connection;
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
284 }
1854
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
285
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
286 protected String getConnectionType() {
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
287 return FLYSUtils.isUsingOracle() ? "oraclespatial" : "postgis";
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
288 }
e372934f0c42 Replaced the dbconnection.include used by Mapserver - these information are provided by LayerInfo objects now, which reduces config overhead.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1816
diff changeset
289
1876
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1854
diff changeset
290 protected String getLabelItem() {
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1854
diff changeset
291 return null;
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1854
diff changeset
292 }
dd467951335c Added support for labels in Mapserver layers and options to modify its style.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1854
diff changeset
293
2683
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
294 public int getRiverId() {
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
295 if (riverId == 0) {
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
296 String ids = artifact.getDataAsString("ids");
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
297 String[] parts = ids.split(";");
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
298
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
299 try {
3405
b0ba96bbf01d Use Integer.parseInt() instead of Integer.valueOf() + Autounboxing.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3302
diff changeset
300 riverId = Integer.parseInt(parts[0]);
2683
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
301 }
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
302 catch (NumberFormatException nfe) {
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
303 logger.error("Cannot parse river id from '" + parts[0] + "'");
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
304 }
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
305 }
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
306
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
307 return riverId;
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
308 }
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
309
2672
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
310 /**
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
311 * Returns the name of the WMS layer. This method extracts the name
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
312 * from 'ids' data string. It is expected, that the 'ids' string is
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
313 * seperated by ';' and that the name is placed at index 1.
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
314 *
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
315 * @return the name of the WMS layer.
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
316 */
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
317 public String getName() {
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
318 if (name == null) {
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
319 String ids = artifact.getDataAsString("ids");
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
320
2683
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
321 String parts[] = ids != null ? ids.split(";") : null;
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
322
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
323 if (parts != null && parts.length >= 2) {
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
324 name = parts[1];
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
325 }
2672
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
326 }
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
327
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
328 return name;
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
329 }
5afccab9aac1 Modified floodmap specific datacage configuration and improved WMS hws layer.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2089
diff changeset
330
2683
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
331
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
332 /**
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
333 * Returns the name of the layer (returned by getName()) or the layer
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
334 * type if the name is empty. The layer type is created by an i18n
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
335 * string of getFacetType().
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
336 *
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
337 * @param meta A CallMeta used for i18n.
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
338 *
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
339 * @return the name of the layer or its type if name is empty.
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
340 */
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
341 protected String getTitle(CallMeta meta) {
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
342 String name = getName();
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
343
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
344 return name != null && name.length() > 0
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
345 ? name
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
346 : Resources.getMsg(
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
347 meta,
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
348 getFacetType(),
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
349 getFacetType());
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
350 }
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
351
f5af3adb3b95 Improved datacage configuration for floodmaps and maps and modified the WMS layer artifacts to support names for layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2672
diff changeset
352
3019
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
353 @Override
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
354 public void endOfLife(Artifact owner, Object context) {
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
355 logger.info("Destroy WMSDBState: " + getID());
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
356
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
357 String p = FLYSUtils.getXPathString(FLYSUtils.XPATH_SHAPEFILE_DIR);
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
358 File dir = new File(p, owner.identifier());
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
359
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
360 if (dir != null && dir.exists()) {
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
361 logger.debug("Try to delete directory '" + dir + "'");
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
362
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
363 FileTools.deleteRecursive(dir);
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
364 MapfileGenerator.getInstance().update();
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
365 }
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
366 }
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
367
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
368 /**
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
369 * This method returns the extent of a DB layer in the projection of the
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
370 * database.
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
371 *
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
372 * @return the extent of the DB layer in the projection of the database.
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
373 */
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
374 protected Envelope getExtent() {
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
375 return getExtent(false);
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
376 }
3019
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
377
484f3dad4bfd Let Artifacts of type WMSDBArtifact remove produced files and directories when endOfLife() is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2763
diff changeset
378
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
379 protected abstract String getFacetType();
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
380
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
381 protected abstract String getUrl();
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
382
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
383 protected abstract String getSrid();
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
384
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
385 /**
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
386 * This method returns the extent of the DB layer. The projection of the
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
387 * extent depends on the <i>reproject</i> parameter. If reproject is set,
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
388 * the extent is reprojected into the original projection which is
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
389 * specified in the configuration. Otherwise, the projection of the
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
390 * database is used.
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
391 *
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
392 * @param reproject True, to reproject the extent into the projection
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
393 * specified in the configuration.
3923
9fac337192c9 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3918
diff changeset
394 *
3918
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
395 * @return the extent of the database layer.
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
396 */
2fdbe78a8fc2 Fixed various projection issues during map creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3405
diff changeset
397 protected abstract Envelope getExtent(boolean reproject);
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
398
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
399 protected abstract String getFilter();
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
400
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
401 protected abstract String getDataString();
1816
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1805
diff changeset
402
5364b86a0880 Improved styles of WMS layers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1805
diff changeset
403 protected abstract String getGeometryType();
1805
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
404 } // end of WMSDBState
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
405 }
5e9696c32f04 Added datacage config and loaders for KM WMS layer in floodmaps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
406 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org