|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object triptracker.server.persistence.PersistenceAdapter
public abstract class PersistenceAdapter
Works as an adapter for Persistence classes with built-in logging and all classes throwing an UnsupportedOperationException if not overridden.
Constructor Summary | |
---|---|
PersistenceAdapter()
|
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. |
protected String |
getLogFile()
Returns the file where log messages are written. |
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()
|
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. |
protected void |
log(String message)
|
Route |
makeRoute(int userID,
String description,
boolean publicRoute)
Generates a new route to the user with description. |
protected void |
setLogFile(String file)
Set the filename where log messages should be written. |
void |
setUserId(int userId)
|
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> coord)
Stores buffered coordinates from the GPS in the database. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PersistenceAdapter()
Method Detail |
---|
protected void setLogFile(String file)
file
- protected String getLogFile()
public int getUserId(String username)
getUserId
in interface Persistence
public int authUser(String username, String password)
authUser
in interface Persistence
public void storeCoordinate(int routeID, Coordinate coord)
storeCoordinate
in interface Persistence
routeID
- route identification of the coordinatecoord
- coordinate to storepublic void storeCoordinate(int routeID, List<Coordinate> coord)
storeCoordinate
in interface Persistence
routeID
- route identification of the coordinatecoord
- List of coordinates to storepublic Route makeRoute(int userID, String description, boolean publicRoute)
makeRoute
in interface Persistence
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
username
- name of user to get routes from
username
public Route getRoute(int routeId)
getRoute
in interface Persistence
public List<Coordinate> getCoordinates(int routeID)
getCoordinates
in interface Persistence
routeID
public List<User> getUserList()
getUserList
in interface Persistence
public User getUser(int userId)
getUser
in interface Persistence
userId
- = ID of user to get
public void setVisible(int routeID, boolean visible)
setVisible
in interface Persistence
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
routeID
- route to lock/unlocklock
- true to lock, false to unlockpublic void setUserId(int userId)
public int getUserId()
protected void log(String message)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |