|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectJDBCFeatureSource
public class JDBCFeatureSource
A JDBCFeatureSource that can opperate as a starting point for your own implementations.
This class is distinct from the AbstractFeatureSource implementations as JDBC provides us with so many opertunities for optimization.
Client code must implement:
Nested Class Summary | |
---|---|
protected class |
JDBCFeatureSource.JDBCQueryCapabilities
A default QueryCapabilities implementation for JDBCFeatureSource with template methods JDBCFeatureSource subclasses may override. |
Field Summary | |
---|---|
protected QueryCapabilities |
queryCapabilities
|
Constructor Summary | |
---|---|
JDBCFeatureSource(JDBC1DataStore jdbcDataStore,
SimpleFeatureType featureType)
JDBCFeatureSource creation. |
Method Summary | |
---|---|
void |
addFeatureListener(FeatureListener listener)
Adds FeatureListener to the JDBCDataStore against this FeatureSource. |
protected void |
close(Connection conn,
Transaction trans,
SQLException sqle)
|
protected void |
close(ResultSet rs)
|
protected void |
close(Statement statement)
|
int |
count(Query query,
Transaction transaction)
Direct SQL query number of rows in query. |
ReferencedEnvelope |
getBounds()
Retrieve Bounds of all Features. |
ReferencedEnvelope |
getBounds(Query query)
Retrieve Bounds of Query results. |
protected Connection |
getConnection()
|
int |
getCount(Query query)
Retrieve total number of Query results. |
DataStore |
getDataStore()
Retrieve DataStore for this FetureSource. |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getFeatures()
Retrieve all Features |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getFeatures(Filter filter)
Retrieve all Feature matching the Filter |
FeatureCollection<SimpleFeatureType,SimpleFeature> |
getFeatures(Query request)
Provides an interface to for the Resutls of a Query. |
ResourceInfo |
getInfo()
Information describing the contents of this resoruce. |
JDBC1DataStore |
getJDBCDataStore()
Allows access to JDBCDataStore(). |
Name |
getName()
Returns the same name than the feature type (ie, getSchema().getName() to honor the simple feature land common
practice of calling the same both the Features produces and their types |
QueryCapabilities |
getQueryCapabilities()
Returns the default jdbc query capabilities, subclasses should override to advertise their specific capabilities where they differ. |
SimpleFeatureType |
getSchema()
Retrieve FeatureType represented by this FeatureSource |
Set |
getSupportedHints()
By default, only detached feature is supported |
Transaction |
getTransaction()
Retrieve the Transaction this FeatureSource |
void |
removeFeatureListener(FeatureListener listener)
Remove FeatureListener to the JDBCDataStore against this FeatureSource. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected QueryCapabilities queryCapabilities
Constructor Detail |
---|
public JDBCFeatureSource(JDBC1DataStore jdbcDataStore, SimpleFeatureType featureType)
Constructs a FeatureStore that opperates against the provided jdbcDataStore to serve up the contents of featureType.
jdbcDataStore
- DataStore containing contentsfeatureType
- FeatureType being servedMethod Detail |
---|
public Name getName()
getSchema().getName()
to honor the simple feature land common
practice of calling the same both the Features produces and their types
getName
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
FeatureSource.getName()
public ResourceInfo getInfo()
FeatureSource
Please note that for FeatureContent:
getInfo
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
public DataStore getDataStore()
getDataStore
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
FeatureSource.getDataStore()
public JDBC1DataStore getJDBCDataStore()
Subclass must implement
public void addFeatureListener(FeatureListener listener)
addFeatureListener
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
listener
- FeatureSource.addFeatureListener(org.geotools.data.FeatureListener)
public void removeFeatureListener(FeatureListener listener)
removeFeatureListener
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
listener
- FeatureSource.removeFeatureListener(org.geotools.data.FeatureListener)
public Transaction getTransaction()
For a plain JDBCFeatureSource that cannot modify this will always be Transaction.AUTO_COMMIT.
public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Query request) throws IOException
Various queries can be made against the results, the most basic being to retrieve Features.
getFeatures
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
request
-
IOException
FeatureSource.getFeatures(org.geotools.data.Query)
public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures(Filter filter) throws IOException
getFeatures
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
filter
- DOCUMENT ME!
IOException
- DOCUMENT ME!public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatures() throws IOException
getFeatures
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
IOException
- DOCUMENT ME!public ReferencedEnvelope getBounds() throws IOException
Currently returns null, consider getFeatures().getBounds() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getBounds
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
IOException
- DOCUMENT ME!public ReferencedEnvelope getBounds(Query query) throws IOException
Currently returns null, consider getFeatures( query ).getBounds() instead.
Subclasses may override this method to perform the appropriate optimization for this result.
getBounds
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
query
- Query we are requesting the bounds of
IOException
- DOCUMENT ME!public int getCount(Query query) throws IOException
SQL: SELECT COUNT(*) as cnt FROM table WHERE filter
getCount
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
query
- Query we are requesting the count of
IOException
- if there are errors getting the countpublic int count(Query query, Transaction transaction) throws IOException
Note this is a low level SQL statement and if it fails the provided Transaction will be rolled back.
SQL: SELECT COUNT(*) as cnt FROM table WHERE filter
query
- transaction
-
IOException
- Usual on the basis of a filter errorpublic SimpleFeatureType getSchema()
getSchema
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
FeatureSource.getSchema()
protected Connection getConnection() throws IOException
IOException
protected void close(Connection conn, Transaction trans, SQLException sqle)
protected void close(ResultSet rs)
protected void close(Statement statement)
public Set getSupportedHints()
getSupportedHints
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
RenderingHints#Key
objects (eventually empty, never null).public QueryCapabilities getQueryCapabilities()
For instance, the capabilities returned:
getQueryCapabilities
in interface FeatureSource<SimpleFeatureType,SimpleFeature>
FeatureSource.getQueryCapabilities()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |