本文整理汇总了Java中com.evernote.clients.ClientFactory.createUserStoreClient方法的典型用法代码示例。如果您正苦于以下问题:Java ClientFactory.createUserStoreClient方法的具体用法?Java ClientFactory.createUserStoreClient怎么用?Java ClientFactory.createUserStoreClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.evernote.clients.ClientFactory
的用法示例。
在下文中一共展示了ClientFactory.createUserStoreClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MyEvernoteService
import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
/**
* Creates a service used to access Evernote
*
* @param token authentication token
* @param sandbox true for snadox, false for prouction enviroment
* @throws Exception
*/
public MyEvernoteService(String token, boolean sandbox) throws Exception {
this.token = token;
// Set up the UserStore client and check that we can speak to the server
EvernoteService service = EvernoteService.PRODUCTION;
if ( sandbox ) {
service = EvernoteService.SANDBOX;
}
EvernoteAuth evernoteAuth = new EvernoteAuth(service, token);
ClientFactory factory = new ClientFactory(evernoteAuth);
userStore = factory.createUserStoreClient();
boolean versionOk = userStore.checkVersion("EvernoteMarkdownSync",
com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);
if (!versionOk) {
LOG.error("Incompatible Evernote client protocol version");
System.exit(1);
}
// Set up the NoteStore client
noteStore = factory.createNoteStoreClient();
}
示例2: HelpEverNote
import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
/**
* Intialize UserStore and NoteStore clients. During this step, we
* authenticate with the Evernote web service. All of this code is
* boilerplate - you can copy it straight into your application.
*/
public HelpEverNote() throws Exception {
// Set up the UserStore client and check that we can speak to the server
EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.SANDBOX,
AUTH_TOKEN);
ClientFactory factory = ClientFactory.getInstance(evernoteAuth);
userStore = factory.createUserStoreClient();
boolean versionOk = userStore.checkVersion("Evernote EDAMDemo (Java)",
com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);
if (!versionOk) {
System.err.println("Incompatible Evernote client protocol version");
System.exit(1);
}
// Set up the NoteStore client
noteStore = factory.createNoteStoreClient();
}
示例3: EverNoteHelp
import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
public EverNoteHelp() throws Exception {
// Set up the UserStore client and check that we can speak to the server
EvernoteAuth evernoteAuth = new EvernoteAuth(EvernoteService.SANDBOX,
AUTH_TOKEN);
ClientFactory factory = ClientFactory.getInstance(evernoteAuth);
userStore = factory.createUserStoreClient();
boolean versionOk = userStore.checkVersion("Evernote EDAMDemo (Java)",
com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR,
com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR);
if (!versionOk) {
}
noteStore = factory.createNoteStoreClient();
}
示例4: evernoteNoteStoreGet
import com.evernote.clients.ClientFactory; //导入方法依赖的package包/类
@Override
public SSEvernoteInfo evernoteNoteStoreGet(final SSEvernoteNoteStoreGetPar par) throws SSErr {
try{
final EvernoteAuth evernoteAuth = new EvernoteAuth (EvernoteService.PRODUCTION, par.authToken);
final ClientFactory clientFactory = new ClientFactory (evernoteAuth);
final UserStoreClient userStore = clientFactory.createUserStoreClient();
final NoteStoreClient noteStore = clientFactory.createNoteStoreClient();
final SSUri shardUri = SSUri.get(userStore.getPublicUserInfo(userStore.getUser().getUsername()).getWebApiUrlPrefix());
final SyncChunkFilter filter = new SyncChunkFilter();
SyncChunk noteStoreSyncChunk;
Integer lastUSN;
filter.setIncludeNotes (true);
filter.setIncludeNoteResources (true);
filter.setIncludeNoteAttributes (true);
filter.setIncludeNotebooks (true);
filter.setIncludeTags (true);
filter.setIncludeSearches (false);
filter.setIncludeResources (true);
filter.setIncludeLinkedNotebooks (true);
filter.setIncludeExpunged (false);
filter.setIncludeNoteApplicationDataFullMap (true);
filter.setIncludeResourceApplicationDataFullMap (true);
filter.setIncludeNoteResourceApplicationDataFullMap (true);
noteStoreSyncChunk =
noteStore.getFilteredSyncChunk(
sql.getUSN(par, par.authToken),
1000000,
filter);
if(noteStoreSyncChunk.isSetChunkHighUSN()){
lastUSN = noteStoreSyncChunk.getChunkHighUSN();
}else{
lastUSN = noteStoreSyncChunk.getUpdateCount();
}
if(
!noteStoreSyncChunk.isSetUpdateCount() ||
!noteStoreSyncChunk.isSetChunkHighUSN() ||
(lastUSN >= noteStoreSyncChunk.getUpdateCount()) && lastUSN >= sql.getUSN(par, par.authToken)){
SSLogU.debug(par.authEmail + " received full evernote content");
}else{
SSLogU.info(par.authEmail + " needs further syncing to retrieve full evernote content");
}
// if(lastUSN != noteStoreSyncChunk.getUpdateCount()){
// SSLogU.warn(par.authEmail + " didnt receive latest information from evernote | more than 1.000.000 (new) entries available");
// }
return SSEvernoteInfo.get(
userStore,
noteStore,
shardUri,
noteStoreSyncChunk,
par.authToken);
// https://sandbox.evernote.com/shard/s1/sh/72ddd50f-5d13-46e3-b32d-d2b314ced5c1/ea77ae0587d735f39a94868ce3ddab5f
}catch(EDAMSystemException edamError){
if(gotToSleep(edamError, par.authEmail)){
return evernoteNoteStoreGet(par);
}else{
SSServErrReg.regErrThrow(edamError);
return null;
}
}catch(Exception error){
SSServErrReg.regErrThrow(error);
return null;
}
}