本文整理汇总了Java中com.evernote.edam.userstore.BootstrapInfo类的典型用法代码示例。如果您正苦于以下问题:Java BootstrapInfo类的具体用法?Java BootstrapInfo怎么用?Java BootstrapInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BootstrapInfo类属于com.evernote.edam.userstore包,在下文中一共展示了BootstrapInfo类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
/**
* Makes a web request to get the latest bootstrap information.
* This is a requirement during the oauth process
*
* @return {@link BootstrapInfoWrapper}
* @throws Exception
*/
BootstrapInfoWrapper getBootstrapInfo() throws Exception {
Log.d(LOGTAG, "getBootstrapInfo()");
BootstrapInfo bsInfo = null;
try {
if (mBootstrapServerUsed == null) {
initializeUserStoreAndCheckVersion();
}
bsInfo = mEvernoteSession.getEvernoteClientFactory().getUserStoreClient(getUserStoreUrl(mBootstrapServerUsed), null).getBootstrapInfo(mLocale.toString());
printBootstrapInfo(bsInfo);
} catch (TException e) {
Log.e(LOGTAG, "error getting bootstrap info", e);
}
return new BootstrapInfoWrapper(mBootstrapServerUsed, bsInfo);
}
示例2: getBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
/**
* Makes a web request to get the latest bootstrap information
* This is a requirement during the oauth process
*
* @return {@link BootstrapInfoWrapper}
* @throws Exception
*/
BootstrapInfoWrapper getBootstrapInfo() throws Exception {
Log.d(LOGTAG, "getBootstrapInfo()");
BootstrapInfo bsInfo = null;
try {
if (mUserStoreClient == null) {
initializeUserStoreAndCheckVersion();
}
bsInfo = mUserStoreClient.getClient().getBootstrapInfo(mLocale.toString());
printBootstrapInfo(bsInfo);
} catch (ClientUnsupportedException cue) {
throw cue;
} catch (TException e) {
Log.e(LOGTAG, "error getting bootstrap info", e);
}
BootstrapInfoWrapper wrapper = new BootstrapInfoWrapper(mBootstrapServerUsed, bsInfo);
return wrapper;
}
示例3: printBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
/**
* Log the {@link BootstrapProfile} list.
* @param bsInfo
*/
void printBootstrapInfo(BootstrapInfo bsInfo) {
if (bsInfo == null) return;
Log.d(LOGTAG, "printBootstrapInfo");
List<BootstrapProfile> profiles = bsInfo.getProfiles();
if (profiles != null) {
for (BootstrapProfile profile : profiles) {
Log.d(LOGTAG, profile.toString());
}
} else {
Log.d(LOGTAG, "Profiles are null");
}
}
示例4: fetchBootstrapProfiles
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
public List<BootstrapProfile> fetchBootstrapProfiles() throws Exception {
//Network request
BootstrapManager.BootstrapInfoWrapper infoWrapper = new BootstrapManager(mSession.getEvernoteService(), mSession, mLocale).getBootstrapInfo();
if (infoWrapper == null) {
return null;
}
BootstrapInfo info = infoWrapper.getBootstrapInfo();
if (info == null) {
return null;
}
return info.getProfiles();
}
示例5: getBootstrapInfoAsync
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
public Future<BootstrapInfo> getBootstrapInfoAsync(final String locale, EvernoteCallback<BootstrapInfo> callback) {
return submitTask(new Callable<BootstrapInfo>() {
@Override
public BootstrapInfo call() throws Exception {
return getBootstrapInfo(locale);
}
}, callback);
}
示例6: printBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
/**
* Log the {@link BootstrapProfile} list
* @param bsInfo
*/
void printBootstrapInfo(BootstrapInfo bsInfo) {
if (bsInfo == null) return;
Log.d(LOGTAG, "printBootstrapInfo");
List<BootstrapProfile> profiles = bsInfo.getProfiles();
if (profiles != null) {
for (BootstrapProfile profile : profiles) {
Log.d(LOGTAG, profile.toString());
}
} else {
Log.d(LOGTAG, "Profiles are null");
}
}
示例7: BootstrapInfoWrapper
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
BootstrapInfoWrapper(String serverUrl, BootstrapInfo info) {
mServerUrl = serverUrl;
mBootstrapInfo = info;
}
示例8: getBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
public BootstrapInfo getBootstrapInfo(String locale) throws TException {
return mClient.getBootstrapInfo(locale);
}
示例9: doInBackground
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
@Override
protected String doInBackground(Void... params) {
String url = null;
try {
EvernoteSession session = EvernoteSession.getOpenSession();
if (session != null) {
//Network request
BootstrapManager.BootstrapInfoWrapper infoWrapper = session.getBootstrapSession().getBootstrapInfo();
if (infoWrapper != null) {
BootstrapInfo info = infoWrapper.getBootstrapInfo();
if (info != null) {
mBootstrapProfiles = (ArrayList<BootstrapProfile>) info.getProfiles();
if (mBootstrapProfiles != null &&
mBootstrapProfiles.size() > 0 &&
mSelectedBootstrapProfilePos < mBootstrapProfiles.size()) {
mSelectedBootstrapProfile = mBootstrapProfiles.get(mSelectedBootstrapProfilePos);
}
}
}
}
if (mSelectedBootstrapProfile == null || TextUtils.isEmpty(mSelectedBootstrapProfile.getSettings().getServiceHost())) {
Log.d(LOGTAG, "Bootstrap did not return a valid host");
return null;
}
OAuthService service = createService();
Log.i(LOGTAG, "Retrieving OAuth request token...");
Token reqToken = service.getRequestToken();
mRequestToken = reqToken.getToken();
mRequestTokenSecret = reqToken.getSecret();
Log.i(LOGTAG, "Redirecting user for authorization...");
url = service.getAuthorizationUrl(reqToken);
if (mSupportAppLinkedNotebooks) {
url += "&supportLinkedSandbox=true";
}
} catch (BootstrapManager.ClientUnsupportedException cue) {
return null;
} catch (Exception ex) {
Log.e(LOGTAG, "Failed to obtain OAuth request token", ex);
}
return url;
}
示例10: testGetBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
@Test
public void testGetBootstrapInfo() throws Exception {
BootstrapSettings settings = new BootstrapSettings();
settings.setServiceHost("SERVICE_HOST");
settings.setMarketingUrl("MARKETING_URL");
settings.setSupportUrl("SUPPORT_URL");
settings.setAccountEmailDomain("ACCOUNT_EMAIL_DOMAIN");
settings.setEnableFacebookSharing(true);
settings.setEnableGiftSubscriptions(true);
settings.setEnableSupportTickets(true);
settings.setEnableSharedNotebooks(true);
settings.setEnableSingleNoteSharing(true);
settings.setEnableSponsoredAccounts(true);
settings.setEnableTwitterSharing(true);
settings.setEnableLinkedInSharing(true);
settings.setEnablePublicNotebooks(true);
BootstrapProfile profile = new BootstrapProfile();
profile.setName("PROFILE_NAME");
profile.setSettings(settings);
List<BootstrapProfile> profiles = new ArrayList<BootstrapProfile>();
profiles.add(profile);
BootstrapInfo bootstrapInfo = new BootstrapInfo();
bootstrapInfo.setProfiles(profiles);
when(userStoreOperations.getBootstrapInfo("foo")).thenReturn(bootstrapInfo);
performRequest("/userStore/getBootstrapInfo", "{\"locale\": \"foo\"}")
.andExpect(jsonPath("$.profiles[0].name").value("PROFILE_NAME"))
.andExpect(jsonPath("$.profiles[0].settings.serviceHost").value("SERVICE_HOST"))
.andExpect(jsonPath("$.profiles[0].settings.marketingUrl").value("MARKETING_URL"))
.andExpect(jsonPath("$.profiles[0].settings.supportUrl").value("SUPPORT_URL"))
.andExpect(jsonPath("$.profiles[0].settings.accountEmailDomain").value("ACCOUNT_EMAIL_DOMAIN"))
.andExpect(jsonPath("$.profiles[0].settings.enableFacebookSharing").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enableGiftSubscriptions").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enableSupportTickets").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enableSharedNotebooks").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enableSingleNoteSharing").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enableSponsoredAccounts").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enableTwitterSharing").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enableLinkedInSharing").value(true))
.andExpect(jsonPath("$.profiles[0].settings.enablePublicNotebooks").value(true))
;
verify(userStoreOperations).getBootstrapInfo("foo");
}
开发者ID:ttddyy,项目名称:evernote-rest-webapp,代码行数:47,代码来源:StoreOperationControllerUserStoreIntegrationTest.java
示例11: doInBackground
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
@Override
protected String doInBackground(Void... params) {
String url = null;
try {
EvernoteSession session = EvernoteSession.getOpenSession();
if (session != null) {
// Network request
BootstrapManager.BootstrapInfoWrapper infoWrapper = session
.getBootstrapSession().getBootstrapInfo();
if (infoWrapper != null) {
BootstrapInfo info = infoWrapper.getBootstrapInfo();
if (info != null) {
mBootstrapProfiles = (ArrayList<BootstrapProfile>) info
.getProfiles();
if (mBootstrapProfiles != null
&& mBootstrapProfiles.size() > 0
&& mSelectedBootstrapProfilePos < mBootstrapProfiles
.size()) {
mSelectedBootstrapProfile = mBootstrapProfiles
.get(mSelectedBootstrapProfilePos);
}
}
}
}
if (mSelectedBootstrapProfile == null
|| TextUtils.isEmpty(mSelectedBootstrapProfile
.getSettings().getServiceHost())) {
Log.d(LOGTAG, "Bootstrap did not return a valid host");
return null;
}
OAuthService service = createService();
Log.i(LOGTAG, "Retrieving OAuth request token...");
Token reqToken = service.getRequestToken();
mRequestToken = reqToken.getToken();
mRequestTokenSecret = reqToken.getSecret();
Log.i(LOGTAG, "Redirecting user for authorization...");
url = service.getAuthorizationUrl(reqToken);
} catch (BootstrapManager.ClientUnsupportedException cue) {
return null;
} catch (Exception ex) {
Log.e(LOGTAG, "Failed to obtain OAuth request token", ex);
}
return url;
}
示例12: doInBackground
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
@Override
protected String doInBackground(Void... params) {
String url = null;
try {
EvernoteSession session = EvernoteSession.getOpenSession();
if (session != null) {
//Network request
BootstrapManager.BootstrapInfoWrapper infoWrapper = session.getBootstrapSession().getBootstrapInfo();
if (infoWrapper != null){
BootstrapInfo info = infoWrapper.getBootstrapInfo();
if(info != null) {
mBootstrapProfiles = (ArrayList<BootstrapProfile>) info.getProfiles();
if (mBootstrapProfiles != null &&
mBootstrapProfiles.size() > 0 &&
mSelectedBootstrapProfilePos < mBootstrapProfiles.size()){
mSelectedBootstrapProfile = mBootstrapProfiles.get(mSelectedBootstrapProfilePos);
}
}
}
}
if(mSelectedBootstrapProfile == null || TextUtils.isEmpty(mSelectedBootstrapProfile.getSettings().getServiceHost())) {
Log.d(LOGTAG, "Bootstrap did not return a valid host");
return null;
}
OAuthService service = createService();
Log.i(LOGTAG, "Retrieving OAuth request token...");
Token reqToken = service.getRequestToken();
mRequestToken = reqToken.getToken();
mRequestTokenSecret = reqToken.getSecret();
Log.i(LOGTAG, "Redirecting user for authorization...");
url = service.getAuthorizationUrl(reqToken);
} catch(BootstrapManager.ClientUnsupportedException cue) {
return null;
} catch (Exception ex) {
Log.e(LOGTAG, "Failed to obtain OAuth request token", ex);
}
return url;
}
示例13: getBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
/**
* Asynchronous wrapper
*
* @param {@link OnClientCallback} providing an interface to the calling code
* @see UserStore.Client#getBootstrapInfo(String)
*/
public void getBootstrapInfo(final String locale, final OnClientCallback<BootstrapInfo> callback) {
AsyncReflector.execute(mClient, callback, "getBootstrapInfo", locale);
}
示例14: getBootstrapInfo
import com.evernote.edam.userstore.BootstrapInfo; //导入依赖的package包/类
/**
* Equivalent to {@link com.evernote.clients.UserStoreClient#getBootstrapInfo(String)}.
*
* @throws EvernoteException converted unchecked exception
* @see com.evernote.clients.UserStoreClient#getBootstrapInfo(String)
* @see com.evernote.edam.userstore.UserStore.Client#getBootstrapInfo(String)
*/
BootstrapInfo getBootstrapInfo(String locale) throws EvernoteException;