01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004, 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.data;
17:
18: import java.io.IOException;
19:
20: import org.geotools.feature.FeatureType;
21: import org.opengis.filter.Filter;
22:
23: /**
24: * <p>
25: * This class assumes the DataStore represents a single source, represented by
26: * a URL. In many cases the default functionality is chained off to the
27: * parent class (AbstractDataStore).
28: * </p>
29: *
30: * @author dzwiers
31: *
32: * @see AbstractDataStore
33: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/data/AbstractFileDataStore.java $
34: */
35: public abstract class AbstractFileDataStore extends AbstractDataStore {
36: /**
37: * Singular version, returns the FeatureType for the url being read.
38: *
39: * @see org.geotools.data.DataStore#getSchema(java.lang.String)
40: */
41: public abstract FeatureType getSchema() throws IOException;
42:
43: /**
44: * Singular version, which must be implemented to represent a Reader for
45: * the url being read.
46: *
47: * @see org.geotools.data.DataStore#getFeatureReader(java.lang.String)
48: */
49: protected abstract FeatureReader getFeatureReader()
50: throws IOException;
51:
52: /**
53: * Singular version, calls parent with getSchema().getTypeName()
54: *
55: * @see org.geotools.data.DataStore#updateSchema(java.lang.String,
56: * org.geotools.feature.FeatureType)
57: */
58: public void updateSchema(FeatureType featureType)
59: throws IOException {
60: updateSchema(getSchema().getTypeName(), featureType);
61: }
62:
63: /**
64: * Singular version, calls parent with getSchema().getTypeName()
65: *
66: * @see org.geotools.data.DataStore#getFeatureSource(java.lang.String)
67: */
68: public FeatureSource getFeatureSource() throws IOException {
69: return getFeatureSource(getSchema().getTypeName());
70: }
71:
72: /**
73: * Singular version, calls parent with getSchema().getTypeName()
74: */
75: public FeatureWriter getFeatureWriter(Filter filter,
76: Transaction transaction) throws IOException {
77: return getFeatureWriter(getSchema().getTypeName(), filter,
78: transaction);
79: }
80:
81: /**
82: * @see org.geotools.data.DataStore#getFeatureWriter(java.lang.String,
83: * org.geotools.data.Transaction)
84: */
85: public FeatureWriter getFeatureWriter(Transaction transaction)
86: throws IOException {
87: return getFeatureWriter(getSchema().getTypeName(), transaction);
88: }
89:
90: /**
91: * @see org.geotools.data.DataStore#getFeatureWriterAppend(java.lang.String,
92: * org.geotools.data.Transaction)
93: */
94: public FeatureWriter getFeatureWriterAppend(Transaction transaction)
95: throws IOException {
96: return getFeatureWriterAppend(getSchema().getTypeName(),
97: transaction);
98: }
99: }
|