Class JCRLocalGoogleDrive.Sync
java.lang.Object
org.exoplatform.services.cms.clouddrives.gdrive.JCRLocalGoogleDrive.Sync
- All Implemented Interfaces:
org.exoplatform.services.cms.clouddrives.CloudDrive.Command
- Enclosing class:
- JCRLocalGoogleDrive
Sync algorithm for Google Drive.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPIGoogle Drive service API.protected org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPI.ChangesIteratorThe changes.protected LongLast change ID fetched and applied to the drive.Fields inherited from interface org.exoplatform.services.cms.clouddrives.CloudDrive.Command
COMPLETE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddeleteFile(String fileId) Remove file node.protected String[]getParents(com.google.api.services.drive.model.File gfile) Gets the parents.protected booleanisRemoved(com.google.api.services.drive.model.File gfile) Check if file isn't deleted/trashed in Google Drive, explicitly or as a part of its ancestor deletion/trashing.protected voidprotected voidprotected voidsyncNext()Sync next.protected voidupdateFile(com.google.api.services.drive.model.File gf, String[] parentIds) Create or update file's node.
-
Field Details
-
api
protected final org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPI apiGoogle Drive service API. -
changes
protected org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPI.ChangesIterator changesThe changes. -
lastChangeId
Last change ID fetched and applied to the drive. Used bypreSaveChunk().
-
-
Constructor Details
-
Sync
protected Sync() throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.DriveRemovedExceptionCreate command for Google Drive synchronization.- Throws:
javax.jcr.RepositoryException- the repository exceptionorg.exoplatform.services.cms.clouddrives.DriveRemovedException- the drive removed exception
-
-
Method Details
-
syncFiles
protected void syncFiles() throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException- Throws:
javax.jcr.RepositoryExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException
-
syncNext
protected void syncNext() throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveExceptionSync next.- Throws:
javax.jcr.RepositoryException- the repository exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
preSaveChunk
protected void preSaveChunk() throws org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveExceptionjavax.jcr.RepositoryException
-
deleteFile
protected void deleteFile(String fileId) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException Remove file node.- Parameters:
fileId-String- Throws:
javax.jcr.RepositoryException- the repository exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
updateFile
protected void updateFile(com.google.api.services.drive.model.File gf, String[] parentIds) throws org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException Create or update file's node.- Parameters:
gf-FileparentIds- array of Ids of parents (folders)- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exceptionjavax.jcr.RepositoryException- the repository exception
-
getParents
Gets the parents.- Parameters:
gfile- the gfile- Returns:
- the parents
-
isRemoved
protected boolean isRemoved(com.google.api.services.drive.model.File gfile) throws GoogleDriveException Check if file isn't deleted/trashed in Google Drive, explicitly or as a part of its ancestor deletion/trashing.- Parameters:
gfile- the gfile- Returns:
Booleantrueif the file or its ancestor was deleted or trashed,falseotherwise- Throws:
GoogleDriveException- the google drive exception
-