org.deegree.services.wpvs.io.file
Class FileBackend

java.lang.Object
  extended by org.deegree.services.wpvs.io.ModelBackend<Envelope>
      extended by org.deegree.services.wpvs.io.file.FileBackend
All Implemented Interfaces:
Resource, RenderableStore

public class FileBackend
extends ModelBackend<Envelope>

The FileBackend is the access to the model in files on the local file system.

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
 
Nested classes/interfaces inherited from class org.deegree.services.wpvs.io.ModelBackend
ModelBackend.Type
 
Constructor Summary
FileBackend(File billboardFile)
           
FileBackend(File entityFile, File prototypeFile)
           
 
Method Summary
 Envelope createBackendEnvelope(Envelope geometry, int dimension)
           
 Envelope createEnvelope(Envelope someGeometry)
          Create an envelope from the given Geometry type.
 BackendResult delete(String uuid, ModelBackend.Type objectType, int qualityLevel, String sqlWhere)
          Delete some data from the backend.
 void destroy()
          Usually called by the ResourceManager upon workspace shutdown.
 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.
 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.
protected  String getDriverPrefix()
           
 void init(DeegreeWorkspace workspace)
          Usually called by the ResourceManager upon workspace startup.
static void initFiles(File entityFile)
           
<P extends PositionableModel>
BackendResult
insert(List<DataObjectInfo<P>> objects, 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
getBaseCRS, getBuildingSerializer, 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
 

Constructor Detail

FileBackend

public FileBackend(File billboardFile)
            throws IOException
Parameters:
billboardFile -
Throws:
IOException

FileBackend

public FileBackend(File entityFile,
                   File prototypeFile)
            throws IOException
Parameters:
entityFile -
prototypeFile -
Throws:
IOException
Method Detail

createBackendEnvelope

public Envelope createBackendEnvelope(Envelope geometry,
                                      int dimension)
Specified by:
createBackendEnvelope in class ModelBackend<Envelope>
dimension - of the result geometry
Returns:
an envelope created from the given geometry

createEnvelope

public Envelope createEnvelope(Envelope someGeometry)
Description copied from class: ModelBackend
Create an envelope from the given Geometry type.

Specified by:
createEnvelope in class ModelBackend<Envelope>
Returns:
the envelope

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<Envelope>
uuid - of the object
Returns:
the deserialized object or null if given uuid did not match.
Throws:
IOException

getDriverPrefix

protected String getDriverPrefix()
Specified by:
getDriverPrefix in class ModelBackend<Envelope>
Returns:
the prefix of the backend, which should be prefixed to the hosturl.

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<Envelope>
Parameters:
bm - to add the building to
baseCRS - the crs of the WPVS scene

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<Envelope>
baseCRS - the crs of the WPVS scene
Returns:
the list of prototypes or the empty list if an error occurred, never null.

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<Envelope>
Parameters:
tm - to add the trees to.
baseCRS - the crs of the WPVS scene

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<Envelope>
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>> objects,
                                                          ModelBackend.Type objectType)
                     throws IOException
Description copied from class: ModelBackend
Insert given data into the backend.

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

flush

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

Specified by:
flush in class ModelBackend<Envelope>
Throws:
IOException - if flushing was not successful

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<Envelope>
Returns:
some information on the backend.

getDeSerializedObjectsForSQL

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

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

loadEntities

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

isBillboard

public boolean isBillboard()

initFiles

public static void initFiles(File entityFile)
                      throws IOException
Throws:
IOException

destroy

public void destroy()
Description copied from interface: Resource
Usually called by the ResourceManager upon workspace shutdown.


init

public void init(DeegreeWorkspace workspace)
          throws ResourceInitException
Description copied from interface: Resource
Usually called by the ResourceManager upon workspace startup.

Parameters:
workspace - the workspace the resource belongs to, may be null
Throws:
ResourceInitException


Copyright © 2011. All Rights Reserved.