org.geotools.arcsde.data
Class ViewRegisteringFactoryHelper

Object
  extended by ViewRegisteringFactoryHelper

public class ViewRegisteringFactoryHelper
extends Object

Utility class to help DataStoreFactories for org.geotools.data.sql.SqlDataStores register the views provided in a 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

Author:
Gabriel Roldan, Axios Engineering
Module:

Method Summary
static Map cleanUpViewDefinitions(Map 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 params)
          Registers the sql views provided in params on the SqlDataStore dataStore
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerSqlViews

public static void registerSqlViews(ArcSDEDataStore dataStore,
                                    Map params)
                             throws IOException
Registers the sql views provided in params on the SqlDataStore dataStore

Parameters:
dataStore -
params -
Throws:
IOException

cleanUpViewDefinitions

public static Map cleanUpViewDefinitions(Map 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.

Parameters:
params -
Returns:

parseSqlQuery

public static PlainSelect parseSqlQuery(String selectStatement)
                                 throws IOException
Throws:
IOException


Copyright © 1996-2010 Geotools. All Rights Reserved.