本文整理汇总了Java中com.google.api.services.drive.model.About类的典型用法代码示例。如果您正苦于以下问题:Java About类的具体用法?Java About怎么用?Java About使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
About类属于com.google.api.services.drive.model包,在下文中一共展示了About类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makedir
import com.google.api.services.drive.model.About; //导入依赖的package包/类
@Override
public void makedir(String path) throws IOException {
//Obtain the root id
if (rootId.equals("")) {
try {
About about;
about = service.about().get().execute();
rootId = about.getRootFolderId();
} catch (IOException ex) {
Logger.getLogger(GoogleDriveClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
mkDirs(path, rootId);
}
示例2: testValidate
import com.google.api.services.drive.model.About; //导入依赖的package包/类
@Test
public void testValidate() throws Exception {
dataSource.initialize(container, inputProperties);
assertEquals(Result.ERROR, dataSource.validate(container).getStatus());
dataSource = spy(dataSource);
Drive drive = mock(Drive.class, RETURNS_DEEP_STUBS);
GoogleDriveUtils utils = mock(GoogleDriveUtils.class, RETURNS_DEEP_STUBS);
doReturn(drive).when(dataSource).getDriveService();
doReturn(utils).when(dataSource).getDriveUtils();
inputProperties.getDatasetProperties().getDatastoreProperties().serviceAccountJSONFile.setValue("service.json");
dataSource.initialize(container, inputProperties);
About about = new About();
User user = new User();
user.setEmailAddress("[email protected]");
about.setUser(user);
when(drive.about().get().setFields(anyString()).execute()).thenReturn(about);
assertEquals(Result.OK, dataSource.validate(container).getStatus());
}
示例3: finishInitialization
import com.google.api.services.drive.model.About; //导入依赖的package包/类
private void finishInitialization(AccountData newAccountData, String accountName) throws IOException
{
if (TextUtils.isEmpty(newAccountData.mRootFolderId))
{
logDebug("Finish init account for " + accountName);
About about = newAccountData.drive.about().get().execute();
newAccountData.mRootFolderId = about.getRootFolderId();
}
else
{
logDebug("Account for " + accountName + " already fully initialized.");
}
}
示例4: get
import com.google.api.services.drive.model.About; //导入依赖的package包/类
@Override
public Space get() throws BackgroundException {
try {
final About about = session.getClient().about().get().setFields("user, storageQuota").execute();
final Long used = null == about.getStorageQuota().getUsage() ? 0L
: about.getStorageQuota().getUsage();
final Long available = null == about.getStorageQuota().getLimit() ? Long.MAX_VALUE
: about.getStorageQuota().getLimit() - used;
return new Space(used, available);
}
catch(IOException e) {
throw new DriveExceptionMappingService().map("Failure to read attributes of {0}", e,
new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)));
}
}
示例5: testValidateConnection
import com.google.api.services.drive.model.About; //导入依赖的package包/类
@Test
public void testValidateConnection() throws Exception {
About about = new About();
User user = new User();
user.setEmailAddress("te[email protected]");
about.setUser(user);
when(drive.about().get().setFields(anyString()).execute()).thenReturn(about);
assertEquals(Result.OK, testRuntime.validateConnection(testRuntime.getConnectionProperties()).getStatus());
}
示例6: getRootFolderID
import com.google.api.services.drive.model.About; //导入依赖的package包/类
protected String getRootFolderID() throws IOException {
if ((drive != null) && (rootFolderId == null)) {
About aAbout = drive.about().get().execute();
rootFolderId = aAbout.get("rootFolderId").toString();
}
return rootFolderId;
}
示例7: performInitialSync
import com.google.api.services.drive.model.About; //导入依赖的package包/类
/**
* Performs initial sync.
*/
private void performInitialSync() throws IOException {
// Get the largest change id first to avoid race conditions
About about = drive.about().get().setFields(ABOUT_GET_FIELDS).execute();
long largestChangeId = about.getLargestChangeId();
// Get all the KML/KMZ files in the "My Drive:/My Tracks" folder
Files.List myTracksFolderRequest = drive.files()
.list().setQ(String.format(Locale.US, SyncUtils.MY_TRACKS_FOLDER_FILES_QUERY, folderId));
Map<String, File> myTracksFolderMap = getFiles(myTracksFolderRequest, true);
// Handle tracks that are already uploaded to Google Drive
Set<String> syncedDriveIds = updateSyncedTracks();
for (String driveId : syncedDriveIds) {
myTracksFolderMap.remove(driveId);
}
// Get all the KML/KMZ files in the "Shared with me:/" folder
Files.List sharedWithMeRequest = drive.files()
.list().setQ(SyncUtils.SHARED_WITH_ME_FILES_QUERY);
Map<String, File> sharedWithMeMap = getFiles(sharedWithMeRequest, false);
try {
insertNewTracks(myTracksFolderMap.values());
insertNewTracks(sharedWithMeMap.values());
PreferencesUtils.setLong(context, R.string.drive_largest_change_id_key, largestChangeId);
} catch (IOException e) {
// Remove all imported tracks
Cursor cursor = null;
try {
cursor = myTracksProviderUtils.getTrackCursor(SyncUtils.DRIVE_ID_TRACKS_QUERY, null, null);
if (cursor != null && cursor.moveToFirst()) {
do {
Track track = myTracksProviderUtils.createTrack(cursor);
if (!syncedDriveIds.contains(track.getDriveId())) {
myTracksProviderUtils.deleteTrack(context, track.getId());
}
} while (cursor.moveToNext());
}
} finally {
if (cursor != null) {
cursor.close();
}
}
throw e;
}
}
示例8: getAuthenticatedUser
import com.google.api.services.drive.model.About; //导入依赖的package包/类
private UserInfo getAuthenticatedUser(Drive drive, IProgressMonitor monitor) throws IOException {
SubMonitor subMonitor = SubMonitor.convert(monitor);
About about = drive.about().get().execute();
User user = about.getUser();
return new UserInfo(user.getEmailAddress(), user.getDisplayName());
}
示例9: BasicInfo
import com.google.api.services.drive.model.About; //导入依赖的package包/类
public BasicInfo(About about) {
largestChangeId = about.getLargestChangeId();
rootFolderId = about.getRootFolderId();
}