triptracker.server.persistence
Interface Persistence

All Known Implementing Classes:
MySqlDB, PersistenceAdapter

public interface Persistence

Interface for the data persistency layer.


Method Summary
 int authUser(String username, String password)
          Authenticate user by checking the username and password.
 List<Coordinate> getCoordinates(int routeID)
          Returns the coordinates of a route for a specific user and route.
 Route getRoute(int routeId)
          Returns spesific route with routeId
 List<Route> getRoutes(String username)
          Returns routes from specific user.
 User getUser(int userId)
          Returns user asked for
 int getUserId(String username)
          Returns userId of given username.
 List<User> getUserList()
          Returns list of users to get routes from
 void lockRoute(int routeID, boolean lock)
          Lock the route for further logging or unlock it to continue logging.
 Route makeRoute(int userID, String description, boolean visibility)
          Generates a new route to the user with description.
 void setVisible(int routeID, boolean visible)
          Changes the visibility of a route.
 void storeCoordinate(int routeID, Coordinate coord)
          Stores coordinates from the GPS in the database.
 void storeCoordinate(int routeID, List<Coordinate> coords)
          Stores buffered coordinates from the GPS in the database.
 

Method Detail

getUserId

int getUserId(String username)
Returns userId of given username.

Returns:
userId of given username

authUser

int authUser(String username,
             String password)
Authenticate user by checking the username and password.

Parameters:
username -
password -
Returns:
non-negative user ID on success or -1 on failure

storeCoordinate

void storeCoordinate(int routeID,
                     Coordinate coord)
Stores coordinates from the GPS in the database.

Parameters:
routeID - route identification of the coordinate
coord - coordinate to store

storeCoordinate

void storeCoordinate(int routeID,
                     List<Coordinate> coords)
Stores buffered coordinates from the GPS in the database.

Parameters:
routeID - route identification of the coordinate
coords - List of coordinates to store

makeRoute

Route makeRoute(int userID,
                String description,
                boolean visibility)
Generates a new route to the user with description.

Parameters:
userID - user ID of the route owner
description - text describing the route
visibility - true for public, false for private
Returns:
non-negative route ID on success or -1 on failure

getRoutes

List<Route> getRoutes(String username)
Returns routes from specific user.

Parameters:
username - name of user to get routes from
Returns:
list of routes for user with name username

getRoute

Route getRoute(int routeId)
Returns spesific route with routeId

Parameters:
routeId -
Returns:
Route with given ID

getCoordinates

List<Coordinate> getCoordinates(int routeID)
Returns the coordinates of a route for a specific user and route.

Parameters:
routeID -
Returns:
list of coordinates from route routeID

getUserList

List<User> getUserList()
Returns list of users to get routes from

Returns:
list of users

getUser

User getUser(int userId)
Returns user asked for

Parameters:
userId - = ID of user to get
Returns:
User with given ID

lockRoute

void lockRoute(int routeID,
               boolean lock)
Lock the route for further logging or unlock it to continue logging.

Parameters:
routeID - route to lock/unlock
lock - true to lock, false to unlock

setVisible

void setVisible(int routeID,
                boolean visible)
Changes the visibility of a route. By changing visibility of a route you can make sure that it can only be seen by its owner or by all clients.

Parameters:
routeID - route to change visibility
visible - true to show route to all clients, false to show only to owner


Copyright © 2006 Team Trip Tracker. All Rights Reserved.