01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.vfny.geoserver.wms.responses.map.georss;
06:
07: import java.io.IOException;
08: import java.io.OutputStream;
09: import java.util.HashSet;
10:
11: import javax.xml.transform.TransformerException;
12:
13: import org.vfny.geoserver.ServiceException;
14: import org.vfny.geoserver.wms.GetMapProducer;
15: import org.vfny.geoserver.wms.WMSMapContext;
16: import org.vfny.geoserver.wms.WmsException;
17:
18: public class AtomGeoRSSMapProducer implements GetMapProducer {
19: /** format names/aliases */
20: public static HashSet FORMATS = new HashSet();
21: static {
22: FORMATS.add("atom");
23: FORMATS.add("application/atom xml");
24: }
25:
26: /** mime type */
27: public static String MIME_TYPE = "application/atom+xml";
28:
29: /**
30: * current map context
31: */
32: WMSMapContext map;
33:
34: public String getContentType() throws IllegalStateException {
35: return MIME_TYPE;
36: }
37:
38: public void setContentType(String mime) {
39: throw new UnsupportedOperationException();
40: }
41:
42: public void produceMap() throws WmsException {
43: }
44:
45: public void writeTo(OutputStream out) throws ServiceException,
46: IOException {
47: AtomGeoRSSTransformer tx = new AtomGeoRSSTransformer();
48:
49: try {
50: tx.transform(map, out);
51: } catch (TransformerException e) {
52: throw (IOException) new IOException().initCause(e);
53: }
54:
55: map = null;
56: }
57:
58: public void abort() {
59: map = null;
60: }
61:
62: public String getContentDisposition() {
63: return null;
64: }
65:
66: public WMSMapContext getMapContext() {
67: return map;
68: }
69:
70: public void setMapContext(WMSMapContext mapContext) {
71: this .map = mapContext;
72: }
73:
74: public String getOutputFormat() {
75: return MIME_TYPE;
76: }
77:
78: public void setOutputFormat(String format) {
79: throw new UnsupportedOperationException();
80: }
81:
82: }
|