org.h2gis.h2spatial
Class CreateSpatialExtension

java.lang.Object
  extended by org.h2gis.h2spatial.CreateSpatialExtension

public class CreateSpatialExtension
extends Object

Add spatial features to an H2 database Execute the following sql to init spatial features :

 CREATE ALIAS IF NOT EXISTS SPATIAL_INIT FOR
      "CreateSpatialExtension.initSpatialExtension";
 CALL SPATIAL_INIT();
 

Author:
Erwan Bocher, Nicolas Fortin

Field Summary
static String GEOMETRY_BASE_TYPE
          H2 base type for geometry column ResultSetMetaData.getColumnTypeName(int)
 
Constructor Summary
CreateSpatialExtension()
           
 
Method Summary
static void disposeSpatialExtension(Connection connection)
          Remove spatial type and functions from the current connection.
static String getAlias(Function function)
           
static Function[] getBuiltInsFunctions()
           
static DomainInfo[] getBuiltInsType()
           
static void initSpatialExtension(Connection connection)
          Register GEOMETRY type and register spatial functions
static void initSpatialExtension(Connection connection, String BundleSymbolicName, String BundleVersion)
          Register GEOMETRY type and register spatial functions
static void registerFunction(Statement st, Function function, String packagePrepend)
          Create java code to add function copy paste into GeoSpatialFunctionsAddRemove to upload it
static void registerFunction(Statement st, Function function, String packagePrepend, boolean dropAlias)
          Create java code to add function copy paste into GeoSpatialFunctionsAddRemove to upload it
static void registerGeometryType(Connection connection)
          Register geometry type in an OSGi environment
static void registerSpatialTables(Connection connection)
          Register view in order to create GEOMETRY_COLUMNS standard table.
static void unRegisterFunction(Statement st, Function function)
          Remove the specified function from the provided DataBase connection
static void unRegisterGeometryType(Connection connection)
          Release geometry type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GEOMETRY_BASE_TYPE

public static final String GEOMETRY_BASE_TYPE
H2 base type for geometry column ResultSetMetaData.getColumnTypeName(int)

See Also:
Constant Field Values
Constructor Detail

CreateSpatialExtension

public CreateSpatialExtension()
Method Detail

getBuiltInsFunctions

public static Function[] getBuiltInsFunctions()
Returns:
instance of all built-ins functions

getBuiltInsType

public static DomainInfo[] getBuiltInsType()
Returns:
instance of all spatial built-ins field type

initSpatialExtension

public static void initSpatialExtension(Connection connection,
                                        String BundleSymbolicName,
                                        String BundleVersion)
                                 throws SQLException
Register GEOMETRY type and register spatial functions

Parameters:
connection - Active H2 connection
BundleSymbolicName - OSGi Bundle symbolic name
BundleVersion - OSGi Bundle version
Throws:
SQLException

initSpatialExtension

public static void initSpatialExtension(Connection connection)
                                 throws SQLException
Register GEOMETRY type and register spatial functions

Parameters:
connection - Active H2 connection
Throws:
SQLException

registerGeometryType

public static void registerGeometryType(Connection connection)
                                 throws SQLException
Register geometry type in an OSGi environment

Parameters:
connection - Active H2 connection
Throws:
SQLException

registerSpatialTables

public static void registerSpatialTables(Connection connection)
                                  throws SQLException
Register view in order to create GEOMETRY_COLUMNS standard table.

Parameters:
connection - Open connection
Throws:
SQLException

unRegisterGeometryType

public static void unRegisterGeometryType(Connection connection)
                                   throws SQLException
Release geometry type

Parameters:
connection - Active h2 connection with DROP DOMAIN and DROP ALIAS rights
Throws:
SQLException

registerFunction

public static void registerFunction(Statement st,
                                    Function function,
                                    String packagePrepend)
                             throws SQLException
Create java code to add function copy paste into GeoSpatialFunctionsAddRemove to upload it

Parameters:
st - SQL Statement
function - Function instance
packagePrepend - For OSGi environment only, use Bundle-SymbolicName:Bundle-Version:
Throws:
SQLException

registerFunction

public static void registerFunction(Statement st,
                                    Function function,
                                    String packagePrepend,
                                    boolean dropAlias)
                             throws SQLException
Create java code to add function copy paste into GeoSpatialFunctionsAddRemove to upload it

Parameters:
st - SQL Statement
function - Function instance
packagePrepend - For OSGi environment only, use Bundle-SymbolicName:Bundle-Version:
dropAlias - Drop alias if exists before define it.
Throws:
SQLException

getAlias

public static String getAlias(Function function)
Parameters:
function - Function instance
Returns:
the function ALIAS, name of the function in SQL engine

unRegisterFunction

public static void unRegisterFunction(Statement st,
                                      Function function)
                               throws SQLException
Remove the specified function from the provided DataBase connection

Parameters:
st - Active statement
function - function to remove
Throws:
SQLException

disposeSpatialExtension

public static void disposeSpatialExtension(Connection connection)
                                    throws SQLException
Remove spatial type and functions from the current connection.

Parameters:
connection - Active H2 connection with DROP ALIAS rights
Throws:
SQLException


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.