01: package org.geoserver.wms.xml;
02:
03: import java.io.Reader;
04: import java.util.Map;
05:
06: import javax.xml.namespace.QName;
07:
08: import org.geoserver.ows.XmlRequestReader;
09: import org.geoserver.wms.kvp.GetMapKvpRequestReader;
10: import org.geotools.factory.CommonFactoryFinder;
11: import org.geotools.styling.SLDParser;
12: import org.geotools.styling.StyleFactory;
13: import org.geotools.styling.StyledLayerDescriptor;
14: import org.vfny.geoserver.wms.requests.GetMapRequest;
15:
16: /**
17: * Reads
18: * @author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
19: *
20: */
21: public class SLDXmlRequestReader extends XmlRequestReader {
22:
23: StyleFactory styleFactory = CommonFactoryFinder
24: .getStyleFactory(null);
25:
26: public SLDXmlRequestReader() {
27: super ("http://www.opengis.net/sld", "StyledLayerDescriptor");
28: }
29:
30: public void setStyleFactory(StyleFactory styleFactory) {
31: this .styleFactory = styleFactory;
32: }
33:
34: public Object read(Object request, Reader reader, Map kvp)
35: throws Exception {
36: if (request == null) {
37: throw new IllegalArgumentException(
38: "request must be not null");
39: }
40:
41: GetMapRequest getMap = (GetMapRequest) request;
42: StyledLayerDescriptor sld = new SLDParser(styleFactory, reader)
43: .parseSLD();
44:
45: //process the sld
46: GetMapKvpRequestReader.processStandaloneSld(getMap, sld);
47:
48: return getMap;
49: }
50:
51: }
|