public class ViewRegisteringFactoryHelper extends Object
java.util.Map in the call to the factory's
createDataStore(Map) method.
NOTE this class is a rough copy of the one in the sql-datastore unsupported module. We are incorporating it here as don't want to depend on sql-datastore. Thus, it's expected to be replaced by the original once we work out what to do with the sql-datastore module.
Due to the non hierarchical nature of a Map, it is no so easy to provide a variable number of arguments on it for the same keyword, since they're usually read from a .properties file.
This class helps to minimize the work needed to provide such a mapping of various SQL views to an in-process feature type by defining the following structure for a Map<String,String> passed to createDataStore. Example .properties file:
<code>
dbtype=...
<usual datastore's parameters>...
sqlView.1.typeName = ViewType1
sqlView.1.sqlQuery = select gid, the_geom, table2.someField \
from table1, table2 \
where table1.gid = table2.table1_id
sqlView.2.typeName = ViewType2
sqlView.2.sqlQuery = select ...
</code>
This way, this class' utility method #registerSqlViews(SqlDataStore, Map) will
receive a org.geotools.data.sql.SqlDataStore and the Map of datastore factory
parameters and call org.geotools.data.sql.SqlDataStore#registerView(String, String)
for each pair of sqlView.N.typeName, sqlView.N.sqlQuery| Modifier and Type | Method and Description |
|---|---|
static Map<String,Serializable> |
cleanUpViewDefinitions(Map<String,Serializable> params)
Looks up the set of "sqlView.N.typeName" and "sqlView.N.sqlQuery" keys in
params
and returns a cleaned up map of typeName/query. |
static PlainSelect |
parseSqlQuery(String selectStatement) |
static void |
registerSqlViews(ArcSDEDataStore dataStore,
Map<String,Serializable> params)
Registers the sql views provided in
params on the SqlDataStore dataStore
|
public static void registerSqlViews(ArcSDEDataStore dataStore, Map<String,Serializable> params) throws IOException
params on the SqlDataStore dataStore
dataStore - params - IOExceptionpublic static Map<String,Serializable> cleanUpViewDefinitions(Map<String,Serializable> params)
params
and returns a cleaned up map of typeName/query.params - public static PlainSelect parseSqlQuery(String selectStatement) throws IOException
IOExceptionCopyright © 1996–2019 Geotools. All rights reserved.