Package com.luciad.format.database
Class TLcdDatabaseModelEncoder
java.lang.Object
com.luciad.format.database.TLcdDatabaseModelEncoder
- All Implemented Interfaces:
ILcdModelEncoder,Serializable
- Direct Known Subclasses:
TLcdDB2SpatialModelEncoder
This
ILcdModelDecoder encodes models into 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 dbp.
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 dbp. The properties below can also be set
directly on the ILcdModelDecoder.
The common property needed to establish a connection is:
databaseFactory: the class name of the implementation ofILcdDatabaseFactorythat is needed to decode the database correctly. The user can provide an implementation, or Database Connector components can do this, e.g. for Oracle Spatial or for Informix Geodetic.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new database encoder.TLcdDatabaseModelEncoder(ILcdDatabaseFactory aDatabaseFactory) Creates a new database encoder. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether the given model can be saved into the database described by the given properties file.booleanReturns whether the given model can be saved back into the database.voidExports the given model in a new table, based on the properties in the given file.voidexport(ILcdModel aModel, Properties aProperties) Exports the given model in a new table, based on the given properties.intReturns the number of inserted elements after which an export operation is committed.Returns the database factory that has all the essential methods for accessing a particular database.Returns a short, displayable name for the format thisILcdModelEncoderencodes to.voidSaves the given model in its original location, by committing all changes.voidsetAutoCommitCount(int aAutoCommitCount) Sets the number of inserted elements after which an export operation should be committed, periodically.voidsetDatabaseFactory(ILcdDatabaseFactory aDatabaseFactory) Sets the database factory that has all the essential methods for accessing a particular database.
-
Constructor Details
-
TLcdDatabaseModelEncoder
public TLcdDatabaseModelEncoder()Creates a new database encoder. -
TLcdDatabaseModelEncoder
Creates a new database encoder.- Parameters:
aDatabaseFactory- specifies the factory that implements the support for a particular database.
-
-
Method Details
-
setDatabaseFactory
Sets the database factory that has all the essential methods for accessing a particular database. If left unset, thedatabaseFactoryproperty in the properties file must specify the class name of the database factory.- Parameters:
aDatabaseFactory- specifies the factory that implements the support for a particular database.
-
getDatabaseFactory
Returns the database factory that has all the essential methods for accessing a particular database. This factory is typically only used internally, by the database model encoder. -
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:ILcdModelEncoderReturns a short, displayable name for the format thisILcdModelEncoderencodes to.- Specified by:
getDisplayNamein 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:
canExportin interfaceILcdModelEncoder- Parameters:
aModel- the model to be verified.aDestinationName- the location where the model should be exported to.- Returns:
trueif this encoder can export the specified model to the specified location,falseotherwise.- 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:
exportin 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:
canSavein interfaceILcdModelEncoder- Parameters:
aModel- the model to be verified.- Returns:
trueif this encoder can save the model in the location where it originally came from,falseotherwise.- See Also:
-
save
Saves the given model in its original location, by committing all changes.- Specified by:
savein 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)).
-