oracle.sdoapi.adapter
Class AdapterSDO

java.lang.Object
  |
  +--oracle.sdoapi.adapter.AdapterSDO
All Implemented Interfaces:
GeometryAdapter

public class AdapterSDO
extends java.lang.Object
implements GeometryAdapter

This class implements the GeometryAdapter interface for the type MDSYS.SDO_GEOMETRY. It does not support all the geometry types that can be stored in an instance of MDSYS.SDO_GEOMETRY in an Oracle database server. AdapterSDO only supports 2-dimensional geometries. It does not support linearly referenced or 3-D or 4-D geometries. This class is intended solely for the conversion between 2-D instances of MDSYS.SDO_GEOMETRY and Java instances of the Geometry heirarchy support by SDOAPI.


Field Summary
protected  oracle.jdbc.OracleConnection m_conn
           
protected  java.lang.String m_formatName
           
protected  java.lang.String m_formatVersion
           
protected  GeometryFactory m_gF
           
protected  oracle.sdoapi.adapter.SDOTemplateFactory m_sOTF
           
protected  SRManager m_srManager
           
protected  java.lang.Class[] m_supportedInputTypes
           
protected  java.lang.Class[] m_supportedOutputTypes
           
protected  java.lang.Class[] m_supportedPassthroughOutputTypes
           
 
Constructor Summary
AdapterSDO(java.sql.Connection connection)
          Deprecated.  
AdapterSDO(GeometryFactory gF1, java.sql.Connection connection)
          Deprecated.  
AdapterSDO(GeometryFactory gF1, oracle.jdbc.OracleConnection connection)
          Constructs an AdapterSDO instance given a GeometryFactory and an OracleConnection (oracle.jdbc.OracleConnection).
AdapterSDO(oracle.jdbc.OracleConnection connection)
          Constructs an instance of AdapterSDO given an OracleConnection.
 
Method Summary
 java.lang.Object exportGeometry(java.lang.Class outputFormat, Geometry geom)
          Creates a STRUCT from an instance of Geometry.
 void exportGeometry(java.lang.Object outputObject, Geometry geom)
          Converts a Geometry object to an object of the specified output class.
 oracle.jdbc.OracleConnection getConnection()
          Gets the Oracle JDBC Connection instance.
 SpatialReference getDefaultSRS()
          Gets the default Spatial Reference System.
 java.lang.String getFormatName()
          Gets the format name (which is "SDO").
 java.lang.String getFormatVersion()
          Gets the format version.
 java.lang.Class[] getSupportedInputTypes()
          Gets the supported input types.
 java.lang.Class[] getSupportedOutputTypes()
          Gets the supported output types.
 java.lang.Class[] getSupportedPassthroughOutputTypes()
          Gets the supported pass through output types.
 Geometry importGeometry(java.lang.Object iObject)
          Creates a Geometry instance from a STRUCT
 Geometry importGeometry(java.lang.Object iObject, int nDim)
          Creates a Geometry instance from a STRUCT
 boolean inputTypeSupported(java.lang.Class inputFormat)
          Returns true if the input Class is supported and false otherwise.
 boolean outputTypeSupported(java.lang.Class outputFormat)
          Returns true if the output Class is supported and false otherwise.
 boolean passthroughOutputTypeSupported(java.lang.Class outputFormat)
          Returns true if the pass through output Class is supported and false otherwise.
 void setConnection(oracle.jdbc.OracleConnection conn)
          Sets the Oracle JDBC Connection.
 void setDefaultSRS(SpatialReference srs)
          Sets the default Spatial Reference System.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_supportedInputTypes

protected final java.lang.Class[] m_supportedInputTypes

m_supportedOutputTypes

protected final java.lang.Class[] m_supportedOutputTypes

m_supportedPassthroughOutputTypes

protected final java.lang.Class[] m_supportedPassthroughOutputTypes

m_formatName

protected final java.lang.String m_formatName

m_formatVersion

protected final java.lang.String m_formatVersion

m_sOTF

protected oracle.sdoapi.adapter.SDOTemplateFactory m_sOTF

m_gF

protected GeometryFactory m_gF

m_srManager

protected SRManager m_srManager

m_conn

protected oracle.jdbc.OracleConnection m_conn
Constructor Detail

AdapterSDO

public AdapterSDO(GeometryFactory gF1,
                  java.sql.Connection connection)
           throws java.sql.SQLException
Deprecated.  

Constructs an AdapterSDO instance given a GeometryFactory and a Connection (java.sql.Connection) that is actually an instance of oracle.jdbc.OracleConnection. This method is deprecated. Use AdapterSDO(GeometryFactory gF1, OracleConnection connection) instead.

AdapterSDO

public AdapterSDO(GeometryFactory gF1,
                  oracle.jdbc.OracleConnection connection)
           throws java.sql.SQLException
Constructs an AdapterSDO instance given a GeometryFactory and an OracleConnection (oracle.jdbc.OracleConnection). Use AdapterSDO(GeometryFactory gF1, OracleConnection connection) instead.
Parameters:
gF1 - an instance of GeometryFactory
connection - an instance of oracle.jdbc.OracleConnection

AdapterSDO

public AdapterSDO(java.sql.Connection connection)
           throws java.sql.SQLException
Deprecated.  

Constructs an instance of AdapterSDO given a Connection that is an instance of OracleConnection. This method is deprecated. Use AdpaterSDO(OracleConnection connection) instead.

AdapterSDO

public AdapterSDO(oracle.jdbc.OracleConnection connection)
           throws java.sql.SQLException
Constructs an instance of AdapterSDO given an OracleConnection. It creates a default GeometryFactory instance that has an empty spatial reference system (MDSYS.SDO_SRID = NULL) associated with it.
Method Detail

exportGeometry

public java.lang.Object exportGeometry(java.lang.Class outputFormat,
                                       Geometry geom)
                                throws GeometryOutputTypeNotSupportedException,
                                       InvalidGeometryException
Creates a STRUCT from an instance of Geometry.
Specified by:
exportGeometry in interface GeometryAdapter
Parameters:
outputFormat - Must be STRUCT.class. This is the only supported output format.
geom - an instance of Geometry

exportGeometry

public void exportGeometry(java.lang.Object outputObject,
                           Geometry geom)
                    throws GeometryOutputTypeNotSupportedException,
                           InvalidGeometryException
Description copied from interface: GeometryAdapter
Converts a Geometry object to an object of the specified output class. There are two signatures of this function. This signature lets the caller specify an output object. The output of the conversion will be written to the specified object. If a Geometry is converted to some text format (such as XML), then the output type might be OutputStream. Using an already existing object for output adds flexibility. This is also a straightforward way to write several converted Geometries into a single object (such as a stream).

If the output of the conversion is needed in a new object, the other signature exportGeometry(Class, Geometry) might be more convenient.

Specified by:
exportGeometry in interface GeometryAdapter

importGeometry

public Geometry importGeometry(java.lang.Object iObject)
                        throws GeometryInputTypeNotSupportedException,
                               InvalidGeometryException
Creates a Geometry instance from a STRUCT
Specified by:
importGeometry in interface GeometryAdapter
Parameters:
iObject - An instance of STRUCT (oracle.sql.STRUCT)

importGeometry

public Geometry importGeometry(java.lang.Object iObject,
                               int nDim)
                        throws GeometryInputTypeNotSupportedException,
                               InvalidGeometryException
Creates a Geometry instance from a STRUCT
Specified by:
importGeometry in interface GeometryAdapter
Parameters:
iObject - An instance of STRUCT (oracle.sql.STRUCT)
nDim - the dimensionality of the geometry. This release only supports 2-dimensional geometries.

inputTypeSupported

public boolean inputTypeSupported(java.lang.Class inputFormat)
Returns true if the input Class is supported and false otherwise. The only supported input format Class is STRUCT.class.
Specified by:
inputTypeSupported in interface GeometryAdapter

outputTypeSupported

public boolean outputTypeSupported(java.lang.Class outputFormat)
Returns true if the output Class is supported and false otherwise. The only supported output format Class is STRUCT.class.
Specified by:
outputTypeSupported in interface GeometryAdapter

passthroughOutputTypeSupported

public boolean passthroughOutputTypeSupported(java.lang.Class outputFormat)
Returns true if the pass through output Class is supported and false otherwise. None are supported in this implementation; that is, AdapterSDO does not support any pass through output type.
Specified by:
passthroughOutputTypeSupported in interface GeometryAdapter

getSupportedInputTypes

public java.lang.Class[] getSupportedInputTypes()
Gets the supported input types.
Specified by:
getSupportedInputTypes in interface GeometryAdapter

getSupportedOutputTypes

public java.lang.Class[] getSupportedOutputTypes()
Gets the supported output types.
Specified by:
getSupportedOutputTypes in interface GeometryAdapter

getSupportedPassthroughOutputTypes

public java.lang.Class[] getSupportedPassthroughOutputTypes()
Gets the supported pass through output types. None are supported in this implementation. Hence, an empty array is returned.
Specified by:
getSupportedPassthroughOutputTypes in interface GeometryAdapter

getFormatName

public java.lang.String getFormatName()
Gets the format name (which is "SDO").
Specified by:
getFormatName in interface GeometryAdapter

getFormatVersion

public java.lang.String getFormatVersion()
Gets the format version. The format version returned is "8.1.6". This implementation however works for 2-D non linear referenced SDO_GEOMETRY instances from Oracle server versions 8.1.6.x.x, 8.1.7.x.x, and 9.0.1.x.x.
Specified by:
getFormatVersion in interface GeometryAdapter

setDefaultSRS

public void setDefaultSRS(SpatialReference srs)
Sets the default Spatial Reference System.
Specified by:
setDefaultSRS in interface GeometryAdapter
Parameters:
srs - a SpatialReference instance

getDefaultSRS

public SpatialReference getDefaultSRS()
Gets the default Spatial Reference System.
Specified by:
getDefaultSRS in interface GeometryAdapter

setConnection

public void setConnection(oracle.jdbc.OracleConnection conn)
                   throws java.sql.SQLException
Sets the Oracle JDBC Connection.
Parameters:
conn - the OracleConnection

getConnection

public oracle.jdbc.OracleConnection getConnection()
Gets the Oracle JDBC Connection instance.