annotate gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java @ 647:bb0aa1f81280

Added missing class MetaWriter from last commit. gnv-artifacts/trunk@734 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 05 Mar 2010 07:18:52 +0000
parents
children 6eccb68a8b99
rev   line source
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.utils;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import de.intevation.artifacts.ArtifactNamespaceContext;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import de.intevation.artifacts.CallContext;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import de.intevation.artifactdatabase.XMLUtils;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.gnv.wms.LayerInfo;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import java.io.File;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import java.io.FileNotFoundException;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import java.io.FileOutputStream;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import java.io.IOException;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import java.io.OutputStream;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import org.w3c.dom.Document;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.w3c.dom.Element;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 /**
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 */
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 public class MetaWriter {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 private static Logger logger = Logger.getLogger(MetaWriter.class);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 public static final String NODE_MAPSERVER = "mapserver";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 public static final String NODE_SERVER = "server";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 public static final String NODE_MAP = "map";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public static final String META_FILE_NAME = "meta.xml";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 public static final String ISOLINES_NAME = "isolines.shp";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 public static final String POLYGON_NAME = "polygons.shp";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 private MetaWriter() {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public static Document writeHorizontalcrosssectionMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 CallContext context,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 String uuid,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 String path,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 String paramType)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 Document meta = XMLUtils.newDocument();
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 meta,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 ArtifactNamespaceContext.NAMESPACE_PREFIX);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 Element root = creator.create("meta");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 meta.appendChild(root);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 writeAbstractMeta(context, meta, root);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 writePolygonMeta(context, meta, root, uuid, path, paramType);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 writeIsolineMeta(context, meta, root, uuid, path, paramType);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 try {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 File metaFile = new File(path, META_FILE_NAME);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 if (!metaFile.createNewFile() || !metaFile.canWrite()) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 logger.error("Error while writing meta file: "+metaFile.toString());
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 return null;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 OutputStream out = null;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 boolean success = false;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 try {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 out = new FileOutputStream(metaFile);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 success = XMLUtils.toStream(meta, out);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 finally {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 if (out != null) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 try { out.close(); }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 catch (IOException ioe) {}
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 if (!success && metaFile.exists()) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 metaFile.delete();
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 return success ? meta : null;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 catch (FileNotFoundException fnfe) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 logger.error(fnfe);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 catch (IOException ioe) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 logger.error(ioe, ioe);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 return meta;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 public static void writeAbstractMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 CallContext callContext,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 Document document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 Element meta
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 ) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 ArtifactNamespaceContext.NAMESPACE_PREFIX);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 GNVArtifactContext context =
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 (GNVArtifactContext) callContext.globalContext();
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 String server = (String)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 context.get(GNVArtifactContext.MAPSERVER_SERVER_PATH_KEY);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 String map = (String)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 context.get(GNVArtifactContext.MAPSERVER_MAP_PATH_KEY);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 logger.debug("MAPSERVER PATH: " + server);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 logger.debug("MAP PATH: " + map);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 Element mapserver = creator.create(NODE_MAPSERVER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 Element serverPath = creator.create(NODE_SERVER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 Element mapPath = creator.create(NODE_MAP);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
122
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123 mapPath.setTextContent(map);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 serverPath.setTextContent(server);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 mapserver.appendChild(serverPath);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 mapserver.appendChild(mapPath);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 meta.appendChild(mapserver);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 public static void writePolygonMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 CallContext context,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 Document document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 Element meta,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 String uuid,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 String path,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 String paramType
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 ) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 ArtifactNamespaceContext.NAMESPACE_PREFIX);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 Element layer = creator.create(LayerInfo.LAYER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 Element model = creator.create(LayerInfo.LAYER_MODEL);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 Element name = creator.create(LayerInfo.LAYER_NAME);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 Element type = creator.create(LayerInfo.LAYER_TYPE);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 Element status = creator.create(LayerInfo.LAYER_STATUS);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 Element data = creator.create(LayerInfo.LAYER_DATA);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 model.setTextContent(paramType);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 name.setTextContent(uuid);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 type.setTextContent("POLYGON");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 status.setTextContent("DEFAULT");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 data.setTextContent(POLYGON_NAME);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 layer.appendChild(model);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 layer.appendChild(name);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 layer.appendChild(type);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 layer.appendChild(status);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 layer.appendChild(data);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 meta.appendChild(layer);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 public static void writeIsolineMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
169 CallContext context,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170 Document document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 Element meta,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 String uuid,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 String path,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174 String paramType
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 ) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177 document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 ArtifactNamespaceContext.NAMESPACE_PREFIX);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 Element layer = creator.create(LayerInfo.LAYER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 Element model = creator.create(LayerInfo.LAYER_MODEL);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 Element name = creator.create(LayerInfo.LAYER_NAME);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 Element type = creator.create(LayerInfo.LAYER_TYPE);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 Element status = creator.create(LayerInfo.LAYER_STATUS);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 Element data = creator.create(LayerInfo.LAYER_DATA);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 model.setTextContent(paramType+"_isolines");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 name.setTextContent(uuid);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 type.setTextContent("LINE");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 status.setTextContent("DEFAULT");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
192 data.setTextContent(ISOLINES_NAME);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
194 layer.appendChild(model);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195 layer.appendChild(name);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
196 layer.appendChild(type);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 layer.appendChild(status);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 layer.appendChild(data);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
199
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
200 meta.appendChild(layer);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org