org.datanucleus.store.rdbms.mapping.mysql
Class MySQLSpatialRDBMSMapping

java.lang.Object
  extended by org.datanucleus.store.rdbms.mapping.RDBMSMapping
      extended by org.datanucleus.store.rdbms.mapping.mysql.MySQLSpatialRDBMSMapping
All Implemented Interfaces:
org.datanucleus.store.mapped.mapping.DatastoreMapping
Direct Known Subclasses:
GeometryRDBMSMapping, GeometryRDBMSMapping, JGeometryRDBMSMapping

public abstract class MySQLSpatialRDBMSMapping
extends org.datanucleus.store.rdbms.mapping.RDBMSMapping

Abstract base class for all MySQL spatial mappings. Contains helper methods that convert WKB (Well Known Binary) data to MySQL spatial objects and vice versa.


Field Summary
protected static int SRID_LENGTH
           
 
Fields inherited from class org.datanucleus.store.rdbms.mapping.RDBMSMapping
column, LOCALISER, LOCALISER_STORE, mapping, storeMgr
 
Constructor Summary
MySQLSpatialRDBMSMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping, org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.store.mapped.DatastoreField field)
           
MySQLSpatialRDBMSMapping(org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
           
 
Method Summary
protected  void initialize()
           
protected  int mysqlBinaryToSrid(byte[] mysqlBinary)
          Extracts the SRID of a spatial object in MySQL binary format.
protected  byte[] mysqlBinaryToWkb(byte[] mysqlBinary)
          Converts a spatial object from MySQL binary format to WKB.
protected  byte[] wkbToMysqlBinary(byte[] wkb, int srid)
          Converts a spatial object from WKB to MySQL binary format.
 
Methods inherited from class org.datanucleus.store.rdbms.mapping.RDBMSMapping
equals, failureMessage, getBoolean, getByte, getChar, getColumn, getDatabaseAdapter, getDatastoreField, getDouble, getFloat, getInsertionInputParameter, getInt, getJavaTypeMapping, getLong, getObject, getShort, getString, getTypeInfo, getUpdateInputParameter, hashCode, includeInFetchStatement, initTypeInfo, insertValuesOnInsert, isBitBased, isBooleanBased, isDecimalBased, isIntegerBased, isNullable, isStringBased, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setObject, setShort, setString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SRID_LENGTH

protected static final int SRID_LENGTH
See Also:
Constant Field Values
Constructor Detail

MySQLSpatialRDBMSMapping

public MySQLSpatialRDBMSMapping(org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
                                org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                                org.datanucleus.store.mapped.DatastoreField field)

MySQLSpatialRDBMSMapping

public MySQLSpatialRDBMSMapping(org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                                org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping)
Method Detail

initialize

protected void initialize()

mysqlBinaryToWkb

protected byte[] mysqlBinaryToWkb(byte[] mysqlBinary)
                           throws java.sql.SQLException
Converts a spatial object from MySQL binary format to WKB.

Parameters:
mysqlBinary - A spatial object in MySQL binary format.
Returns:
The spatial object as WKB.
Throws:
java.sql.SQLException - If the object contains invalid data.

mysqlBinaryToSrid

protected int mysqlBinaryToSrid(byte[] mysqlBinary)
                         throws java.sql.SQLException
Extracts the SRID of a spatial object in MySQL binary format.

Parameters:
mysqlBinary - A spatial object in MySQL binary format.
Returns:
The SRID
Throws:
java.sql.SQLException - If the object contains invalid data.

wkbToMysqlBinary

protected byte[] wkbToMysqlBinary(byte[] wkb,
                                  int srid)
                           throws java.sql.SQLException
Converts a spatial object from WKB to MySQL binary format.

Parameters:
wkb - A spatial object in WKB format.
srid - The SRID of the spatial object.
Returns:
The spatial object in MySQL binary format.
Throws:
java.sql.SQLException - If the object contains invalid data.


Copyright © 2009. All Rights Reserved.