com.veriplace.client.util
Class AbstractPollingHandler

java.lang.Object
  extended by com.veriplace.client.util.AbstractPollingHandler
All Implemented Interfaces:
PollingHandler

public class AbstractPollingHandler
extends java.lang.Object
implements PollingHandler

Basic implementation of PollingHandler that provides empty stubs for all handler methods.

Since:
2.4

Constructor Summary
AbstractPollingHandler()
           
 
Method Summary
 java.lang.Object beginLocationBatch(PollingManager manager, LocationUpdates locationUpdates)
          Called by PollingManager when a batch of locations is about to become available.
 void endLocationBatch(PollingManager manager, java.lang.Object batch)
          Called by PollingManager when all the locations from the last update request have been processed.
 void handleLocationQueryException(PollingManager manager, User user, LocationUpdateReference locationUpdateReference, java.lang.Object batch, VeriplaceException exception)
          Called by PollingManager when a call to PollingAPI.getUpdateLocation(com.veriplace.client.LocationUpdateReference, com.veriplace.oauth.consumer.Token, java.lang.Integer) caused an exception so that the location details for an update could not be retrieved, even though the original call to PollingAPI.getUpdates(Integer) succeeded.
 void handleUpdateQueryException(PollingManager manager, VeriplaceException exception)
          Called by PollingManager when a call to PollingAPI.getUpdates(Integer) caused an exception.
 void receivedLocation(PollingManager manager, User user, Location location, LocationUpdateReference locRef, java.lang.Object batch)
          Called by PollingManager when a new location becomes available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPollingHandler

public AbstractPollingHandler()
Method Detail

beginLocationBatch

public java.lang.Object beginLocationBatch(PollingManager manager,
                                           LocationUpdates locationUpdates)
Description copied from interface: PollingHandler
Called by PollingManager when a batch of locations is about to become available. Allows the handler to open a new database transaction if desired.

Specified by:
beginLocationBatch in interface PollingHandler
Parameters:
manager - the PollingManager that is calling this handler
locationUpdates - the LocationUpdates object representing the current query results (does not include location details)
Returns:
an opaque object the handler may use to maintain state information

receivedLocation

public void receivedLocation(PollingManager manager,
                             User user,
                             Location location,
                             LocationUpdateReference locRef,
                             java.lang.Object batch)
Description copied from interface: PollingHandler
Called by PollingManager when a new location becomes available.

Specified by:
receivedLocation in interface PollingHandler
Parameters:
manager - the PollingManager that is calling this handler
user - the Veriplace user identifier
location - the Veriplace location
locRef - uniquely identifies the location
batch - the value previously returned by PollingHandler.beginLocationBatch(com.veriplace.client.util.PollingManager, com.veriplace.client.LocationUpdates)

endLocationBatch

public void endLocationBatch(PollingManager manager,
                             java.lang.Object batch)
Description copied from interface: PollingHandler
Called by PollingManager when all the locations from the last update request have been processed. Allows the handler to commit a database transaction if desired.

Specified by:
endLocationBatch in interface PollingHandler
Parameters:
manager - the PollingManager that is calling this handler
batch - the value previously returned by PollingHandler.beginLocationBatch(com.veriplace.client.util.PollingManager, com.veriplace.client.LocationUpdates)

handleUpdateQueryException

public void handleUpdateQueryException(PollingManager manager,
                                       VeriplaceException exception)
Description copied from interface: PollingHandler
Called by PollingManager when a call to PollingAPI.getUpdates(Integer) caused an exception.

Specified by:
handleUpdateQueryException in interface PollingHandler
Parameters:
manager - the PollingManager that is calling this handler
exception - the exception that was thrown

handleLocationQueryException

public void handleLocationQueryException(PollingManager manager,
                                         User user,
                                         LocationUpdateReference locationUpdateReference,
                                         java.lang.Object batch,
                                         VeriplaceException exception)
Description copied from interface: PollingHandler
Called by PollingManager when a call to PollingAPI.getUpdateLocation(com.veriplace.client.LocationUpdateReference, com.veriplace.oauth.consumer.Token, java.lang.Integer) caused an exception so that the location details for an update could not be retrieved, even though the original call to PollingAPI.getUpdates(Integer) succeeded.

Specified by:
handleLocationQueryException in interface PollingHandler
Parameters:
manager - the PollingManager that is calling this handler
user - the user whose location was being queried
locationUpdateReference - the unique identifier of the location
batch - the value previously returned by PollingHandler.beginLocationBatch(com.veriplace.client.util.PollingManager, com.veriplace.client.LocationUpdates)
exception - the exception that was thrown