|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectContentFeatureSource
JDBCFeatureSource
JoiningJDBCFeatureSource
public class JoiningJDBCFeatureSource
This is where the magic happens. The Joining JDBC Feature Source is a "hacking" class rather than a proper subclass. It provides functionality for executing 'joining queries'. Because only simple features can be returned by the existing geotools database logic, these joins on the db are not used for linking the actual features together, but only for putting the simple features in a certain order; an order that will allow us to do the actual feature chaining faster when we are building the complex features, because the right features will already be lined up in the right order.
Nested Class Summary | |
---|---|
protected class |
JoiningJDBCFeatureSource.JoiningFieldEncoder
Field Encoder for converting Filters/Expressions to SQL, will encode table name with field |
Field Summary | |
---|---|
static String |
FOREIGN_ID
|
static String |
PRIMARY_KEY
|
Fields inherited from class ContentFeatureSource |
---|
entry, hints, lock, query, queryCapabilities, schema, transaction |
Constructor Summary | |
---|---|
JoiningJDBCFeatureSource(JDBCFeatureSource featureSource)
|
|
JoiningJDBCFeatureSource(JDBCFeatureStore featureStore)
|
Method Summary | |
---|---|
protected void |
addMultiValuedSort(String tableName,
Set<String> orderByFields,
JoiningQuery.QueryJoin join,
StringBuffer sql)
|
protected static String |
createAlias(String typeName,
Set<String> tableNames)
|
protected FilterToSQL |
createFilterToSQL(SimpleFeatureType ft)
Craete the filter to sql converter |
void |
encodeColumnName(String colName,
String typeName,
StringBuffer sql,
Hints hints)
Encode column name with table name included. |
void |
encodeColumnName2(String colName,
String typeName,
StringBuffer sql,
Hints hints)
Encode column name with table name included, but do not include schema name (for aliases) |
protected void |
encodeGeometryColumn(GeometryDescriptor gatt,
String typeName,
StringBuffer sql,
Hints hints)
Encoding a geometry column with respect to hints Supported Hints are provided by SQLDialect.addSupportedHints(Set) |
protected SimpleFeatureType |
getFeatureType(SimpleFeatureType origType,
JoiningQuery query)
|
protected FeatureReader<SimpleFeatureType,SimpleFeature> |
getJoiningReaderInternal(JoiningQuery query)
|
protected FeatureReader<SimpleFeatureType,SimpleFeature> |
getReaderInternal(Query query)
Subclass method for returning a native reader from the datastore. |
protected Query |
joinQuery(Query query)
Convenience method for joining a query with the definining query of the feature source. |
protected Query |
resolvePropertyNames(Query query)
This method changes the query object so that all propertyName references are resolved to simple attribute names against the schema of the feature source. |
protected String |
selectSQL(SimpleFeatureType featureType,
JoiningQuery query,
AtomicReference<PreparedFilterToSQL> toSQLref)
Generates a 'SELECT p1, p2, ... |
protected PreparedStatement |
selectSQLPS(SimpleFeatureType featureType,
JoiningQuery query,
Connection cx)
Generates a 'SELECT p1, p2, ... |
protected void |
sort(JoiningQuery query,
StringBuffer sql,
String[] aliases,
Set<String> pkColumnNames)
Creates ORDER BY for joining query, based on all the sortby's that are specified per joining table |
protected void |
sort(String typeName,
String alias,
SortBy[] sort,
Set<String> orderByFields,
StringBuffer sql)
Create order by field for specific table name |
Methods inherited from class JDBCFeatureSource |
---|
addHints, buildFeatureType, buildQueryCapabilities, canFilter, canLimit, canOffset, canRetype, canSort, canTransact, getBoundsInternal, getCountInternal, getDataStore, getPrimaryKey, getState, handleVisitor, isExposePrimaryKeyColumns, setExposePrimaryKeyColumns |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String FOREIGN_ID
public static final String PRIMARY_KEY
Constructor Detail |
---|
public JoiningJDBCFeatureSource(JDBCFeatureSource featureSource) throws IOException
IOException
public JoiningJDBCFeatureSource(JDBCFeatureStore featureStore) throws IOException
IOException
Method Detail |
---|
protected void encodeGeometryColumn(GeometryDescriptor gatt, String typeName, StringBuffer sql, Hints hints) throws SQLException
SQLDialect.addSupportedHints(Set)
gatt
- sql
- hints
- , may be null
SQLException
protected void sort(String typeName, String alias, SortBy[] sort, Set<String> orderByFields, StringBuffer sql) throws IOException, SQLException
typeName
- alias
- sort
- orderByFields
-
IOException
SQLException
protected void addMultiValuedSort(String tableName, Set<String> orderByFields, JoiningQuery.QueryJoin join, StringBuffer sql) throws IOException, FilterToSQLException, SQLException
IOException
FilterToSQLException
SQLException
protected void sort(JoiningQuery query, StringBuffer sql, String[] aliases, Set<String> pkColumnNames) throws IOException, SQLException, FilterToSQLException
query
- sql
-
IOException
SQLException
FilterToSQLException
public void encodeColumnName(String colName, String typeName, StringBuffer sql, Hints hints) throws SQLException
colName
- typeName
- sql
- hints
-
SQLException
public void encodeColumnName2(String colName, String typeName, StringBuffer sql, Hints hints) throws SQLException
colName
- typeName
- sql
- hints
-
SQLException
protected FilterToSQL createFilterToSQL(SimpleFeatureType ft)
ft
-
protected static String createAlias(String typeName, Set<String> tableNames)
protected String selectSQL(SimpleFeatureType featureType, JoiningQuery query, AtomicReference<PreparedFilterToSQL> toSQLref) throws IOException, SQLException, FilterToSQLException
featureType
- the feature type that the query must return (may contain less attributes than the
native one)attributes
- the properties queried, or Query.ALL_NAMES
to gather all of themquery
- the query to be run. The type name and property will be ignored, as they are
supposed to have been already embedded into the provided feature typecx
- The database connection to be used to create the prepared statement
SQLException
IOException
FilterToSQLException
protected PreparedStatement selectSQLPS(SimpleFeatureType featureType, JoiningQuery query, Connection cx) throws SQLException, IOException, FilterToSQLException
featureType
- the feature type that the query must return (may contain less
attributes than the native one)attributes
- the properties queried, or Query.ALL_NAMES
to gather
all of themquery
- the query to be run. The type name and property will be ignored, as they are
supposed to have been already embedded into the provided feature typecx
- The database connection to be used to create the prepared
statement
FilterToSQLException
SQLException
IOException
protected SimpleFeatureType getFeatureType(SimpleFeatureType origType, JoiningQuery query) throws IOException
IOException
protected FeatureReader<SimpleFeatureType,SimpleFeature> getJoiningReaderInternal(JoiningQuery query) throws IOException
IOException
protected FeatureReader<SimpleFeatureType,SimpleFeature> getReaderInternal(Query query) throws IOException
ContentFeatureSource
It is important to note that if the native reader intends to handle any of the following natively:
true
:
ContentFeatureSource.canReproject()
- handles Query.getCoordinateSystemReproject()
internally.
Example would be PostGIS using Proj to handle reproejction internallyContentFeatureSource.canFilter()
- handles Query#getFilter() internally.
getReaderInternal
in class JDBCFeatureSource
IOException
protected Query resolvePropertyNames(Query query)
ContentFeatureSource
For example, this method ensures that propertyName's such as "gml:name" are rewritten as simply "name".
resolvePropertyNames
in class ContentFeatureSource
protected Query joinQuery(Query query)
ContentFeatureSource
joinQuery
in class ContentFeatureSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |