|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object triptracker.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 Persistence
getUserId
in class PersistenceAdapter
public int authUser(String user, String pass)
authUser
in interface Persistence
authUser
in class PersistenceAdapter
public void storeCoordinate(int routeID, Coordinate coord)
storeCoordinate
in interface Persistence
storeCoordinate
in class PersistenceAdapter
routeID
- route identification of the coordinatecoord
- coordinate to storepublic void storeCoordinate(int routeID, List<Coordinate> coords)
storeCoordinate
in interface Persistence
storeCoordinate
in class PersistenceAdapter
routeID
- route identification of the coordinatecoords
- List of coordinates to storepublic List<User> getUserList()
getUserList
in interface Persistence
getUserList
in class PersistenceAdapter
public User getUser(int userId)
getUser
in interface Persistence
getUser
in class PersistenceAdapter
userId
- ID of user
public Route makeRoute(int userId, String description, boolean publicRoute)
makeRoute
in interface Persistence
makeRoute
in class PersistenceAdapter
userId
- 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 Persistence
getRoutes
in class PersistenceAdapter
username
- name of user to get routes from
username
public List<Coordinate> getCoordinates(int routeID)
getCoordinates
in interface Persistence
getCoordinates
in class PersistenceAdapter
routeID
public void setVisible(int routeID, boolean visible)
setVisible
in interface Persistence
setVisible
in class PersistenceAdapter
routeID
- route to change visibilityvisible
- true to show route to all clients, false to show only to
ownerpublic void lockRoute(int routeID, boolean lock)
lockRoute
in interface Persistence
lockRoute
in class PersistenceAdapter
routeID
- route to lock/unlocklock
- true to lock, false to unlockpublic Route getRoute(int routeId)
getRoute
in interface Persistence
getRoute
in class PersistenceAdapter
routeId
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |