triptracker.server
Class GPSHandler

java.lang.Object
  extended by triptracker.server.ClientHandler
      extended by triptracker.server.GPSHandler

public class GPSHandler
extends ClientHandler

Handler for coordinate submitter/sender clients.


Field Summary
 
Fields inherited from class triptracker.server.ClientHandler
db, in, inStream, out, outStream, route, server, user
 
Constructor Summary
GPSHandler(Server server, Socket socket, User user)
          Sets up socket streams for communication with a GPS client and creates the message reader thread for message processing.
 
Method Summary
 void addCoordListener(CoordListener listener)
          MapHandlers can add themselves to the listener list and recieve updates when coordinates are added.
 void coordBufferAdd(int size)
          For storing coordinates that have been buffered on the client for some time.
 void coordinateBufferUpdate(String[] coords)
          Notifies all listeners and send them the buffered coordinates.
 void coordinateUpdate(Coordinate coord)
          Notifies all listeners and send them the coordinate.
protected  boolean messageHandler(String message)
          Invoked when a new message has been recieved.
 void removeCoordListener(CoordListener listener)
          MapHandlers can add themselves to the listener list and recieve updates when coordinates are added.
protected  void stopHandler()
          The method making sure everything is being shutdown before the handler deletes itself.
 void stopLogging()
           
 void storeCoordinate(Coordinate coord)
          Publish a coordinate to all coordinate listeners and then lets the persistency layer store it permanently.
 
Methods inherited from class triptracker.server.ClientHandler
getActiveRoute, log, messageLoop, sendMessage, sendMessage, sendZipMessage, startHandler, viewRoutes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GPSHandler

public GPSHandler(Server server,
                  Socket socket,
                  User user)
           throws IOException
Sets up socket streams for communication with a GPS client and creates the message reader thread for message processing.

Parameters:
server - main server instance
socket - client communication socket
user - client user data
Throws:
IOException - on connection failure
Method Detail

stopHandler

protected void stopHandler()
The method making sure everything is being shutdown before the handler deletes itself.

Overrides:
stopHandler in class ClientHandler

messageHandler

protected boolean messageHandler(String message)
Invoked when a new message has been recieved. Sub-classes must implement this method to provide handing of recieved messages.

Specified by:
messageHandler in class ClientHandler
Parameters:
message - received message from client

storeCoordinate

public void storeCoordinate(Coordinate coord)
Publish a coordinate to all coordinate listeners and then lets the persistency layer store it permanently. The coordinate listeners is usually map clients listening in on a route in realtime.

Parameters:
coord - coordinate to publish and permanently store

coordBufferAdd

public void coordBufferAdd(int size)
For storing coordinates that have been buffered on the client for some time. Will recieve them packed in gzip, to save transmitt rate.


coordinateUpdate

public void coordinateUpdate(Coordinate coord)
Notifies all listeners and send them the coordinate.

Parameters:
coord -

coordinateBufferUpdate

public void coordinateBufferUpdate(String[] coords)
Notifies all listeners and send them the buffered coordinates.

Parameters:
coord -

stopLogging

public void stopLogging()

addCoordListener

public void addCoordListener(CoordListener listener)
MapHandlers can add themselves to the listener list and recieve updates when coordinates are added.

Parameters:
listener - listener to add for notification events

removeCoordListener

public void removeCoordListener(CoordListener listener)
MapHandlers can add themselves to the listener list and recieve updates when coordinates are added.

Parameters:
listener - listener to add for notification events


Copyright © 2006 Team Trip Tracker. All Rights Reserved.