|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgistoolkit.datasources.SimpleDataSource
The SimpleDataSource implements the DataSource, and implements some of the more tedious methods of it.
It handles Projections (Using the ToolkitProjection Engine), and handles the getting and setting of the name, the projection, the insert and update methods, and the filters.
To create an ReadOnly data source, subclassing the SimpleDataSource is the easiest way to go. The only methods that must be overridden are the methods: readEnvelope(), readShapes(), and getValidShapeTypes(). The rest of the plumming should be taken care of.
To create an Updateable data source, additional methods must be overridden, they include the doInsert, doUpdate, doDelete, doRollback, and doCommit methods. Do not forget to overide the isUpdateable method to return true as the default is to return false.
Additional methods may be overridden to provide speed if the underlying data souce provides similar capabilities.
Field Summary | |
(package private) java.lang.String[] |
myTypes
Return the array of shape types that are valid for this data source |
Constructor Summary | |
SimpleDataSource()
Creates new SimpleDataSource |
Method Summary | |
void |
addDataSourceListener(DataSourceListener inDataSourceListener)
Adds a datasource listener to this datasource. |
protected void |
clearCache()
Clear the cache. |
void |
commit()
Commit all changes since the last commit. |
void |
delete(Record inRecord)
Delete the given record from the data source. |
void |
doCommit()
Commit all changes since the last commit. |
void |
doDelete(Record inRecord)
Delete this record from the database. |
void |
doInsert(Record inRecord)
Insert the record into the data source. |
void |
doRollback()
Rollback any changes to this datasource since the last commit. |
void |
doUpdate(Record inRecord)
Update the data source with the changed record. |
protected GISDataset |
filterDataset(GISDataset inDataset)
|
protected void |
fireCommit()
Called to notify the listeners that a commit has occured |
protected void |
fireDelete(Record inRecord)
Called to notify the listeners that the record has been deleted |
protected void |
fireInsert(Record inRecord)
Called to notify the listeners that the record has been inserted |
protected void |
fireRead(Record inRecord)
Called to notify the listeners that the record has been read |
protected void |
fireRollBack()
Called to notify the listeners that a rollback has occured |
protected void |
fireUpdate(Record inRecord)
Called to notify the listeners that the record has been updated |
boolean |
getCached()
Returns true if this datasource is caching it's shapes. |
protected GISDataset |
getCacheDataset()
Return the cached data set. |
protected Envelope |
getCacheEnvelope()
Return the envelope of the cached dataset |
Envelope |
getEnvelope()
Returns the projected envelope. |
Filter |
getFilter()
Get the filter used with this data source. |
Projection |
getFromProjection()
Returns the projection to use to convert from the datasource native projection to the display projection, or a basis projection for the display projection. |
java.lang.String |
getName()
Gets the identifier string for the datasource. |
Node |
getNode()
Get the configuration information for this data source |
Style |
getStyle()
Get the default style to use with this datasource. |
Projection |
getToProjection()
Returns the ToProjection. |
java.lang.String[] |
getValidShapeTypes()
|
void |
insert(Record inRecord)
Inserts the given record into the datasource. |
protected boolean |
isCachedProjected()
Returs true if the dataset is supposed to cache the data projected. |
boolean |
isUpdateable()
Determines if this datasource is updateable. |
void |
projectBackward(Projection inProjection,
GISDataset inDataset)
Project the dataset backward |
void |
projectForward(Projection inProjection,
GISDataset inDataset)
Project the dataset forward |
protected GISDataset |
queryFromCache(Envelope inEnvelope)
Retrieve the data from the cache that intersect these envelope. |
GISDataset |
readDataset()
Reads all the objects from the data source. |
GISDataset |
readDataset(Envelope inEnvelope)
Reads only the objects from the data source that intersect these envelopes. |
abstract Envelope |
readEnvelope()
Returns the bounding rectangle of all the shapes in the Data Source. |
protected abstract GISDataset |
readShapes(Envelope inEnvelope)
This method should return the shapes from the data source |
void |
removeDataSourceListener(DataSourceListener inDataSourceListener)
Removes the datasource lisener from this datasource. |
void |
rollback()
Rollback any changes to this datasource since the last commit. |
protected void |
setCache(GISDataset inDataset,
Envelope inEnvelope)
Set the cached data set and envelope. |
void |
setCached(boolean inCached)
Set to true if this datasource should cache it's shapes. |
void |
setFilter(Filter inFilter)
Set the filter to use when querying data from this data source. |
void |
setFromProjection(Projection inProjection)
Sets the projection to use to convert from the storage media, source projection. |
void |
setName(java.lang.String inName)
Sets an identifier string for the datasource. |
void |
setNode(Node inNode)
Set the configuration information for this data source |
void |
setProjection(Projection inProjection)
|
void |
setToProjection(Projection inProjection,
boolean inCacheProjected)
Allows another projection to be used to convert to the screen projection. |
void |
update(Record inRecord)
Update the given record in the data source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
java.lang.String[] myTypes
Constructor Detail |
public SimpleDataSource()
Method Detail |
public java.lang.String getName()
getName
in interface DataSource
public void setName(java.lang.String inName)
setName
in interface DataSource
public void setFromProjection(Projection inProjection) throws java.lang.Exception
setFromProjection
in interface DataSource
java.lang.Exception
public Projection getFromProjection()
getFromProjection
in interface DataSource
public void setCached(boolean inCached)
public boolean getCached()
protected boolean isCachedProjected()
public void setToProjection(Projection inProjection, boolean inCacheProjected) throws java.lang.Exception
setToProjection
in interface DataSource
java.lang.Exception
public void setProjection(Projection inProjection) throws java.lang.Exception
java.lang.Exception
public Projection getToProjection()
getToProjection
in interface DataSource
public void projectForward(Projection inProjection, GISDataset inDataset) throws java.lang.Exception
java.lang.Exception
public void projectBackward(Projection inProjection, GISDataset inDataset) throws java.lang.Exception
java.lang.Exception
public Filter getFilter()
getFilter
in interface DataSource
public void setFilter(Filter inFilter)
setFilter
in interface DataSource
protected GISDataset filterDataset(GISDataset inDataset)
protected GISDataset getCacheDataset()
protected Envelope getCacheEnvelope()
protected void setCache(GISDataset inDataset, Envelope inEnvelope)
protected void clearCache()
protected GISDataset queryFromCache(Envelope inEnvelope)
public GISDataset readDataset(Envelope inEnvelope) throws java.lang.Exception
readDataset
in interface DataSource
java.lang.Exception
public GISDataset readDataset() throws java.lang.Exception
readDataset
in interface DataSource
java.lang.Exception
protected abstract GISDataset readShapes(Envelope inEnvelope) throws java.lang.Exception
java.lang.Exception
public abstract Envelope readEnvelope() throws java.lang.Exception
java.lang.Exception
public Envelope getEnvelope() throws java.lang.Exception
getEnvelope
in interface DataSource
java.lang.Exception
public Node getNode()
getNode
in interface DataSource
public void setNode(Node inNode) throws java.lang.Exception
setNode
in interface DataSource
java.lang.Exception
public void addDataSourceListener(DataSourceListener inDataSourceListener)
addDataSourceListener
in interface DataSource
public void removeDataSourceListener(DataSourceListener inDataSourceListener)
removeDataSourceListener
in interface DataSource
protected void fireRead(Record inRecord)
protected void fireInsert(Record inRecord)
protected void fireUpdate(Record inRecord)
protected void fireDelete(Record inRecord)
protected void fireCommit()
protected void fireRollBack()
public boolean isUpdateable()
isUpdateable
in interface DataSource
public void doInsert(Record inRecord) throws java.lang.Exception
java.lang.Exception
public void doUpdate(Record inRecord) throws java.lang.Exception
java.lang.Exception
public void doDelete(Record inRecord) throws java.lang.Exception
java.lang.Exception
public void doCommit() throws java.lang.Exception
java.lang.Exception
public void doRollback() throws java.lang.Exception
java.lang.Exception
public void commit() throws java.lang.Exception
commit
in interface DataSource
java.lang.Exception
public void rollback() throws java.lang.Exception
rollback
in interface DataSource
java.lang.Exception
public java.lang.String[] getValidShapeTypes()
public void insert(Record inRecord) throws java.lang.Exception
insert
in interface DataSource
java.lang.Exception
public void update(Record inRecord) throws java.lang.Exception
update
in interface DataSource
java.lang.Exception
public void delete(Record inRecord) throws java.lang.Exception
delete
in interface DataSource
java.lang.Exception
public Style getStyle()
getStyle
in interface DataSource
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |