es.ucm.look.data.remote
Class RemoteDBHandler

java.lang.Object
  extended by es.ucm.look.data.local.DBDataHandler
      extended by es.ucm.look.data.remote.RemoteDBHandler
All Implemented Interfaces:
DataGetter, DataHandler, DataSetter

public class RemoteDBHandler
extends DBDataHandler
implements DataGetter, DataSetter

Implement the DataHandler to the persistence with the remote service


Constructor Summary
RemoteDBHandler(Context c, ServiceManager s, java.lang.String serverURL, java.lang.String fileURL)
          Constructor class.
 
Method Summary
 void addEntity(EntityData data)
          Adds an entity to the world
 java.util.List<EntityData> getElementsUpdated(float x, float y, float z, float radius, java.util.Date date)
          Returns all elements near the given point with the given radius that changed since last update
 void updatePosition(EntityData data, float x, float y, float z)
          Modifies the position for an entity
 void updateProperty(EntityData data, java.lang.String property, java.lang.String newValue)
          Updates the value from a entity data property
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteDBHandler

public RemoteDBHandler(Context c,
                       ServiceManager s,
                       java.lang.String serverURL,
                       java.lang.String fileURL)
Constructor class.

Parameters:
c - Context when it is created
s - ServiceManager
serverURL - URL server
fileURL - URL to access to the files
Method Detail

addEntity

public void addEntity(EntityData data)
Description copied from interface: DataSetter
Adds an entity to the world

Specified by:
addEntity in interface DataSetter
Overrides:
addEntity in class DBDataHandler

getElementsUpdated

public java.util.List<EntityData> getElementsUpdated(float x,
                                                     float y,
                                                     float z,
                                                     float radius,
                                                     java.util.Date date)
Description copied from interface: DataGetter
Returns all elements near the given point with the given radius that changed since last update

Specified by:
getElementsUpdated in interface DataGetter
Overrides:
getElementsUpdated in class DBDataHandler
Parameters:
x - x coordinate
y - y coordinate
z - z coordinate
radius - radius to be checked. If radius is -1, is considered as infinitum
date - time of the last update. If date is null, all elements will be returned
Returns:
the list with the ids

updatePosition

public void updatePosition(EntityData data,
                           float x,
                           float y,
                           float z)
Description copied from interface: DataSetter
Modifies the position for an entity

Specified by:
updatePosition in interface DataSetter
Overrides:
updatePosition in class DBDataHandler
Parameters:
data - data representing the entity
x - x coordinate
y - y coordinate
z - z coordinate

updateProperty

public void updateProperty(EntityData data,
                           java.lang.String property,
                           java.lang.String newValue)
Description copied from interface: DataSetter
Updates the value from a entity data property

Specified by:
updateProperty in interface DataSetter
Overrides:
updateProperty in class DBDataHandler
Parameters:
data - entity data
property - the property name
newValue - the nuew value for the property