annotate gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java @ 779:b1f5f2a8840f

Ordered imports. Removed needless imports. Removed empty headers. gnv-artifacts/trunk@854 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 29 Mar 2010 08:51:20 +0000
parents 9a828e5a2390
children c4156275c1e1
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
779
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
3 import de.intevation.artifactdatabase.XMLUtils;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
4
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
5 import de.intevation.artifacts.ArtifactNamespaceContext;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
6 import de.intevation.artifacts.CallContext;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
7
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
8 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
9
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
10 import de.intevation.gnv.wms.LayerInfo;
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
11
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import java.io.File;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import java.io.FileNotFoundException;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import java.io.FileOutputStream;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import java.io.IOException;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import java.io.OutputStream;
779
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
17
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
18 import java.util.Date;
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
779
b1f5f2a8840f Ordered imports. Removed needless imports. Removed empty headers.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 778
diff changeset
21
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import org.w3c.dom.Document;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import org.w3c.dom.Element;
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 /**
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 */
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 public class MetaWriter {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 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
31
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 public static final String NODE_MAPSERVER = "mapserver";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 public static final String NODE_SERVER = "server";
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 public static final String NODE_MAP = "map";
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
35 public static final String NODE_TTL = "ttl";
647
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 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
38 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
39 public static final String POLYGON_NAME = "polygons.shp";
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
40 public static final String LAYER_DATA_NAME = "data.shp";
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
42 public static final String CONTEXT_LAYER_TITLE = "wms.title";
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
43
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 private MetaWriter() {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 773
diff changeset
46
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
47 public static Document writeLayerMeta(CallContext context,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
48 String uuid,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
49 String path,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
50 String paramType,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
51 String layerType){
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
52 Document meta = XMLUtils.newDocument();
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
53 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
54 meta,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
55 ArtifactNamespaceContext.NAMESPACE_URI,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
56 ArtifactNamespaceContext.NAMESPACE_PREFIX);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
57 Element root = creator.create("meta");
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
58 meta.appendChild(root);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 773
diff changeset
59
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
60 writeAbstractMeta(context, meta, root);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
61 writeLayerMeta(context, meta, root, uuid, paramType,layerType);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
62 boolean success = writeMetaFile(path, meta);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 773
diff changeset
63
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
64 if (success){
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
65 return meta;
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
66 }else{
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
67 return null;
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
68 }
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
69 }
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 public static Document writeHorizontalcrosssectionMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 CallContext context,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 String uuid,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 String path,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 String paramType)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 Document meta = XMLUtils.newDocument();
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 meta,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 ArtifactNamespaceContext.NAMESPACE_PREFIX);
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 Element root = creator.create("meta");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 meta.appendChild(root);
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 writeAbstractMeta(context, meta, root);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 writePolygonMeta(context, meta, root, uuid, path, paramType);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 writeIsolineMeta(context, meta, root, uuid, path, paramType);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
90 boolean success = writeMetaFile(path, meta);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
91
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
92 if (success){
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
93 return meta;
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
94 }else{
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
95 return null;
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
96 }
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
97 }
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
98
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
99 /**
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
100 * @param path
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
101 * @param meta
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
102 */
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
103 private static boolean writeMetaFile(String path, Document meta) {
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 try {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 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
106
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
107 if (metaFile.exists()) {
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
108 logger.info("Delete old meta information file.");
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
109 metaFile.delete();
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
110 }
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
111
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 if (!metaFile.createNewFile() || !metaFile.canWrite()) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 logger.error("Error while writing meta file: "+metaFile.toString());
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
114 return false;
647
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
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 OutputStream out = null;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 boolean success = false;
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 try {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 out = new FileOutputStream(metaFile);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121 success = XMLUtils.toStream(meta, out);
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 finally {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 if (out != null) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
125 try { out.close(); }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 catch (IOException ioe) {}
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 }
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 if (!success && metaFile.exists()) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 metaFile.delete();
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
134 return success;
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 catch (FileNotFoundException fnfe) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 logger.error(fnfe);
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
138 return false;
647
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 catch (IOException ioe) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 logger.error(ioe, ioe);
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
142 return false;
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 }
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
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 public static void writeAbstractMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 CallContext callContext,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 Document document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 Element meta
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 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 ArtifactNamespaceContext.NAMESPACE_PREFIX);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 GNVArtifactContext context =
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 (GNVArtifactContext) callContext.globalContext();
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
160 String server = (String)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 context.get(GNVArtifactContext.MAPSERVER_SERVER_PATH_KEY);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 String map = (String)
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 context.get(GNVArtifactContext.MAPSERVER_MAP_PATH_KEY);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
166 if (logger.isDebugEnabled()) {
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
167 logger.debug("MAPSERVER PATH: " + server);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
168 logger.debug("MAP PATH: " + map);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
169 }
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
170
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 Element mapserver = creator.create(NODE_MAPSERVER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 Element serverPath = creator.create(NODE_SERVER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
173 Element mapPath = creator.create(NODE_MAP);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
174
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
175 mapPath.setTextContent(map);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 serverPath.setTextContent(server);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
177
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
178 mapserver.appendChild(serverPath);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 mapserver.appendChild(mapPath);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 meta.appendChild(mapserver);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
183 protected static void writeLayerMeta(
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
184 CallContext callContext,
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
185 Document document,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
186 Element meta,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
187 String uuid,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
188 String paramType,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
189 String layerType
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
190 ) {
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
191 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
192 document,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
193 ArtifactNamespaceContext.NAMESPACE_URI,
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
194 ArtifactNamespaceContext.NAMESPACE_PREFIX);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
195
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
196 Long time = callContext.getTimeToLive();
773
5fb1ea68e19c Avoid danger to get a NullPointerException if no time to live is served by CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 772
diff changeset
197 time = time != null ? time + new Date().getTime() : null;
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
198 String ttl = time != null ? time.toString() : null;
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
199
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
200 logger.debug("Artifacts time to live: " + ttl);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
201
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
202 Element layer = creator.create(LayerInfo.LAYER);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
203 Element model = creator.create(LayerInfo.LAYER_MODEL);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
204 Element name = creator.create(LayerInfo.LAYER_NAME);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
205 Element type = creator.create(LayerInfo.LAYER_TYPE);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
206 Element status = creator.create(LayerInfo.LAYER_STATUS);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
207 Element data = creator.create(LayerInfo.LAYER_DATA);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
208 Element timeToLive = creator.create(NODE_TTL);
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
209
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
210 model.setTextContent(paramType);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
211 name.setTextContent(uuid);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
212 type.setTextContent(layerType);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
213 status.setTextContent("OFF");
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
214 data.setTextContent(LAYER_DATA_NAME);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
215 timeToLive.setTextContent(ttl);
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
216
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
217 layer.appendChild(model);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
218 layer.appendChild(name);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
219 layer.appendChild(type);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
220 layer.appendChild(status);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
221 layer.appendChild(data);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
222 layer.appendChild(timeToLive);
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
223
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
224 meta.appendChild(layer);
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
225 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 773
diff changeset
226
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 773
diff changeset
227
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
228 public static void writePolygonMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
229 CallContext context,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
230 Document document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
231 Element meta,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 String uuid,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 String path,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234 String paramType
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235 ) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
237 document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 ArtifactNamespaceContext.NAMESPACE_PREFIX);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
241 Long time = context.getTimeToLive();
773
5fb1ea68e19c Avoid danger to get a NullPointerException if no time to live is served by CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 772
diff changeset
242 time = time != null ? time + new Date().getTime() : null;
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
243 String ttl = time != null ? time.toString() : null;
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
244
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
245 logger.debug("Artifacts time to live: " + ttl);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
246
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 Element layer = creator.create(LayerInfo.LAYER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
248 Element model = creator.create(LayerInfo.LAYER_MODEL);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
249 Element name = creator.create(LayerInfo.LAYER_NAME);
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
250 Element title = creator.create(LayerInfo.LAYER_TITLE);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251 Element type = creator.create(LayerInfo.LAYER_TYPE);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 Element status = creator.create(LayerInfo.LAYER_STATUS);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 Element data = creator.create(LayerInfo.LAYER_DATA);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
254 Element timeToLive = creator.create(NODE_TTL);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 model.setTextContent(paramType);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257 name.setTextContent(uuid);
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
258 title.setTextContent(
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
259 (String) context.getContextValue(CONTEXT_LAYER_TITLE));
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260 type.setTextContent("POLYGON");
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
261 status.setTextContent("OFF");
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
262 data.setTextContent(POLYGON_NAME);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
263 timeToLive.setTextContent(ttl);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
264
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
265 layer.appendChild(model);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
266 layer.appendChild(name);
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
267 layer.appendChild(title);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 layer.appendChild(type);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 layer.appendChild(status);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270 layer.appendChild(data);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
271 layer.appendChild(timeToLive);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
272
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
273 meta.appendChild(layer);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
274 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
275
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
276
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
277 public static void writeIsolineMeta(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278 CallContext context,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
279 Document document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 Element meta,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
281 String uuid,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 String path,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 String paramType
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 ) {
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
285 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
286 document,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
287 ArtifactNamespaceContext.NAMESPACE_URI,
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
288 ArtifactNamespaceContext.NAMESPACE_PREFIX);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
289
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
290 Long time = context.getTimeToLive();
773
5fb1ea68e19c Avoid danger to get a NullPointerException if no time to live is served by CallContext.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 772
diff changeset
291 time = time != null ? time + new Date().getTime() : null;
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
292 String ttl = time != null ? time.toString() : null;
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
293
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
294 logger.debug("Artifacts time to live: " + ttl);
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
295
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
296 Element layer = creator.create(LayerInfo.LAYER);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
297 Element model = creator.create(LayerInfo.LAYER_MODEL);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
298 Element name = creator.create(LayerInfo.LAYER_NAME);
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
299 Element title = creator.create(LayerInfo.LAYER_TITLE);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
300 Element type = creator.create(LayerInfo.LAYER_TYPE);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
301 Element status = creator.create(LayerInfo.LAYER_STATUS);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
302 Element data = creator.create(LayerInfo.LAYER_DATA);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
303 Element timeToLive = creator.create(NODE_TTL);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
304
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
305 model.setTextContent(paramType+"_isolines");
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
306 name.setTextContent(uuid);
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
307 title.setTextContent(
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
308 (String) context.getContextValue(CONTEXT_LAYER_TITLE));
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
309 type.setTextContent("LINE");
655
6eccb68a8b99 Added WMS-Publishing to Product Layer
Tim Englich <tim.englich@intevation.de>
parents: 647
diff changeset
310 status.setTextContent("OFF");
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
311 data.setTextContent(ISOLINES_NAME);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
312 timeToLive.setTextContent(ttl);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
313
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
314 layer.appendChild(model);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
315 layer.appendChild(name);
730
452fad121560 Implemented code for changing the title of a wms layer (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 655
diff changeset
316 layer.appendChild(title);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
317 layer.appendChild(type);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
318 layer.appendChild(status);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
319 layer.appendChild(data);
772
cd64ab8a46a7 Put time to live of an artifact into meta document which is created while wms publishing (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 730
diff changeset
320 layer.appendChild(timeToLive);
647
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
321
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
322 meta.appendChild(layer);
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
323 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
324 }
bb0aa1f81280 Added missing class MetaWriter from last commit.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
325 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org