org.deegree.services.wpvs.io
Class ModelBackend<G>

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

public abstract class ModelBackend<G>
extends java.lang.Object
implements org.deegree.rendering.r3d.persistence.RenderableStore

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

Version:
$Revision: 25504 $, $Date: 2010-07-26 17:02:08 +0200 (Mo, 26. Jul 2010) $
Author:
Rutger Bezema, last edited by: $Author: aschmitz $

Nested Class Summary
static class ModelBackend.Type
          The Types known to the modelbackend
 
Constructor Summary
ModelBackend()
           
 
Method Summary
abstract  G createBackendEnvelope(org.deegree.geometry.Envelope geometry, int dimension)
           
abstract  org.deegree.geometry.Envelope createEnvelope(G someGeometry)
          Create an envelope from the given Geometry type.
abstract  BackendResult delete(java.lang.String uuid, ModelBackend.Type objectType, int qualityLevel, java.lang.String sqlWhere)
          Delete some data from the backend.
abstract  void flush()
          flush any cached data to the backend and close the connections.
abstract  ModelBackendInfo getBackendInfo(ModelBackend.Type type)
          Retrieve some information on the number of vertices and texture coordinates used in the backend.
 org.deegree.cs.CRS getBaseCRS()
           
 WROSerializer getBuildingSerializer()
           
abstract  java.lang.Object getDeSerializedObjectForUUID(ModelBackend.Type objectType, java.lang.String uuid)
          Retrieves and deserializes an object from the given type.
abstract  java.util.List<java.lang.Object> getDeSerializedObjectsForSQL(ModelBackend.Type objectType, java.lang.String sqlWhere)
          Retrieves and deserializes objects from the given type.
protected abstract  java.lang.String getDriverPrefix()
           
static ModelBackend<?> getInstance(java.lang.String id, java.lang.String fileURL)
          Creates the appropriate database backend for the given connection id.
 PrototypeSerializer getPrototypeSerializer()
           
 ObjectSerializer<?> getSerializerForType(ModelBackend.Type objectType)
           
 BillBoardSerializer getTreeSerializer()
           
 double[] getWPVSTranslationVector()
           
abstract
<P extends org.deegree.commons.index.PositionableModel>
BackendResult
insert(java.util.List<DataObjectInfo<P>> objects, ModelBackend.Type objectType)
          Insert given data into the backend.
abstract  void loadBuildings(org.deegree.rendering.r3d.opengl.rendering.model.manager.BuildingRenderer bm, org.deegree.cs.CRS baseCRS)
          Retrieves the WorldRenderable objects from the backend.
abstract  java.util.List<org.deegree.rendering.r3d.opengl.rendering.model.prototype.RenderablePrototype> loadProtoTypes(org.deegree.rendering.r3d.opengl.rendering.model.geometry.DirectGeometryBuffer geometryBuffer, org.deegree.cs.CRS baseCRS)
          Retrieves the WorldRenderable objects from the prototypes table in the database.
abstract  void loadTrees(org.deegree.rendering.r3d.opengl.rendering.model.manager.TreeRenderer tm, org.deegree.cs.CRS baseCRS)
          Retrieves the Billboard objects from the backend.
 void setWPVSBaseCRS(org.deegree.cs.CRS baseCRS)
           
 void setWPVSTranslationVector(double[] wpvsTranslationVector)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deegree.rendering.r3d.persistence.RenderableStore
isBillboard, loadEntities
 

Constructor Detail

ModelBackend

public ModelBackend()
Method Detail

getTreeSerializer

public final BillBoardSerializer getTreeSerializer()
Returns:
the treeSerializer

getBuildingSerializer

public final WROSerializer getBuildingSerializer()
Returns:
the buildingSerializer

getPrototypeSerializer

public final PrototypeSerializer getPrototypeSerializer()
Returns:
the prototypeSerializer

getBackendInfo

public abstract ModelBackendInfo getBackendInfo(ModelBackend.Type type)
Retrieve some information on the number of vertices and texture coordinates used in the backend.

Parameters:
type -
Returns:
some information on the backend.

loadProtoTypes

public abstract java.util.List<org.deegree.rendering.r3d.opengl.rendering.model.prototype.RenderablePrototype> loadProtoTypes(org.deegree.rendering.r3d.opengl.rendering.model.geometry.DirectGeometryBuffer geometryBuffer,
                                                                                                                              org.deegree.cs.CRS baseCRS)
Retrieves the WorldRenderable objects from the prototypes table in the database.

Specified by:
loadProtoTypes in interface org.deegree.rendering.r3d.persistence.RenderableStore
Parameters:
geometryBuffer -
baseCRS - the crs of the WPVS scene
Returns:
the list of prototypes or the empty list if an error occurred, never null.

loadBuildings

public abstract void loadBuildings(org.deegree.rendering.r3d.opengl.rendering.model.manager.BuildingRenderer bm,
                                   org.deegree.cs.CRS baseCRS)
Retrieves the WorldRenderable objects from the backend.

Parameters:
bm - to add the building to
baseCRS - the crs of the WPVS scene

loadTrees

public abstract void loadTrees(org.deegree.rendering.r3d.opengl.rendering.model.manager.TreeRenderer tm,
                               org.deegree.cs.CRS baseCRS)
Retrieves the Billboard objects from the backend.

Parameters:
tm - to add the trees to.
baseCRS - the crs of the WPVS scene

getDeSerializedObjectsForSQL

public abstract java.util.List<java.lang.Object> getDeSerializedObjectsForSQL(ModelBackend.Type objectType,
                                                                              java.lang.String sqlWhere)
                                                                       throws java.io.IOException
Retrieves and deserializes objects from the given type.

Parameters:
objectType -
sqlWhere - to select the objects to retrieve
Returns:
the list of deserialized object or the emtpy list if no results matched.
Throws:
java.io.IOException

getDeSerializedObjectForUUID

public abstract java.lang.Object getDeSerializedObjectForUUID(ModelBackend.Type objectType,
                                                              java.lang.String uuid)
                                                       throws java.io.IOException
Retrieves and deserializes an object from the given type.

Parameters:
objectType -
uuid - of the object
Returns:
the deserialized object or null if given uuid did not match.
Throws:
java.io.IOException

createEnvelope

public abstract org.deegree.geometry.Envelope createEnvelope(G someGeometry)
Create an envelope from the given Geometry type.

Parameters:
someGeometry -
Returns:
the envelope

createBackendEnvelope

public abstract G createBackendEnvelope(org.deegree.geometry.Envelope geometry,
                                        int dimension)
Parameters:
geometry -
dimension - of the result geometry
Returns:
an envelope created from the given geometry

delete

public abstract BackendResult delete(java.lang.String uuid,
                                     ModelBackend.Type objectType,
                                     int qualityLevel,
                                     java.lang.String sqlWhere)
                              throws java.io.IOException
Delete some data from the backend.

Parameters:
uuid - the id of the object to delete.
objectType - defining the type of object.
sqlWhere -
qualityLevel -
Returns:
the number of records deleted by the given id.
Throws:
java.io.IOException

insert

public abstract <P extends org.deegree.commons.index.PositionableModel> BackendResult insert(java.util.List<DataObjectInfo<P>> objects,
                                                                                             ModelBackend.Type objectType)
                              throws java.io.IOException
Insert given data into the backend.

Type Parameters:
P - type of the positionable
Parameters:
objects -
objectType - defining the type of the dataModel
Returns:
information about the inserted objects.
Throws:
java.io.IOException

getInstance

public static ModelBackend<?> getInstance(java.lang.String id,
                                          java.lang.String fileURL)
                                   throws DatasourceException,
                                          java.lang.UnsupportedOperationException
Creates the appropriate database backend for the given connection id. Or throws an UnsupportedOperationException if the driver was not supported.

Parameters:
id - to be used to initialize the if it contains org.deegree.services.wpvs.io.file.FileBackend, the file backend will be initialized.
fileURL - of the file backend files
Returns:
a ModelBackendInstance associated with the given driver.
Throws:
DatasourceException - if the driver was not found on the classpath, or could not be initialized.
java.lang.UnsupportedOperationException - if the given driver has no implementing backend.

getDriverPrefix

protected abstract java.lang.String getDriverPrefix()
Returns:
the prefix of the backend, which should be prefixed to the hosturl.

getSerializerForType

public ObjectSerializer<?> getSerializerForType(ModelBackend.Type objectType)
Parameters:
objectType -
Returns:
the mapped object serializer.

flush

public abstract void flush()
                    throws java.io.IOException
flush any cached data to the backend and close the connections.

Throws:
java.io.IOException - if flushing was not successful

getWPVSTranslationVector

public final double[] getWPVSTranslationVector()
Returns:
the 3 dimensional wpvsTranslationVector, never null

setWPVSTranslationVector

public final void setWPVSTranslationVector(double[] wpvsTranslationVector)
Parameters:
wpvsTranslationVector - the 3 dimensional wpvsTranslationVector to set

setWPVSBaseCRS

public final void setWPVSBaseCRS(org.deegree.cs.CRS baseCRS)
Parameters:
baseCRS - of the wpvs

getBaseCRS

public org.deegree.cs.CRS getBaseCRS()
Returns:
the baseCRS (or null if not set)


Copyright © 2011. All Rights Reserved.