001: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002: * This code is licensed under the GPL 2.0 license, availible at the root
003: * application directory.
004: */
005: package org.vfny.geoserver.global;
006:
007: import com.vividsolutions.jts.geom.Envelope;
008: import org.geotools.data.DataStore;
009: import org.geotools.data.FeatureSource;
010: import org.geotools.feature.FeatureType;
011: import org.geotools.styling.Style;
012: import org.opengis.filter.Filter;
013: import org.vfny.geoserver.global.dto.FeatureTypeInfoDTO;
014: import org.w3c.dom.Element;
015:
016: /**
017: * This is a very simple class that lets you wrap a temporary datastore into a FeatureTypeInfo.
018: * This is being used by the UserLayer#InlineFeature, and will probably be used by the
019: * UserLayer#OWS (remote WFS).
020: *
021: * Currently the only thing that you need to do for this is #getFeatureSource().
022: *
023: * We throw errors for everything else so people dont screw up!
024: *
025: */
026: import java.io.File;
027: import java.io.IOException;
028: import java.util.List;
029:
030: public class TemporaryFeatureTypeInfo extends FeatureTypeInfo {
031: private DataStore ds;
032:
033: /**
034: *
035: * @param ds
036: * @param ft
037: */
038: public TemporaryFeatureTypeInfo(DataStore ds) {
039: super ();
040: this .ds = ds;
041: }
042:
043: public FeatureSource getFeatureSource() throws IOException {
044: return ds.getFeatureSource(ds.getTypeNames()[0]);
045: }
046:
047: public FeatureSource getFeatureSource(boolean skipReproject)
048: throws IOException {
049: return getFeatureSource();
050: }
051:
052: public Filter getDefinitionQuery() {
053: return Filter.INCLUDE;
054: }
055:
056: public Object toDTO() {
057: throw new IllegalArgumentException(
058: "TemporaryFeatureTypeInfo - not supported");
059: }
060:
061: public int getNumDecimals() {
062: throw new IllegalArgumentException(
063: "TemporaryFeatureTypeInfo - not supported");
064: }
065:
066: public DataStoreInfo getDataStoreInfo() {
067: throw new IllegalArgumentException(
068: "TemporaryFeatureTypeInfo - not supported");
069: }
070:
071: public Style getDefaultStyle() {
072: throw new IllegalArgumentException(
073: "TemporaryFeatureTypeInfo - not supported");
074: }
075:
076: public boolean isEnabled() {
077: /**
078: * TODO throw new IllegalArgumentException("TemporaryFeatureTypeInfo - not supported");
079: */
080: return true;
081: }
082:
083: public String getPrefix() {
084: throw new IllegalArgumentException(
085: "TemporaryFeatureTypeInfo - not supported");
086: }
087:
088: public NameSpaceInfo getNameSpace() {
089: throw new IllegalArgumentException(
090: "TemporaryFeatureTypeInfo - not supported");
091: }
092:
093: public String getName() {
094: throw new IllegalArgumentException(
095: "TemporaryFeatureTypeInfo - not supported");
096: }
097:
098: public Envelope getBoundingBox() throws IOException {
099: throw new IllegalArgumentException(
100: "TemporaryFeatureTypeInfo - not supported");
101: }
102:
103: public Envelope getLatLongBoundingBox() throws IOException {
104: throw new IllegalArgumentException(
105: "TemporaryFeatureTypeInfo - not supported");
106: }
107:
108: public String getSRS() {
109: /**
110: * TODO throw new IllegalArgumentException("TemporaryFeatureTypeInfo - not supported");
111: */
112: return "4326";
113: }
114:
115: private synchronized FeatureTypeInfoDTO getGeneratedDTO()
116: throws IOException {
117: throw new IllegalArgumentException(
118: "TemporaryFeatureTypeInfo - not supported");
119: }
120:
121: protected String getAttribute(Element elem, String attName,
122: boolean mandatory) throws ConfigurationException {
123: throw new IllegalArgumentException(
124: "TemporaryFeatureTypeInfo - not supported");
125: }
126:
127: private static Envelope getLatLongBBox(String fromSrId,
128: Envelope bbox) {
129: throw new IllegalArgumentException(
130: "TemporaryFeatureTypeInfo - not supported");
131: }
132:
133: public String getAbstract() {
134: throw new IllegalArgumentException(
135: "TemporaryFeatureTypeInfo - not supported");
136: }
137:
138: public List getKeywords() {
139: throw new IllegalArgumentException(
140: "TemporaryFeatureTypeInfo - not supported");
141: }
142:
143: public String getTitle() {
144: throw new IllegalArgumentException(
145: "TemporaryFeatureTypeInfo - not supported");
146: }
147:
148: public String getSchemaName() {
149: throw new IllegalArgumentException(
150: "TemporaryFeatureTypeInfo - not supported");
151: }
152:
153: public void setSchemaName(String string) {
154: throw new IllegalArgumentException(
155: "TemporaryFeatureTypeInfo - not supported");
156: }
157:
158: public String getSchemaBase() {
159: throw new IllegalArgumentException(
160: "TemporaryFeatureTypeInfo - not supported");
161: }
162:
163: public void setSchemaBase(String string) {
164: throw new IllegalArgumentException(
165: "TemporaryFeatureTypeInfo - not supported");
166: }
167:
168: public String getTypeName() {
169: throw new IllegalArgumentException(
170: "TemporaryFeatureTypeInfo - not supported");
171: }
172:
173: public FeatureType getFeatureType() throws IOException {
174: throw new IllegalArgumentException(
175: "TemporaryFeatureTypeInfo - not supported");
176: }
177:
178: private FeatureType getFeatureType(FeatureSource fs)
179: throws IOException {
180: throw new IllegalArgumentException(
181: "TemporaryFeatureTypeInfo - not supported");
182: }
183:
184: public DataStoreInfo getDataStoreMetaData() {
185: throw new IllegalArgumentException(
186: "TemporaryFeatureTypeInfo - not supported");
187: }
188:
189: public List getAttributeNames() {
190: throw new IllegalArgumentException(
191: "TemporaryFeatureTypeInfo - not supported");
192: }
193:
194: public List getAttributes() {
195: throw new IllegalArgumentException(
196: "TemporaryFeatureTypeInfo - not supported");
197: }
198:
199: public synchronized AttributeTypeInfo AttributeTypeMetaData(
200: String attributeName) {
201: throw new IllegalArgumentException(
202: "TemporaryFeatureTypeInfo - not supported");
203: }
204:
205: public boolean containsMetaData(String key) {
206: throw new IllegalArgumentException(
207: "TemporaryFeatureTypeInfo - not supported");
208: }
209:
210: public void putMetaData(String key, Object value) {
211: throw new IllegalArgumentException(
212: "TemporaryFeatureTypeInfo - not supported");
213: }
214:
215: public Object getMetaData(String key) {
216: throw new IllegalArgumentException(
217: "TemporaryFeatureTypeInfo - not supported");
218: }
219:
220: public LegendURL getLegendURL() {
221: throw new IllegalArgumentException(
222: "TemporaryFeatureTypeInfo - not supported");
223: }
224:
225: public File getSchemaFile() {
226: throw new IllegalArgumentException(
227: "TemporaryFeatureTypeInfo - not supported");
228: }
229: }
|