|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.jdo.spatial.SpatialHelper
public class SpatialHelper
Helper class to search and access Spatial MetaData. This class wraps some of the spatial functions that JPOX-Spatial offers via JDOQL in "real" Java methods and also adds extended functionality, like reading values from JDO-Metadata and getting CRS (Coordinate Reference System) information from the database.
The datatypes and terminology used in this class is (like most of JPOX-Spatial) heavily based on OGC's Simple Feature specification. See http://www.opengeospatial.org/standards/sfa for details.
| Nested Class Summary | |
|---|---|
protected class |
SpatialHelper.QueryExecutor
Abstract helper class to execute queries. |
| Field Summary | |
|---|---|
protected org.datanucleus.jdo.JDOPersistenceManagerFactory |
pmf
|
protected org.datanucleus.store.mapped.MappedStoreManager |
storeMgr
|
| Constructor Summary | |
|---|---|
SpatialHelper(org.datanucleus.jdo.JDOPersistenceManagerFactory pmf)
Creates a new SpatialHelper instance for the given PMF. |
|
| Method Summary | |
|---|---|
java.awt.geom.Rectangle2D |
calculateBoundsInDatastore(java.lang.Class pc,
java.lang.String fieldName)
|
java.awt.geom.Rectangle2D |
calculateBoundsInDatastore(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
|
protected void |
checkValid(java.lang.Class pc,
java.lang.String fieldName)
|
java.awt.geom.Rectangle2D |
estimateBoundsFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName)
Returns the (estimated) spatial extent, also called bounding box from datastore metadata for the given geometry field. |
java.awt.geom.Rectangle2D |
estimateBoundsFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
Returns the (estimated) spatial extent, also called bounding box from datastore metadata for the given geometry field. |
protected SpatialRDBMSAdapter |
getAdapter()
|
protected org.datanucleus.store.rdbms.table.Column |
getColumn(java.lang.Class pc,
org.datanucleus.metadata.AbstractMemberMetaData mmd)
|
protected org.datanucleus.store.rdbms.table.Column |
getColumn(java.lang.Class pc,
java.lang.String fieldName)
|
java.lang.String |
getCrsNameForSrid(java.lang.Class pc,
int srid)
Returns the name of the Coordinate Reference System (CRS) for the given srid. |
java.lang.String |
getCrsNameForSrid(java.lang.Class pc,
int srid,
javax.jdo.PersistenceManager pm)
Returns the name of the Coordinate Reference System (CRS) for the given srid. |
java.lang.String |
getCrsWktForSrid(java.lang.Class pc,
int srid)
Returns a description of the Coordinate Reference System (CRS) for the given srid in WKT (Well-Known Text). |
java.lang.String |
getCrsWktForSrid(java.lang.Class pc,
int srid,
javax.jdo.PersistenceManager pm)
Returns the description of the Coordinate Reference System (CRS) for the given srid in WKT (Well-Known Text). |
java.lang.Integer |
getDimensionFromJdoMetadata(java.lang.Class pc,
java.lang.String fieldName)
Returns the dimension from JDO-Metadata for the given geometry field. |
java.lang.String[] |
getGeometryColumnBackedFields(java.lang.Class pc)
Return all field names of the given class that are backed by a geometry column in the database. |
protected java.lang.Integer |
getIntegerFromJdoMetadata(java.lang.Class pc,
java.lang.String fieldName,
java.lang.String extensionKey)
|
protected org.datanucleus.metadata.MetaDataManager |
getMetaDataManager()
|
java.lang.Integer |
getSridFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName)
Returns the srid from datastore metadata for the given geometry field. |
java.lang.Integer |
getSridFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
Returns the srid from datastore metadata for the given geometry field. |
java.lang.Integer |
getSridFromJdoMetadata(java.lang.Class pc,
java.lang.String fieldName)
Returns the srid from JDO-Metadata for the given geometry field. |
protected org.datanucleus.store.rdbms.table.Table |
getTable(java.lang.Class pc)
|
protected java.lang.String |
getValueFromJdoMetadata(java.lang.Class pc,
java.lang.String memberName,
java.lang.String extensionKey)
|
boolean |
isGeometryColumnBackedField(java.lang.Class pc,
java.lang.String fieldName)
Checks whether the given field name for the given class is backed by a geometry column in the database. |
protected boolean |
isGeometryColumnBackedField(org.datanucleus.store.rdbms.table.Column c)
|
protected java.lang.Object |
readFirstValueForField(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.datanucleus.jdo.JDOPersistenceManagerFactory pmf
protected org.datanucleus.store.mapped.MappedStoreManager storeMgr
| Constructor Detail |
|---|
public SpatialHelper(org.datanucleus.jdo.JDOPersistenceManagerFactory pmf)
SpatialHelper instance for the given PMF.
pmf - The PMF, can't be null or closed.| Method Detail |
|---|
public java.lang.Integer getSridFromJdoMetadata(java.lang.Class pc,
java.lang.String fieldName)
null, if the user has not specified a value in his metadata.
pc - The PersistenceCapapable classfieldName - Name of the geometry field
null.SpatialRDBMSAdapter.SRID_EXTENSION_KEY
public java.lang.Integer getDimensionFromJdoMetadata(java.lang.Class pc,
java.lang.String fieldName)
null, if the user has not specified a value in his metadata.
pc - The PersistenceCapapable classfieldName - Name of the geometry field
null.SpatialRDBMSAdapter.DIMENSION_EXTENSION_KEY
public java.lang.Integer getSridFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName)
null, if the datastore doesn't support such an operation (e.g. MySQL)
or if there is no metadata in the datastore available for the given class and field
name. Creates a new PersistenceManager to execute the query on the
datastore.
pc - The PersistenceCapable classfieldName - Name of the geometry field
null.
public java.lang.Integer getSridFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
null, if the datastore doesn't support such an operation (e.g. MySQL)
or if there is no metadata in the datastore available for the given class and field
name.
pc - The PersistenceCapable classfieldName - Name of the geometry fieldpm - PersistenceManager instance that should be used
to access the datastore
null.
public java.awt.geom.Rectangle2D estimateBoundsFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName)
null,
if the datastore doesn't support such an operation (e.g. MySQL) or if there is
no metadata in the datastore available for the given class and field name.
Creates a new PersistenceManager to execute the query on the
datastore.
pc - The PersistenceCapable classfieldName - Name of the geometry field
null.
public java.awt.geom.Rectangle2D estimateBoundsFromDatastoreMetadata(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
Returns the (estimated) spatial extent, also called bounding box from
datastore metadata for the given geometry field. Will return null,
if the datastore doesn't support such an operation (e.g. MySQL) or if there is
no metadata in the datastore available for the given class and field name.
pc - The PersistenceCapable classfieldName - Name of the geometry fieldpm - PersistenceManager instance that should be used
to access the datastore
null.
public java.awt.geom.Rectangle2D calculateBoundsInDatastore(java.lang.Class pc,
java.lang.String fieldName)
public java.awt.geom.Rectangle2D calculateBoundsInDatastore(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
public java.lang.String getCrsWktForSrid(java.lang.Class pc,
int srid)
throws java.sql.SQLException
null, if the datastore
doesn't support such an operation (e.g. MySQL) or if there is no metadata in
the datastore available for the given class and srid. Creates a new
PersistenceManager to execute the query on the datastore.
pc - The PersistenceCapable classsrid - The srid
null.
java.sql.SQLException
public java.lang.String getCrsWktForSrid(java.lang.Class pc,
int srid,
javax.jdo.PersistenceManager pm)
null, if the datastore
doesn't support such an operation (e.g. MySQL) or if there is no metadata in
the datastore available for the given class and srid.
pc - The PersistenceCapable classsrid - The sridpm - PersistenceManager instance that should be used
to access the datastore
null.
public java.lang.String getCrsNameForSrid(java.lang.Class pc,
int srid)
throws java.sql.SQLException
null, if the datastore doesn't support such an
operation (e.g. MySQL) or if there is no metadata in the datastore available
for the given class and srid. Creates a new PersistenceManager
to execute the query on the datastore.
pc - The PersistenceCapable classsrid - The srid
null.
java.sql.SQLException
public java.lang.String getCrsNameForSrid(java.lang.Class pc,
int srid,
javax.jdo.PersistenceManager pm)
null, if the datastore doesn't support such an
operation (e.g. MySQL) or if there is no metadata in the datastore available
for the given class and srid.
pc - The PersistenceCapable classsrid - The sridpm - PersistenceManager instance that should be used
to access the datastore
null.
protected java.lang.Integer getIntegerFromJdoMetadata(java.lang.Class pc,
java.lang.String fieldName,
java.lang.String extensionKey)
protected java.lang.String getValueFromJdoMetadata(java.lang.Class pc,
java.lang.String memberName,
java.lang.String extensionKey)
public java.lang.String[] getGeometryColumnBackedFields(java.lang.Class pc)
pc - The PersistenceCapable class
null.
public boolean isGeometryColumnBackedField(java.lang.Class pc,
java.lang.String fieldName)
pc - The PersistenceCapable classfieldName - Name of the field
true, if the field is backed by
a geometry column, false otherwise.protected boolean isGeometryColumnBackedField(org.datanucleus.store.rdbms.table.Column c)
protected org.datanucleus.store.rdbms.table.Table getTable(java.lang.Class pc)
protected org.datanucleus.store.rdbms.table.Column getColumn(java.lang.Class pc,
java.lang.String fieldName)
protected org.datanucleus.store.rdbms.table.Column getColumn(java.lang.Class pc,
org.datanucleus.metadata.AbstractMemberMetaData mmd)
protected SpatialRDBMSAdapter getAdapter()
throws java.lang.ClassCastException
java.lang.ClassCastExceptionprotected org.datanucleus.metadata.MetaDataManager getMetaDataManager()
protected void checkValid(java.lang.Class pc,
java.lang.String fieldName)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.NullPointerException
protected java.lang.Object readFirstValueForField(java.lang.Class pc,
java.lang.String fieldName,
javax.jdo.PersistenceManager pm)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||