Class TLcdOracleSpatialModelEncoder

java.lang.Object
com.luciad.format.oracle.spatial.TLcdOracleSpatialModelEncoder
All Implemented Interfaces:
ILcdModelEncoder, Serializable

@LcdService(service=ILcdModelEncoder.class, priority=20000) public class TLcdOracleSpatialModelEncoder extends Object implements ILcdModelEncoder
This ILcdModelEncoder encodes models into Oracle Spatial databases.

A spatial database is accessed based on a set of properties. The properties can be passed in a Properties object, or using a properties file with extension "ora".

The common properties needed to establish a connection and to specify tables, columns, rows, etc. are the same as those for the TLcdOracleSpatialModelDecoder. In addition, the following properties are required:

  • SRID the spatial reference ID for the spatial data.
  • featureDataTypes.0, ...: the SQL data types of the feature columns. Each featureNames.i must have a corresponding featureDataTypes.i.
  • dimensions: the number of dimensions of the geometries in the model. Currently, 2 and 3 dimensional geometries are supported. The default values is 2.
  • bounds: the spatial bounds of the model, specified as a comma-separated list of values: "min_x, min_y, width, height".
  • dropBeforeCreatingTable (optional, default = * false): if set to true, the encoder will * attempt to drop the spatial table before re-creating it.

Example properties file:


 # The basic database connection properties.
 driver    = oracle.jdbc.driver.OracleDriver
 url       = jdbc:oracle:thin:@myhost:1521:LUCIAD
 user      = scott
 password  = tiger

 # The data of interest.
 table     = COUNTRIES
 spatialColumn = GEO

 # The spatial reference ID and the bounds for creating the table.
 SRID = 0
 bounds = 0,10,60,60

 # The feature columns to be decoded.
 featureNames.0 = ID

 # The SQL data types for writing to the table.
 featureDataTypes.0 = INTEGER

 # The index of the feature that can be used as primary key.
 primaryFeatureIndex = 0

 # Optionally close the database connection after each query.
 # Only advisable when using a connection pooling database driver.
 #alwaysCloseConnection = false
 

The encoder supports ILcdShape objects. They are converted to Oracle Spatial objects as follows:

FROM
ILcdShape
TO
Geometry
ILcdPoint Point
ILcdPolypoint GeometryCollection
ILcdPolyline LineString
ILcdPolygon Polygon
ILcdComplexPolygon Polygon
ILcdBounds Rectangle/Box
ILcdCircle CurvePolygon
ILcdShapeList GeometryCollection

Features are retrieved by means of the ILcdFeatured interface, which the objects must implement.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Oracle Spatial model encoder.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canExport(ILcdModel aModel, String aDestinationName)
    Returns whether the given model can be saved into the database described by the given properties file.
    boolean
    Returns whether the given model can be saved back into the database.
    void
    export(ILcdModel aModel, String aDestinationName)
    Exports the given model in a new table, based on the properties in the given file.
    void
    export(ILcdModel aModel, Properties aProperties)
    Exports the given model in a new table, based on the given properties.
    int
    Returns the number of inserted elements after which an export operation is committed.
    Returns a short, displayable name for the format this ILcdModelEncoder encodes to.
    void
    save(ILcdModel aModel)
    Saves the given model in its original location, by committing all changes.
    void
    setAutoCommitCount(int aAutoCommitCount)
    Sets the number of inserted elements after which an export operation should be committed, periodically.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TLcdOracleSpatialModelEncoder

      public TLcdOracleSpatialModelEncoder()
      Creates a new Oracle Spatial model encoder.
  • Method Details

    • setAutoCommitCount

      public void setAutoCommitCount(int aAutoCommitCount)
      Sets the number of inserted elements after which an export operation should be committed, periodically. The default is 0, meaning that the export operation is only committed when all elements have been inserted. A different value can be useful to avoid overflow of database transaction logs.
    • getAutoCommitCount

      public int getAutoCommitCount()
      Returns the number of inserted elements after which an export operation is committed.
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelEncoder
      Returns a short, displayable name for the format this ILcdModelEncoder encodes to.
      Specified by:
      getDisplayName in interface ILcdModelEncoder
      Returns:
      the displayable name of this ILcdModelEncoder.
    • canExport

      public boolean canExport(ILcdModel aModel, String aDestinationName)
      Returns whether the given model can be saved into the database described by the given properties file.
      Specified by:
      canExport in interface ILcdModelEncoder
      Parameters:
      aModel - the model to be verified.
      aDestinationName - the location where the model should be exported to.
      Returns:
      true if this encoder can export the specified model to the specified location, false otherwise.
      See Also:
    • export

      public void export(ILcdModel aModel, String aDestinationName) throws IOException, IllegalArgumentException
      Exports the given model in a new table, based on the properties in the given file.
      Specified by:
      export in interface ILcdModelEncoder
      Parameters:
      aModel - the model to be exported.
      aDestinationName - the properties file describing the database table to be created.
      Throws:
      IOException - for any database access errors. This includes the case where the table already exists.
      IllegalArgumentException - if the model cannot be saved by this encoder (!canExport(aModel, aDestinationName)).
    • export

      public void export(ILcdModel aModel, Properties aProperties) throws IOException, IllegalArgumentException
      Exports the given model in a new table, based on the given properties.
      Parameters:
      aModel - the model to be exported.
      aProperties - the properties describing the database table to be created.
      Throws:
      IOException - for any database access errors. This includes the case where the table already exists.
      IllegalArgumentException
    • canSave

      public boolean canSave(ILcdModel aModel)
      Returns whether the given model can be saved back into the database.
      Specified by:
      canSave in interface ILcdModelEncoder
      Parameters:
      aModel - the model to be verified.
      Returns:
      true if this encoder can save the model in the location where it originally came from, false otherwise.
      See Also:
    • save

      public void save(ILcdModel aModel) throws IOException, IllegalArgumentException
      Saves the given model in its original location, by committing all changes.
      Specified by:
      save in interface ILcdModelEncoder
      Parameters:
      aModel - the database model to be committed.
      Throws:
      IOException - for any database access errors.
      IllegalArgumentException - if the model cannot be saved by this encoder (!canSave(aModel)).