com.vodafone360.people.engine.contactsync
Class DownloadServerThumbnails_old

java.lang.Object
  extended by com.vodafone360.people.engine.contactsync.BaseSyncProcessor
      extended by com.vodafone360.people.engine.contactsync.DownloadServerThumbnails_old

public class DownloadServerThumbnails_old
extends BaseSyncProcessor

Handles download of Contact thumbnails from the People server. Thumbnails are downloaded via RPG external requests. Each contact retrieved from the server has a URL path to its thumbnail if one exists - an RPG external request is created for each thumbnail specifying the URL for the thumbnail. Internally the People client associates downloaded thumbnails with contacts via the local contact id.


Field Summary
private static int MAX_THUMBS_FETCHED_PER_PAGE
          Number of thumbnails to fetch in a single RPG request batch
private  int mBatchNoOfThumbs
          Total no of thumbnails requested in the current batch
private  int mBatchThumbsReceived
          Number of thumbnails received so far in the current batch
private  java.util.Map<java.lang.Integer,java.lang.Long> mContIds
          Maps request IDs to local contact IDs so that when a response is received we can link the response with a contact.
private  int mThumbnailsFetchedCount
          Number of thumbnails fetched so far.
private  int mTotalThumbnailsToFetch
          Total number of thumbnails we need to fetch (mainly used for monitoring progress)
 
Fields inherited from class com.vodafone360.people.engine.contactsync.BaseSyncProcessor
mCallback, mDb, mFailureList
 
Constructor Summary
DownloadServerThumbnails_old(IContactSyncCallback callback, DatabaseHelper db, Context context)
          Processor constructer.
 
Method Summary
protected  void doCancel()
          Called by framework when the contact sync is cancelled.
protected  void doStart()
          Called by framework to start the processor running.
private  void fetchNextPage()
          Sends next batch of thumbnail requests to the server.
private  void increaseCount()
           
 void processCommsResponse(ResponseQueue.Response resp)
          Called by framework when a response to one of the thumbnail requests is received.
 
Methods inherited from class com.vodafone360.people.engine.contactsync.BaseSyncProcessor
cancel, complete, getEngine, markDbChanged, onComplete, onTimeoutEvent, setReqId, setSyncStatus, setTimeout, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_THUMBS_FETCHED_PER_PAGE

private static final int MAX_THUMBS_FETCHED_PER_PAGE
Number of thumbnails to fetch in a single RPG request batch

See Also:
Constant Field Values

mTotalThumbnailsToFetch

private int mTotalThumbnailsToFetch
Total number of thumbnails we need to fetch (mainly used for monitoring progress)


mThumbnailsFetchedCount

private int mThumbnailsFetchedCount
Number of thumbnails fetched so far.


mBatchNoOfThumbs

private int mBatchNoOfThumbs
Total no of thumbnails requested in the current batch


mBatchThumbsReceived

private int mBatchThumbsReceived
Number of thumbnails received so far in the current batch


mContIds

private final java.util.Map<java.lang.Integer,java.lang.Long> mContIds
Maps request IDs to local contact IDs so that when a response is received we can link the response with a contact.

Constructor Detail

DownloadServerThumbnails_old

public DownloadServerThumbnails_old(IContactSyncCallback callback,
                                    DatabaseHelper db,
                                    Context context)
Processor constructer.

Parameters:
callback - Provides access to the contact sync engine processor methods.
db - Database for finding contacts that require thumbanils and updating thumbnail state flag for each contact.
context - Context for file operations
Method Detail

doStart

protected void doStart()
Called by framework to start the processor running. Issues a query to determine the total number of contacts which need thumbnails, then sends the first batch of thumbnail requests to the server.

Specified by:
doStart in class BaseSyncProcessor

doCancel

protected void doCancel()
Called by framework when the contact sync is cancelled. No implementation required, simply ignores the responses from the server.

Specified by:
doCancel in class BaseSyncProcessor

fetchNextPage

private void fetchNextPage()
Sends next batch of thumbnail requests to the server.


processCommsResponse

public void processCommsResponse(ResponseQueue.Response resp)
Called by framework when a response to one of the thumbnail requests is received. The thumbnail is saved in the local file system and the local database updated to indicate that the thumbnail has been sync'ed.

Specified by:
processCommsResponse in class BaseSyncProcessor
Parameters:
resp - The response data

increaseCount

private void increaseCount()


JavaDoc