|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttriptracker.server.persistence.PersistenceAdapter
triptracker.server.persistence.MySqlDB
public class MySqlDB
Implementation of the persistence layer in the form of a MySQL database.
| Field Summary | |
|---|---|
static String |
database
|
static String |
server
|
| Constructor Summary | |
|---|---|
MySqlDB()
|
|
| Method Summary | |
|---|---|
int |
authUser(String user,
String pass)
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 data for the specified user. |
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 publicRoute)
Generates a new route to the user with description. |
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. |
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. |
| Methods inherited from class triptracker.server.persistence.PersistenceAdapter |
|---|
getLogFile, getUserId, log, setLogFile, setUserId |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String server
public static final String database
| Constructor Detail |
|---|
public MySqlDB()
| Method Detail |
|---|
public int getUserId(String username)
getUserId in interface PersistencegetUserId in class PersistenceAdapter
public int authUser(String user,
String pass)
authUser in interface PersistenceauthUser in class PersistenceAdapter
public void storeCoordinate(int routeID,
Coordinate coord)
storeCoordinate in interface PersistencestoreCoordinate in class PersistenceAdapterrouteID - route identification of the coordinatecoord - coordinate to store
public void storeCoordinate(int routeID,
List<Coordinate> coords)
storeCoordinate in interface PersistencestoreCoordinate in class PersistenceAdapterrouteID - route identification of the coordinatecoords - List of coordinates to storepublic List<User> getUserList()
getUserList in interface PersistencegetUserList in class PersistenceAdapterpublic User getUser(int userId)
getUser in interface PersistencegetUser in class PersistenceAdapteruserId - ID of user
public Route makeRoute(int userId,
String description,
boolean publicRoute)
makeRoute in interface PersistencemakeRoute in class PersistenceAdapteruserId - user ID of the route ownerdescription - text describing the routepublicRoute - true for public, false for private
public List<Route> getRoutes(String username)
getRoutes in interface PersistencegetRoutes in class PersistenceAdapterusername - name of user to get routes from
usernamepublic List<Coordinate> getCoordinates(int routeID)
getCoordinates in interface PersistencegetCoordinates in class PersistenceAdapterrouteID
public void setVisible(int routeID,
boolean visible)
setVisible in interface PersistencesetVisible in class PersistenceAdapterrouteID - route to change visibilityvisible - true to show route to all clients, false to show only to
owner
public void lockRoute(int routeID,
boolean lock)
lockRoute in interface PersistencelockRoute in class PersistenceAdapterrouteID - route to lock/unlocklock - true to lock, false to unlockpublic Route getRoute(int routeId)
getRoute in interface PersistencegetRoute in class PersistenceAdapterrouteId -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||