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

protected class JCRLocalGoogleDrive.Sync extends Object
Sync algorithm for Google Drive.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPI
    Google Drive service API.
    protected org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPI.ChangesIterator
    The changes.
    protected Long
    Last change ID fetched and applied to the drive.

    Fields inherited from interface org.exoplatform.services.cms.clouddrives.CloudDrive.Command

    COMPLETE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Create command for Google Drive synchronization.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Remove file node.
    protected String[]
    getParents(com.google.api.services.drive.model.File gfile)
    Gets the parents.
    protected boolean
    isRemoved(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 void
    protected void
    protected void
    Sync next.
    protected void
    updateFile(com.google.api.services.drive.model.File gf, String[] parentIds)
    Create or update file's node.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • api

      protected final org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPI api
      Google Drive service API.
    • changes

      protected org.exoplatform.services.cms.clouddrives.gdrive.GoogleDriveAPI.ChangesIterator changes
      The changes.
    • lastChangeId

      protected Long lastChangeId
      Last change ID fetched and applied to the drive. Used by preSaveChunk().
  • Constructor Details

    • Sync

      protected Sync() throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.DriveRemovedException
      Create command for Google Drive synchronization.
      Throws:
      javax.jcr.RepositoryException - the repository exception
      org.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.RepositoryException
      org.exoplatform.services.cms.clouddrives.CloudDriveException
    • syncNext

      protected void syncNext() throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException
      Sync next.
      Throws:
      javax.jcr.RepositoryException - the repository exception
      org.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.CloudDriveException
      javax.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 exception
      org.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 - File
      parentIds - array of Ids of parents (folders)
      Throws:
      org.exoplatform.services.cms.clouddrives.CloudDriveException - the cloud drive exception
      javax.jcr.RepositoryException - the repository exception
    • getParents

      protected String[] getParents(com.google.api.services.drive.model.File gfile)
      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:
      Boolean true if the file or its ancestor was deleted or trashed, false otherwise
      Throws:
      GoogleDriveException - the google drive exception