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:
Resource, RenderableStore
Direct Known Subclasses:
DBBackend, FileBackend

public abstract class ModelBackend<G>
extends Object
implements RenderableStore

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

Version:
$Revision: 30127 $, $Date: 2011-03-22 11:11:12 +0100 (Tue, 22 Mar 2011) $
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(Envelope geometry, int dimension)
           
abstract  Envelope createEnvelope(G someGeometry)
          Create an envelope from the given Geometry type.
abstract  BackendResult delete(String uuid, ModelBackend.Type objectType, int qualityLevel, 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.
 ICRS getBaseCRS()
           
 WROSerializer getBuildingSerializer()
           
abstract  Object getDeSerializedObjectForUUID(ModelBackend.Type objectType, String uuid)
          Retrieves and deserializes an object from the given type.
abstract  List<Object> getDeSerializedObjectsForSQL(ModelBackend.Type objectType, String sqlWhere)
          Retrieves and deserializes objects from the given type.
protected abstract  String getDriverPrefix()
           
static ModelBackend<?> getInstance(String id, 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 PositionableModel>
BackendResult
insert(List<DataObjectInfo<P>> objects, ModelBackend.Type objectType)
          Insert given data into the backend.
abstract  void loadBuildings(BuildingRenderer bm, ICRS baseCRS)
          Retrieves the WorldRenderable objects from the backend.
abstract  List<RenderablePrototype> loadProtoTypes(DirectGeometryBuffer geometryBuffer, ICRS baseCRS)
          Retrieves the WorldRenderable objects from the prototypes table in the database.
abstract  void loadTrees(TreeRenderer tm, ICRS baseCRS)
          Retrieves the Billboard objects from the backend.
 void setWPVSBaseCRS(ICRS 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
 
Methods inherited from interface org.deegree.commons.config.Resource
destroy, init
 

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 List<RenderablePrototype> loadProtoTypes(DirectGeometryBuffer geometryBuffer,
                                                         ICRS baseCRS)
Retrieves the WorldRenderable objects from the prototypes table in the database.

Specified by:
loadProtoTypes in interface 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(BuildingRenderer bm,
                                   ICRS 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(TreeRenderer tm,
                               ICRS 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 List<Object> getDeSerializedObjectsForSQL(ModelBackend.Type objectType,
                                                          String sqlWhere)
                                                   throws 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:
IOException

getDeSerializedObjectForUUID

public abstract Object getDeSerializedObjectForUUID(ModelBackend.Type objectType,
                                                    String uuid)
                                             throws 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:
IOException

createEnvelope

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

Parameters:
someGeometry -
Returns:
the envelope

createBackendEnvelope

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

delete

public abstract BackendResult delete(String uuid,
                                     ModelBackend.Type objectType,
                                     int qualityLevel,
                                     String sqlWhere)
                              throws 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:
IOException

insert

public abstract <P extends PositionableModel> BackendResult insert(List<DataObjectInfo<P>> objects,
                                                                   ModelBackend.Type objectType)
                              throws 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:
IOException

getInstance

public static ModelBackend<?> getInstance(String id,
                                          String fileURL)
                                   throws DatasourceException,
                                          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.
UnsupportedOperationException - if the given driver has no implementing backend.

getDriverPrefix

protected abstract 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 IOException
flush any cached data to the backend and close the connections.

Throws:
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(ICRS baseCRS)
Parameters:
baseCRS - of the wpvs

getBaseCRS

public ICRS getBaseCRS()
Returns:
the baseCRS (or null if not set)


Copyright © 2011. All Rights Reserved.