// Authenticate to the owner's shard
String linkedNoteStoreUrl = noteStoreUrlBase + books.get(i).getShardId();
logger.log(logger.EXTREME, "linkedNoteStoreURL: " +linkedNoteStoreUrl);
THttpClient linkedNoteStoreTrans = new THttpClient(linkedNoteStoreUrl);
TBinaryProtocol linkedNoteStoreProt = new TBinaryProtocol(linkedNoteStoreTrans);
Client linkedNoteStore = new NoteStore.Client(linkedNoteStoreProt, linkedNoteStoreProt);
linkedAuthResult = null;
if (books.get(i).getShareKey() != null) {
logger.log(logger.EXTREME, "Share Key Not Null: " +books.get(i).getShareKey());
linkedAuthResult = linkedNoteStore.authenticateToSharedNotebook(books.get(i).getShareKey(), authToken);
logger.log(logger.EXTREME, "Authentication Token" +linkedAuthResult.getAuthenticationToken());
} else {
logger.log(logger.EXTREME, "Share key is null");
linkedAuthResult = new AuthenticationResult();
linkedAuthResult.setAuthenticationToken("");
}
SyncState linkedSyncState =
linkedNoteStore.getLinkedNotebookSyncState(linkedAuthResult.getAuthenticationToken(), books.get(i));
if (linkedSyncState.getUpdateCount() > lastSequenceNumber) {
logger.log(logger.EXTREME, "Remote changes found");
if (lastSyncDate < linkedSyncState.getFullSyncBefore()) {
lastSequenceNumber = 0;
}