org.geotools.data.db2
Class DB2FIDMapperFactory

java.lang.Object
  extended byorg.geotools.data.jdbc.fidmapper.DefaultFIDMapperFactory
      extended byorg.geotools.data.db2.DB2FIDMapperFactory
All Implemented Interfaces:
FIDMapperFactory

public class DB2FIDMapperFactory
extends DefaultFIDMapperFactory

Overrides DefaultFIDMapperFactory methods for DB2-specific handling.

Author:
David Adler - IBM Corporation

Nested Class Summary
 
Nested classes inherited from class org.geotools.data.jdbc.fidmapper.DefaultFIDMapperFactory
DefaultFIDMapperFactory.ColumnInfo
 
Field Summary
 
Fields inherited from class org.geotools.data.jdbc.fidmapper.DefaultFIDMapperFactory
returnFIDColumnsAsAttributes
 
Constructor Summary
DB2FIDMapperFactory()
          Default constructor will cause FID columns to be returned as business attributes.
DB2FIDMapperFactory(boolean returnFIDColumnsAsAttributes)
          Constructs a DB2FIDMapperFactory with user specification of whether to return FID columns as business attributes.
 
Method Summary
protected  FIDMapper buildNoPKMapper(java.lang.String schema, java.lang.String tableName, java.sql.Connection connection)
          Returns a DB2NullFIDMapper when there is no primary key.
protected  FIDMapper buildSingleColumnFidMapper0(java.lang.String schema, java.lang.String tableName, java.sql.Connection connection, DefaultFIDMapperFactory.ColumnInfo ci)
          Builds a FID mapper based on a single column primary key.
 FIDMapper getMapper(java.lang.String catalog, java.lang.String schema, java.lang.String tableName, java.sql.Connection connection)
          Gets the appropriate FIDMapper for the specified table.
protected  boolean isAutoIncrement(java.lang.String catalog, java.lang.String schema, java.lang.String tableName, java.sql.Connection conn, java.sql.ResultSet tableInfo, java.lang.String columnName, int dataType)
          Determine whether this column is autoincrement.
 
Methods inherited from class org.geotools.data.jdbc.fidmapper.DefaultFIDMapperFactory
buildLastResortFidMapper, buildMultiColumnFIDMapper, buildSingleColumnFidMapper, getColumnInfoList, getMapper, getPkColumnInfo, isIntegralType, isTextType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DB2FIDMapperFactory

public DB2FIDMapperFactory()
Default constructor will cause FID columns to be returned as business attributes.


DB2FIDMapperFactory

public DB2FIDMapperFactory(boolean returnFIDColumnsAsAttributes)
Constructs a DB2FIDMapperFactory with user specification of whether to return FID columns as business attributes.

Parameters:
returnFIDColumnsAsAttributes - true if FID columns should be returned as business attributes.
Method Detail

getMapper

public FIDMapper getMapper(java.lang.String catalog,
                           java.lang.String schema,
                           java.lang.String tableName,
                           java.sql.Connection connection)
                    throws java.io.IOException
Gets the appropriate FIDMapper for the specified table.

Specified by:
getMapper in interface FIDMapperFactory
Overrides:
getMapper in class DefaultFIDMapperFactory
Parameters:
catalog -
schema -
tableName -
connection - the active database connection to get table key information
Returns:
the appropriate FIDMapper for the specified table.
Throws:
java.io.IOException - if any error occurs.

isAutoIncrement

protected boolean isAutoIncrement(java.lang.String catalog,
                                  java.lang.String schema,
                                  java.lang.String tableName,
                                  java.sql.Connection conn,
                                  java.sql.ResultSet tableInfo,
                                  java.lang.String columnName,
                                  int dataType)
                           throws java.sql.SQLException
Determine whether this column is autoincrement. An open connection to the database must be provided.

Overrides:
isAutoIncrement in class DefaultFIDMapperFactory
Parameters:
catalog - not used
schema - not used
tableName - the table name
conn - an open database connection
tableInfo - not used
columnName - the FID column name
dataType - not used
Returns:
true if this is an autoincrement column
Throws:
java.sql.SQLException

buildNoPKMapper

protected FIDMapper buildNoPKMapper(java.lang.String schema,
                                    java.lang.String tableName,
                                    java.sql.Connection connection)
Returns a DB2NullFIDMapper when there is no primary key.

Overrides:
buildNoPKMapper in class DefaultFIDMapperFactory
Parameters:
schema - ignored.
tableName - ignored.
connection - ignored.
Returns:
a DB2NullFIDMapper.

buildSingleColumnFidMapper0

protected FIDMapper buildSingleColumnFidMapper0(java.lang.String schema,
                                                java.lang.String tableName,
                                                java.sql.Connection connection,
                                                DefaultFIDMapperFactory.ColumnInfo ci)
Builds a FID mapper based on a single column primary key. Default version tries the auto-increment way, then a mapping on an MaxIncFIDMapper type for numeric columns, and a plain BasicFIDMapper of text based columns.

Parameters:
schema -
tableName -
connection - not used
ci - the column information
Returns:
a FIDMapper


Copyright © GeoTools. All Rights Reserved.