Dear geotools developers,

I'm developing an extension to link H2GIS -  H2 database with Geoserver. 
The code source is available here 
https://github.com/ebocher/geoserver-h2gis/tree/H2gis_linkedTable.

Because H2 database supports linked table and H2GIS uses this custom 
file system to link geospatial file as shapefile (see an example here 
http://www.h2gis.org/docs/dev/FILE_TABLE/), I'd like to find a way to 
set the table types supported by the H2 database.

If I'm not wrong this requirement can be solved with two single changes :

1. Add a method in SQLDialect to specify the desired tables

/**
      * @return Table types filtered from jdbc {@link DatabaseMetaData}
      */
     public String[] getDesiredTablesType() {
         return new String[]{"TABLE", "VIEW", "MATERIALIZED VIEW", 
"SYNONYM"};
     }

2. Change JDBCDataStore to use the method getDesiredTablesType()

In createTypeNames{...

  DatabaseMetaData metaData = cx.getMetaData();

  ResultSet tables = metaData.getTables(null, 
escapeNamePattern(metaData, databaseSchema),
                     "%", dialect.getDesiredTablesType());

}

When the developer wants to add custom table types, just overwrite like this

  @Override
     public String[] getDesiredTablesType() {
         return new String[]{"TABLE", "VIEW", "MATERIALIZED VIEW", 
"SYNONYM", "TABLE LINK", "EXTERNAL"};
     }

I have added an example here 
https://github.com/ebocher/geoserver-h2gis/blob/H2gis_linkedTable/src/main/java/org/orbisgis/geoserver/h2gis/datastore/H2GISDialect.java

Ihope it's clear.

Thanks in advance for any comments.

Erwan



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to