org.deegree.services.wpvs.io.db
Class DBBackend<G>

java.lang.Object
  extended by org.deegree.services.wpvs.io.ModelBackend<G>
      extended by org.deegree.services.wpvs.io.db.DBBackend<G>
Type Parameters:
G - the Geometry type used to create the envelope from.
All Implemented Interfaces:
Resource, RenderableStore
Direct Known Subclasses:
PostgisBackend

public abstract class DBBackend<G>
extends ModelBackend<G>

The DBBackend provides methods for connections to the wpvs model in a database.

Version:
$Revision: 29642 $, $Date: 2011-02-11 13:59:33 +0100 (Fri, 11 Feb 2011) $
Author:
Rutger Bezema, last edited by: $Author: lbuesching $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deegree.services.wpvs.io.ModelBackend
ModelBackend.Type
 
Method Summary
 BackendResult delete(String uuid, ModelBackend.Type objectType, int qualityLevel, String sqlWhere)
          Delete some data from the backend.
 void flush()
          flush any cached data to the backend and close the connections.
 ModelBackendInfo getBackendInfo(ModelBackend.Type type)
          Retrieve some information on the number of vertices and texture coordinates used in the backend.
 Connection getConnection()
           
protected abstract  Envelope getDatasetEnvelope(Connection con, String tableName, String geomColumn)
          Should return the envelope in WPVS scene coordinates, not in world coordinates.
 Object getDeSerializedObjectForUUID(ModelBackend.Type objectType, String uuid)
          Retrieves and deserializes an object from the given type.
 List<Object> getDeSerializedObjectsForSQL(ModelBackend.Type objectType, String sqlWhere)
          Retrieves and deserializes objects from the given type.
<P extends PositionableModel>
BackendResult
insert(List<DataObjectInfo<P>> model, ModelBackend.Type objectType)
          Insert given data into the backend.
 boolean isBillboard()
           
 void loadBuildings(BuildingRenderer bm, ICRS baseCRS)
          Retrieves the WorldRenderable objects from the backend.
 void loadEntities(RenderableManager<?> renderer, ICRS baseCRS)
           
 List<RenderablePrototype> loadProtoTypes(DirectGeometryBuffer geometryBuffer, ICRS baseCRS)
          Retrieves the WorldRenderable objects from the prototypes table in the database.
 void loadTrees(TreeRenderer tm, ICRS baseCRS)
          Retrieves the Billboard objects from the backend.
 
Methods inherited from class org.deegree.services.wpvs.io.ModelBackend
createBackendEnvelope, createEnvelope, getBaseCRS, getBuildingSerializer, getDriverPrefix, getInstance, getPrototypeSerializer, getSerializerForType, getTreeSerializer, getWPVSTranslationVector, setWPVSBaseCRS, setWPVSTranslationVector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deegree.commons.config.Resource
destroy, init
 

Method Detail

loadProtoTypes

public List<RenderablePrototype> loadProtoTypes(DirectGeometryBuffer geometryBuffer,
                                                ICRS baseCRS)
Description copied from class: ModelBackend
Retrieves the WorldRenderable objects from the prototypes table in the database.

Specified by:
loadProtoTypes in interface RenderableStore
Specified by:
loadProtoTypes in class ModelBackend<G>
baseCRS - the crs of the WPVS scene
Returns:
the list of prototypes or the empty list if an error occurred, never null.

loadBuildings

public void loadBuildings(BuildingRenderer bm,
                          ICRS baseCRS)
Description copied from class: ModelBackend
Retrieves the WorldRenderable objects from the backend.

Specified by:
loadBuildings in class ModelBackend<G>
Parameters:
bm - to add the building to
baseCRS - the crs of the WPVS scene

loadTrees

public void loadTrees(TreeRenderer tm,
                      ICRS baseCRS)
Description copied from class: ModelBackend
Retrieves the Billboard objects from the backend.

Specified by:
loadTrees in class ModelBackend<G>
Parameters:
tm - to add the trees to.
baseCRS - the crs of the WPVS scene

getDeSerializedObjectForUUID

public Object getDeSerializedObjectForUUID(ModelBackend.Type objectType,
                                           String uuid)
                                    throws IOException
Description copied from class: ModelBackend
Retrieves and deserializes an object from the given type.

Specified by:
getDeSerializedObjectForUUID in class ModelBackend<G>
uuid - of the object
Returns:
the deserialized object or null if given uuid did not match.
Throws:
IOException

getDeSerializedObjectsForSQL

public List<Object> getDeSerializedObjectsForSQL(ModelBackend.Type objectType,
                                                 String sqlWhere)
                                          throws IOException
Description copied from class: ModelBackend
Retrieves and deserializes objects from the given type.

Specified by:
getDeSerializedObjectsForSQL in class ModelBackend<G>
sqlWhere - to select the objects to retrieve
Returns:
the list of deserialized object or the emtpy list if no results matched.
Throws:
IOException

delete

public BackendResult delete(String uuid,
                            ModelBackend.Type objectType,
                            int qualityLevel,
                            String sqlWhere)
                     throws IOException
Description copied from class: ModelBackend
Delete some data from the backend.

Specified by:
delete in class ModelBackend<G>
Parameters:
uuid - the id of the object to delete.
objectType - defining the type of object.
Returns:
the number of records deleted by the given id.
Throws:
IOException

insert

public <P extends PositionableModel> BackendResult insert(List<DataObjectInfo<P>> model,
                                                          ModelBackend.Type objectType)
                     throws IOException
Description copied from class: ModelBackend
Insert given data into the backend.

Specified by:
insert in class ModelBackend<G>
Type Parameters:
P - type of the positionable
objectType - defining the type of the dataModel
Returns:
information about the inserted objects.
Throws:
IOException

getConnection

public Connection getConnection()
                         throws SQLException
Returns:
a connection to the database
Throws:
SQLException

getBackendInfo

public ModelBackendInfo getBackendInfo(ModelBackend.Type type)
Description copied from class: ModelBackend
Retrieve some information on the number of vertices and texture coordinates used in the backend.

Specified by:
getBackendInfo in class ModelBackend<G>
Returns:
some information on the backend.

flush

public void flush()
Description copied from class: ModelBackend
flush any cached data to the backend and close the connections.

Specified by:
flush in class ModelBackend<G>

loadEntities

public void loadEntities(RenderableManager<?> renderer,
                         ICRS baseCRS)

isBillboard

public boolean isBillboard()

getDatasetEnvelope

protected abstract Envelope getDatasetEnvelope(Connection con,
                                               String tableName,
                                               String geomColumn)
                                        throws SQLException
Should return the envelope in WPVS scene coordinates, not in world coordinates.

Parameters:
con -
tableName -
geomColumn -
Returns:
the envelope of the given dataset.
Throws:
SQLException


Copyright © 2011. All Rights Reserved.