Methods Summary |
---|
protected java.lang.String | cursorToEntry(android.content.SyncContext context, android.database.Cursor c, com.google.wireless.gdata.data.Entry baseEntry, java.lang.Object syncInfo)
final String account = c.getString(c.getColumnIndex(SubscribedFeeds.Feeds._SYNC_ACCOUNT));
final String service = c.getString(c.getColumnIndex(SubscribedFeeds.Feeds.SERVICE));
final String id = c.getString(c.getColumnIndex(SubscribedFeeds.Feeds._SYNC_ID));
final String feed = c.getString(c.getColumnIndex(SubscribedFeeds.Feeds.FEED));
String authToken;
try {
authToken =
GoogleLoginServiceBlockingHelper.getAuthToken(getContext(), account, service);
} catch (GoogleLoginServiceBlockingHelper.AuthenticationException e) {
Log.e("Sync", "caught exception while attempting to get an " +
"authtoken for account " + account +
", service " + service + ": " + e.toString());
throw new ParseException(e.getMessage(), e);
} catch (GoogleLoginServiceNotFoundException e) {
Log.e("Sync", "caught exception while attempting to get an " +
"authtoken for account " + account +
", service " + service + ": " + e.toString());
throw new ParseException(e.getMessage(), e);
}
FeedUrl subscribedFeedUrl = new FeedUrl(feed, service, authToken);
SubscribedFeedsEntry entry = (SubscribedFeedsEntry) baseEntry;
if (id != null) {
entry.setId(getFeedUrl(account) + "/" + id);
entry.setEditUri(entry.getId());
}
entry.setRoutingInfo(getRoutingInfoForAccount(account));
entry.setSubscribedFeed(subscribedFeedUrl);
entry.setClientToken(subscribedFeedUrl.getFeed());
String createUrl = null;
if (id == null) {
createUrl = getFeedUrl(account);
}
return createUrl;
|
protected void | deletedCursorToEntry(android.content.SyncContext context, android.database.Cursor c, com.google.wireless.gdata.data.Entry entry)
final String id = c.getString(c.getColumnIndexOrThrow(SubscribedFeeds.Feeds._SYNC_ID));
entry.setId(id);
entry.setEditUri(getFeedUrl(getAccount()) + "/" + id);
|
protected android.database.Cursor | getCursorForDeletedTable(android.content.ContentProvider cp, java.lang.Class entryClass)
if (entryClass != SubscribedFeedsEntry.class) {
throw new IllegalArgumentException("unexpected entry class, " + entryClass.getName());
}
return cp.query(SubscribedFeeds.Feeds.DELETED_CONTENT_URI, null, null, null, null);
|
protected android.database.Cursor | getCursorForTable(android.content.ContentProvider cp, java.lang.Class entryClass)
if (entryClass != SubscribedFeedsEntry.class) {
throw new IllegalArgumentException("unexpected entry class, " + entryClass.getName());
}
return cp.query(SubscribedFeeds.Feeds.CONTENT_URI, null, null, null, null);
|
protected java.lang.Class | getFeedEntryClass()
return SubscribedFeedsEntry.class;
|
protected java.lang.String | getFeedUrl(java.lang.String account)
return FEED_URL;
|
protected com.google.wireless.gdata.client.GDataServiceClient | getGDataServiceClient()
return mSubscribedFeedsClient;
|
public java.lang.String | getRoutingInfoForAccount(java.lang.String account)Returns a string that can be used by the GSyncSubscriptionServer to
route messages back to this account via GTalkService.
TODO: this should eventually move into a general place so that others
can use it.
long androidId;
try {
androidId = GoogleLoginServiceBlockingHelper.getAndroidId(getContext());
} catch (GoogleLoginServiceNotFoundException e) {
Log.e(TAG, "Could not get routing info for account", e);
return null;
}
return Uri.parse("gtalk://" + account
+ "#" + Settings.getGTalkDeviceId(androidId)).toString();
|
public void | getServerDiffs(android.content.SyncContext context, SyncData syncData, android.content.SyncableContentProvider tempProvider, android.os.Bundle extras, java.lang.Object syncInfo, android.content.SyncResult syncResult)
tempProvider.setContainsDiffs(false /* the server returns all records, not just diffs */);
super.getServerDiffs(context, syncData, tempProvider, extras, syncInfo, syncResult);
|
protected boolean | handleAllDeletedUnavailable(GDataSyncData syncData, java.lang.String feed)
Log.w(TAG, "subscribed feeds don't use tombstones");
// this should never happen, but if it does pretend that we are able to handle it.
return true;
|
protected boolean | hasTooManyDeletions(android.content.SyncStats stats)
// allow subscribed feeds to delete any number of entries,
// since the client is the authority on which entries
// should exist.
return false;
|
protected com.google.wireless.gdata.data.Entry | newEntry()
return new SubscribedFeedsEntry();
|
public void | onAccountsChanged(java.lang.String[] accounts)
// no need to do anything
|
protected void | updateProvider(com.google.wireless.gdata.data.Feed feed, java.lang.Long syncLocalId, com.google.wireless.gdata.data.Entry baseEntry, android.content.ContentProvider provider, java.lang.Object syncInfo)
ContentValues values = new ContentValues();
values.put(SubscribedFeeds.Feeds._SYNC_ACCOUNT, getAccount());
values.put(SubscribedFeeds.Feeds._SYNC_LOCAL_ID, syncLocalId);
final SubscribedFeedsEntry entry = (SubscribedFeedsEntry) baseEntry;
final String id = entry.getId();
final String editUri = entry.getEditUri();
String version = null;
if (!TextUtils.isEmpty(id) && !TextUtils.isEmpty(editUri)) {
final String serverId = id.substring(id.lastIndexOf('/") + 1);
version = editUri.substring(editUri.lastIndexOf('/") + 1);
values.put(SubscribedFeeds.Feeds._SYNC_ID, serverId);
values.put(SubscribedFeeds.Feeds._SYNC_VERSION, version);
}
if (baseEntry.isDeleted()) {
provider.insert(SubscribedFeeds.Feeds.DELETED_CONTENT_URI, values);
} else {
values.put(SubscribedFeeds.Feeds.FEED, entry.getSubscribedFeed().getFeed());
if (!TextUtils.isEmpty(version)) {
values.put(SubscribedFeeds.Feeds._SYNC_TIME, version);
}
values.put(SubscribedFeeds.Feeds._SYNC_DIRTY, "0");
provider.insert(SubscribedFeeds.Feeds.CONTENT_URI, values);
}
|
protected void | updateQueryParameters(com.google.wireless.gdata.client.QueryParams params)
params.setParamValue(ROUTINGINFO_PARAMETER, getRoutingInfoForAccount(getAccount()));
|