Class TLcdInformixSpatialModelEncoder
- All Implemented Interfaces:
ILcdModelEncoder
,Serializable
ILcdModelEncoder
encodes models into Informix 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 "isd
".
The common properties needed to establish a connection and to specify tables,
columns, rows, etc. are the same as those for the
TLcdInformixSpatialModelDecoder
. In addition, the following
properties are required:
SRID
the spatial reference ID for the spatial data.geometryType
(default = "ST_Geometry
"): the SQL data type of the geometry column, as listed in Appendix F of the IBM Informix Spatial DataBlade Module User's Guide.featureDataTypes.0
, ...: the SQL data types of the feature columns. EachfeatureNames.i
must have a correspondingfeatureDataTypes.i
.dropBeforeCreatingTable
(optional, default = *false
): if set totrue
, the encoder will * attempt to drop the spatial table before re-creating it.
Example properties file:
# The basic database connection properties. driver = com.informix.jdbc.IfxDriver url = jdbc:informix-sqli://alien:1536/sysuser:INFORMIXSERVER=demo user = informix password = informix # The data of interest. table = STATES spatialColumn = GEOM # The feature columns to be decoded. featureNames.0 = ID featureNames.1 = STATE # The index of the feature that can be used as primary key. primaryFeatureIndex = 0 # Optional additional constraints to retrieve a subset of the table. #selectionTables = #selectionFilter = STATE = 'New York' # Optional maximum cache size (expressed as number of objects, default is 100). maxCacheSize = 60 # Optionally close the database connection after each query. # Only advisable when using a connection pooling database driver. #alwaysCloseConnection = false # Additional properties required for creating a new Informix Spatial table. SRID = 0 # Optional geometry type of the geometry column. #geometryType = ST_MultiPolygon # The regular SQL data types of the feature columns. featureDataTypes.0 = NUMERIC(11,3) featureDataTypes.1 = CHAR(20)
The encoder supports ILcdShape
objects. They are converted
to Informix Spatial objects as follows:
FROMILcdShape | TOESRI SHAPE Geometry |
---|---|
ILcd2DEditablePoint | POINT |
ILcd2DEditablePolypoint | MULTI_POINT |
ILcd2DEditablePolyline | POLYLINE |
ILcd2DEditablePolygon | POLYGON |
ILcdComplexPolygon | based on its first element, according to this table |
ILcd3DEditablePoint | POINT_Z |
ILcd3DEditablePolypoint | MULTI_POINT_Z |
ILcd3DEditablePolyline | POLYLINE_Z |
ILcd3DEditablePolygon | POLYGON_Z |
ILcd2DEditablePoint && ILcdSHPMeasure | POINT_M |
ILcd2DEditablePolypoint && ILcdSHPMeasureList | MULTI_POINT_M |
ILcd2DEditablePolyline && ILcdSHPMeasureList | POLYLINE_M |
ILcd2DEditablePolygon && ILcdSHPMeasureList | POLYGON_M |
ILcd3DEditablePoint && ILcdSHPMeasure | POINT_ZM |
ILcd3DEditablePolypoint && ILcdSHPMeasureList | MULTI_POINT_ZM |
ILcd3DEditablePolyline && ILcdSHPMeasureList | POLYLINE_ZM |
ILcd3DEditablePolygon && ILcdSHPMeasureList | POLYGON_ZM |
The ILcdShape
can also be a homogeneous ILcdShapeList
containing
any of the above ILcdShape
instances. An ILcdShapeList
can contain
only 1 ILcdComplexPolygon
.
Polygon vertices's defining order: The vertices's of the polygons must be given
in counter-clockwise order, holes must be given in clockwise order.
Properties (features) are retrieved by means of the ILcdDataObject
interface,
which the objects must implement.
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a new Informix Spatial model encoder. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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
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 thisILcdModelEncoder
encodes to.void
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.
-
Constructor Details
-
TLcdInformixSpatialModelEncoder
public TLcdInformixSpatialModelEncoder()Creates a new Informix 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
Description copied from interface:ILcdModelEncoder
Returns a short, displayable name for the format thisILcdModelEncoder
encodes to.- Specified by:
getDisplayName
in interfaceILcdModelEncoder
- Returns:
- the displayable name of this
ILcdModelEncoder
.
-
canExport
Returns whether the given model can be saved into the database described by the given properties file.- Specified by:
canExport
in interfaceILcdModelEncoder
- 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 interfaceILcdModelEncoder
- 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
Returns whether the given model can be saved back into the database.- Specified by:
canSave
in interfaceILcdModelEncoder
- 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
Saves the given model in its original location, by committing all changes.- Specified by:
save
in interfaceILcdModelEncoder
- 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)
).
-