01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.sld;
17:
18: import org.eclipse.xsd.util.XSDSchemaLocationResolver;
19: import org.picocontainer.MutablePicoContainer;
20: import org.geotools.filter.v1_0.OGCConfiguration;
21: import org.geotools.sld.bindings.SLD;
22: import org.geotools.sld.bindings.SLDBindingConfiguration;
23: import org.geotools.sld.bindings.SLDSchemaLocationResolver;
24: import org.geotools.styling.StyleFactory;
25: import org.geotools.styling.StyleFactoryImpl;
26: import org.geotools.xml.BindingConfiguration;
27: import org.geotools.xml.Configuration;
28:
29: /**
30: * Parser configuration for the Styled Layer Descriptor schema.
31: *
32: * @author Justin Deoliveira, The Open Planning Project
33: *
34: */
35: public class SLDConfiguration extends Configuration {
36: /**
37: * Adds a dependency on {@link OGCConfiguration}
38: */
39: public SLDConfiguration() {
40: super ();
41:
42: addDependency(new OGCConfiguration());
43: }
44:
45: /**
46: * @return A new instance of {@link SLDBindingConfiguration}.
47: */
48: public BindingConfiguration getBindingConfiguration() {
49: return new SLDBindingConfiguration();
50: }
51:
52: /**
53: * @return {@link SLD#NAMESPACE}, http://www.opengis.net/sld
54: */
55: public String getNamespaceURI() {
56: return SLD.NAMESPACE;
57: }
58:
59: /**
60: * @return the StyledLayerDescriptor.xsd file of the schema.
61: */
62: public String getSchemaFileURL() {
63: return getSchemaLocationResolver().resolveSchemaLocation(null,
64: getNamespaceURI(), "StyledLayerDescriptor.xsd");
65: }
66:
67: /**
68: * @return A new instance of {@link SLDSchemaLocationResolver}.
69: */
70: public XSDSchemaLocationResolver getSchemaLocationResolver() {
71: return new SLDSchemaLocationResolver();
72: }
73:
74: /**
75: * Configures the sld context.
76: * <p>
77: * The following factories are registered:
78: * <ul>
79: * <li>{@link StyleFactoryImpl.class} under {@link StyleFactory.class}
80: * </ul>
81: * </p>
82: */
83: protected void configureContext(MutablePicoContainer container) {
84: super .configureContext(container);
85:
86: container.registerComponentImplementation(StyleFactory.class,
87: StyleFactoryImpl.class);
88: }
89: }
|