Package org.geotools.jdbc
Class JDBCFeatureReader
Object
JDBCFeatureReader
- All Implemented Interfaces:
Closeable,AutoCloseable,FeatureReader<SimpleFeatureType,SimpleFeature>
- Direct Known Subclasses:
JDBCInsertFeatureWriter,JDBCJoiningFeatureReader,JDBCUpdateFeatureWriter
public class JDBCFeatureReader
extends Object
implements FeatureReader<SimpleFeatureType,SimpleFeature>
Reader for jdbc datastore
- Author:
- Justin Deoliveira, The Open Plannign Project.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classFeature wrapper around a result set. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SimpleFeatureBuilderfeature builderprotected JDBCReaderCallbackprotected String[]protected Connectionprotected JDBCDataStorethe datastoreprotected JDBCFeatureSourceThe feature source the reader originated from.protected SimpleFeatureTypeschema of featuresprotected GeometryFactorygeometry factory used to create geometry objectsprotected Hintshintsprotected static final Loggerprotected ResultSetMetaDataprotected Booleanflag indicating if the iterator has another featureprotected intoffset/column index to start reading from result setprotected PrimaryKeyThe primary keyprotected Querythe queryprotected ResultSetprotected ScreenMapScreenmap for feature skipping behaviourprotected Statementstatement,result set that is being worked from.protected static final BooleanWhen true, the stack trace that created a reader that wasn't closed is recorded and then printed out when warning the user about this.protected Exceptionprotected Transactioncurrent transaction -
Constructor Summary
ConstructorsConstructorDescriptionJDBCFeatureReader(String sql, Connection cx, JDBCFeatureSource featureSource, SimpleFeatureType featureType, Query query) JDBCFeatureReader(PreparedStatement st, Connection cx, JDBCFeatureSource featureSource, SimpleFeatureType featureType, Query query) JDBCFeatureReader(ResultSet rs, Connection cx, int offset, JDBCFeatureSource featureSource, SimpleFeatureType featureType, Query query) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcleanup()Cleans up the reader state without closing the accessory resultset, statement and connection.voidclose()Release the underlying resources associated with this stream.protected voidprotected voidprotected voidfinalize()Return the FeatureType this reader has been configured to create.getQuery()booleanhasNext()Query whether this FeatureReader has another Feature.protected voidinit(JDBCFeatureSource featureSource, SimpleFeatureType featureType, Query query) next()Reads the next Feature in the FeatureReader.protected SimpleFeaturevoid
-
Field Details
-
LOGGER
-
TRACE_ENABLED
When true, the stack trace that created a reader that wasn't closed is recorded and then printed out when warning the user about this. -
featureSource
The feature source the reader originated from. -
dataStore
the datastore -
featureType
schema of features -
geometryFactory
geometry factory used to create geometry objects -
query
the query -
hints
hints -
screenMap
Screenmap for feature skipping behaviour -
tx
current transaction -
next
flag indicating if the iterator has another feature -
builder
feature builder -
pkey
The primary key -
st
statement,result set that is being worked from. -
rs
-
cx
-
md
-
tracer
-
columnNames
-
offset
protected int offsetoffset/column index to start reading from result set -
callback
-
-
Constructor Details
-
JDBCFeatureReader
public JDBCFeatureReader(String sql, Connection cx, JDBCFeatureSource featureSource, SimpleFeatureType featureType, Query query) throws SQLException - Throws:
SQLException
-
JDBCFeatureReader
public JDBCFeatureReader(PreparedStatement st, Connection cx, JDBCFeatureSource featureSource, SimpleFeatureType featureType, Query query) throws SQLException - Throws:
SQLException
-
JDBCFeatureReader
public JDBCFeatureReader(ResultSet rs, Connection cx, int offset, JDBCFeatureSource featureSource, SimpleFeatureType featureType, Query query) throws SQLException - Throws:
SQLException
-
JDBCFeatureReader
-
-
Method Details
-
init
-
setNext
-
getFeatureType
Description copied from interface:FeatureReaderReturn the FeatureType this reader has been configured to create.- Specified by:
getFeatureTypein interfaceFeatureReader<SimpleFeatureType,SimpleFeature> - Returns:
- the FeatureType of the Features this FeatureReader will create.
-
getPrimaryKey
-
getQuery
-
hasNext
Description copied from interface:FeatureReaderQuery whether this FeatureReader has another Feature.- Specified by:
hasNextin interfaceFeatureReader<SimpleFeatureType,SimpleFeature> - Returns:
- True if there are more Features to be read. In other words, true if calls to next would return a feature rather than throwing an exception.
- Throws:
IOException- If an error occurs determining if there are more Features.
-
readNextFeature
-
ensureNext
protected void ensureNext() -
ensureOpen
- Throws:
IOException
-
next
Description copied from interface:FeatureReaderReads the next Feature in the FeatureReader.- Specified by:
nextin interfaceFeatureReader<SimpleFeatureType,SimpleFeature> - Returns:
- The next feature in the reader.
- Throws:
IOException- If an error occurs reading the Feature.NoSuchElementException- If there are no more Features in the Reader.IllegalArgumentException
-
close
Description copied from interface:FeatureReaderRelease the underlying resources associated with this stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceFeatureReader<SimpleFeatureType,SimpleFeature> - Throws:
IOException- if an I/O error occurs
-
cleanup
Cleans up the reader state without closing the accessory resultset, statement and connection. Use only if the above are shared with another object that will take care of closing them.- Throws:
IOException
-
finalize
-