Java Code Examples for com.google.api.client.util.store.DataStore#delete()

The following examples show how to use com.google.api.client.util.store.DataStore#delete() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GoogleDriveServiceImpl.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public boolean revokeGoogleDriveConfiguration(String userId){
	log.info("revokeGoogleDriveConfiguration for user {}", userId);
	try {
		cleanGoogleDriveCacheForUser(userId);
		DataStore<StoredCredential> credentialStore = flow.getCredentialDataStore();
		return (credentialStore.delete(userId) != null);
	} catch (Exception e) {
		log.warn("Error while trying to remove GoogleDrive configuration : {}", e.getMessage());
	}
	return false;
}
 
Example 2
Source File: GoogleDriveServiceImpl.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public boolean revokeGoogleDriveConfiguration(String userId){
	log.info("revokeGoogleDriveConfiguration for user {}", userId);
	try {
		cleanGoogleDriveCacheForUser(userId);
		DataStore<StoredCredential> credentialStore = flow.getCredentialDataStore();
		return (credentialStore.delete(userId) != null);
	} catch (Exception e) {
		log.warn("Error while trying to remove GoogleDrive configuration : {}", e.getMessage());
	}
	return false;
}
 
Example 3
Source File: ApigeeDataClient.java    From apigee-android-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * Deletes the TokenResponse that is associated with the given storageId from the file data store.
 *
 * @param storageId The storageId associated with the stored TokenResponse.
 */
public void deleteStoredOAuth2TokenData(String storageId) {
    try {
        File oauth2StorageFolder = new File(this.context.getFilesDir(),"oauth2StorageFolder");
        oauth2StorageFolder.mkdirs();
        FileDataStoreFactory fileDataStoreFactory = new FileDataStoreFactory(oauth2StorageFolder);
        DataStore<StoredCredential> storedCredentialDataStore = fileDataStoreFactory.getDataStore(storageId);
        storedCredentialDataStore.delete(storageId);
    } catch ( Exception exception ) {
        logInfo("Exception deleting OAuth2TokenData :" + exception.getLocalizedMessage());
    }
}