annotate gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java @ 772:cd64ab8a46a7

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

http://dive4elements.wald.intevation.org