Class JCRLocalDropboxDrive
- java.lang.Object
-
- org.exoplatform.services.cms.clouddrives.CloudDrive
-
- org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive
-
- org.exoplatform.clouddrive.dropbox.JCRLocalDropboxDrive
-
- All Implemented Interfaces:
org.exoplatform.services.cms.clouddrives.CloudDriveSecurity,org.exoplatform.services.cms.clouddrives.CloudDriveStorage,org.exoplatform.services.cms.clouddrives.oauth2.UserTokenRefreshListener
public class JCRLocalDropboxDrive extends org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive implements org.exoplatform.services.cms.clouddrives.oauth2.UserTokenRefreshListenerLocal drive for Dropbox provider.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceJCRLocalDropboxDrive.ChangesApplicable changes of local Drobpox drive.protected classJCRLocalDropboxDrive.ConnectConnect algorithm for Drobpox drive.protected classJCRLocalDropboxDrive.DeletedInfoThe Class DeletedInfo.protected classJCRLocalDropboxDrive.DropboxDriveThe Class DropboxDrive.classJCRLocalDropboxDrive.DropboxStateThe Class DropboxState.protected classJCRLocalDropboxDrive.EventsSyncAn implementation ofJCRLocalCloudDrive.SyncCommandbased on an abstract deltas queue proposed and maintained by the cloud service.protected classJCRLocalDropboxDrive.FileAPICloudFileAPIimplementation for Dropbox synchronization.protected classJCRLocalDropboxDrive.FileInfoThe Class FileInfo.protected classJCRLocalDropboxDrive.FolderInfoThe Class FolderInfo.protected classJCRLocalDropboxDrive.ItemInfoDropbox item helper to extract info from its file/folder metadata object.classJCRLocalDropboxDrive.JCRLocalDropboxFileDeprecated.protected classJCRLocalDropboxDrive.MetadataInfoDropbox item helper to extract info from its metadata object.protected classJCRLocalDropboxDrive.MovedFileThe Class MovedFile.protected classJCRLocalDropboxDrive.UnknownInfoThe Class UnknownInfo for not recognized changes.-
Nested classes/interfaces inherited from class org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive
org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.AbstractCommand, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.AbstractFileAPI, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.CommandCallable, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.ConnectCommand, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.DriveState, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.ExoJCREnvironment, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.ExoJCRSettings, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.FileChange, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.JCRListener, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.NoConnectCommand, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.NoSyncCommand, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.SyncCommand, org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.SyncFilesCommand
-
Nested classes/interfaces inherited from class org.exoplatform.services.cms.clouddrives.CloudDrive
org.exoplatform.services.cms.clouddrives.CloudDrive.Command, org.exoplatform.services.cms.clouddrives.CloudDrive.CommandProgress, org.exoplatform.services.cms.clouddrives.CloudDrive.FilesState, org.exoplatform.services.cms.clouddrives.CloudDrive.ListenerSupport
-
Nested classes/interfaces inherited from interface org.exoplatform.services.cms.clouddrives.CloudDriveStorage
org.exoplatform.services.cms.clouddrives.CloudDriveStorage.Change<R extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description static StringFOLDER_REVThe Constant FOLDER_REV.static StringFOLDER_TYPEThe Constant FOLDER_TYPE.protected JCRLocalDropboxDrive.DropboxStatestateDropbox drive state.-
Fields inherited from class org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive
accentsConverter, actionDrive, ALREADY_DONE, COMMAND_CHANGES_CHUNK, commandEnv, CURRENT_LOCALFORMAT, currentChangeId, currentConnect, currentSync, delayedSyncFiles, driveCommands, DUMMY_DATA, ECD_CLOUDDRIVE, ECD_CLOUDFILE, ECD_CLOUDFILERESOURCE, ECD_CLOUDFOLDER, ECD_IGNORED, ECD_LOCALFORMAT, EXO_DATETIME, EXO_MODIFY, EXO_THUMBNAIL, EXO_THUMBNAILS, EXO_TRASHFOLDER, fileAPI, fileChanges, fileChangeSequencer, fileCopies, fileHistory, fileRemovals, fileSynchronizers, fileTrash, finder, HISTORY_EXPIRATION, HISTORY_MAX_LENGTH, jcrListener, mimeTypes, MIX_REFERENCEABLE, MIX_VERSIONABLE, noConnect, noSync, NT_FILE, NT_FOLDER, NT_RESOURCE, NT_UNSTRUCTURED, repository, rootNodeHolder, rootSystemNodeHolder, rootUUID, rootWorkspace, sessionProviders, syncFilesMessages, syncLock, updating, user, USER_NODEPATH, USER_SESSIONPROVIDER, USER_WORKSPACE, workerExecutor
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJCRLocalDropboxDrive(org.exoplatform.clouddrive.dropbox.DropboxConnector.API apiFactory, DropboxProvider provider, javax.jcr.Node driveNode, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.services.cms.clouddrives.jcr.NodeFinder finder, org.exoplatform.services.cms.clouddrives.utils.ExtendedMimeTypeResolver mimeTypes)Instantiates a new JCR local dropbox drive.protectedJCRLocalDropboxDrive(DropboxUser user, javax.jcr.Node driveNode, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.services.cms.clouddrives.jcr.NodeFinder finder, org.exoplatform.services.cms.clouddrives.utils.ExtendedMimeTypeResolver mimeTypes)Instantiates a new JCR local dropbox drive.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringcleanPath(String path)Clean path from leading and ending slashes.protected org.exoplatform.services.cms.clouddrives.CloudFileAPIcreateFileAPI()protected StringcreateSharedLink(javax.jcr.Node fileNode)Creates the shared link.protected voidfetchItem(DropboxAPI api, JCRLocalDropboxDrive.MetadataInfo item, String parentId, javax.jcr.Node parentNode, Collection<org.exoplatform.services.cms.clouddrives.utils.ChunkIterator<?>> iterators, JCRLocalDropboxDrive.Changes changes)Fetch remote item, for a folder do recursive.protected org.exoplatform.clouddrive.dropbox.DropboxAPI.ListFolderfetchSubtree(DropboxAPI api, String itemId, javax.jcr.Node node, Collection<org.exoplatform.services.cms.clouddrives.utils.ChunkIterator<?>> iterators, JCRLocalDropboxDrive.Changes changes)Fetch subtree (children) of given item from remote side.protected StringfindMimetype(String fileName)Find mimetype.protected voidfixNameConflict(javax.jcr.Node file)protected StringfolderCursor(javax.jcr.Node node)Folder cursor.protected org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.ConnectCommandgetConnectCommand()protected StringgetDropboxPath(javax.jcr.Node localNode)Get Dropbox path saved in local item.org.exoplatform.services.cms.clouddrives.viewer.ContentReadergetFileContent(String idPath)org.exoplatform.services.cms.clouddrives.CloudDrive.FilesStategetState()protected org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.SyncCommandgetSyncCommand()DropboxUsergetUser()protected booleanhasDifferentRev(javax.jcr.Node node, JCRLocalDropboxDrive.FileInfo file)Checks for different rev.protected booleanhasLocationChanged(javax.jcr.Node node, JCRLocalDropboxDrive.ItemInfo item)Checks for location changed.protected booleanhasSameId(javax.jcr.Node node, JCRLocalDropboxDrive.ItemInfo item)Checks for same ID of local node and remote item.protected voidinitDrive(javax.jcr.Node driveNode)protected voidinitDropboxFile(javax.jcr.Node localNode, String rev, Long size)Initialize Dropbox file.protected voidinitDropboxFolder(javax.jcr.Node localNode, String cursor)Initialize Dropbox folder.protected voidinitDropboxPath(javax.jcr.Node localNode, String path)Init Dropbox dbxPath of local item.booleanisSharingSupported()protected JCRLocalDropboxDrive.MetadataInfoitemInfo(com.dropbox.core.v2.files.Metadata item)Metadata info.protected Stringlink(javax.jcr.Node fileNode)protected static DropboxUserloadUser(org.exoplatform.clouddrive.dropbox.DropboxConnector.API apiFactory, DropboxProvider provider, javax.jcr.Node driveNode)Load user from the drive Node.protected StringnodeName(String title)protected voidnormalizeName(javax.jcr.Node fileNode)Ensure the Dropbox file node has name in lower-case.voidonUserTokenRefresh(org.exoplatform.services.cms.clouddrives.oauth2.UserToken token)voidonUserTokenRemove()protected StringpreviewLink(String type, javax.jcr.Node fileNode)protected LongreadChangeId()protected voidrefreshAccess()protected voidsaveChangeId(Long id)voidshareFile(javax.jcr.Node fileNode, String... users)voidunshareFile(javax.jcr.Node fileNode, String... users)protected voidupdateAccess(org.exoplatform.services.cms.clouddrives.CloudUser newUser)protected org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudFileupdateItem(DropboxAPI api, JCRLocalDropboxDrive.MetadataInfo update, javax.jcr.Node parent, javax.jcr.Node node)Update, create or delete a local node of Cloud File.protected voidupdateState(String cursor)Update state.-
Methods inherited from class org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive
addJCRListener, addUpdating, await, checkNotTrashed, cleanName, cleanRemoved, cleanup, cleanUpdated, commitChanges, configure, connect, copyFile, create, currentUserName, disconnect, editLink, ensureSame, fileNode, findNode, findNodes, getChangeId, getConnectDate, getCurentCommand, getFile, getFilePreview, getId, getInitDate, getLink, getLocalUser, getOrCleanFileNode, getPath, getTitle, getWorkspace, hasChange, hasFile, hasRemoved, hasUpdated, ignore, initCommon, initCopy, initFile, initFolder, initRemove, initUpdating, isConnected, isDrive, isDrive, isIgnored, isInDrive, isInTrash, isLocal, isNew, isNewOrUpdating, isPrivilegedUser, isSameDrive, isUpdating, listFiles, listFiles, loadHistory, localChange, migrateName, moveFile, nextChangeId, openFile, openFolder, parentPath, readFile, readNode, readNodes, removeJCRListener, removeLinks, removeLinks, removeNode, removeUpdating, rollback, rollbackAllChanges, rootNode, rootNode, saveChanges, savedChanges, session, setChangeId, size, synchronize, systemSession, thumbnailLink, title, unignore
-
-
-
-
Field Detail
-
FOLDER_REV
public static final String FOLDER_REV
The Constant FOLDER_REV.
-
FOLDER_TYPE
public static final String FOLDER_TYPE
The Constant FOLDER_TYPE.
-
state
protected JCRLocalDropboxDrive.DropboxState state
Dropbox drive state. SeegetState().
-
-
Constructor Detail
-
JCRLocalDropboxDrive
protected JCRLocalDropboxDrive(DropboxUser user, javax.jcr.Node driveNode, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.services.cms.clouddrives.jcr.NodeFinder finder, org.exoplatform.services.cms.clouddrives.utils.ExtendedMimeTypeResolver mimeTypes) throws org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException
Instantiates a new JCR local dropbox drive.- Parameters:
user- the userdriveNode- the drive nodesessionProviders- the session providersfinder- the findermimeTypes- the mime types- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exceptionjavax.jcr.RepositoryException- the repository exception
-
JCRLocalDropboxDrive
protected JCRLocalDropboxDrive(org.exoplatform.clouddrive.dropbox.DropboxConnector.API apiFactory, DropboxProvider provider, javax.jcr.Node driveNode, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.services.cms.clouddrives.jcr.NodeFinder finder, org.exoplatform.services.cms.clouddrives.utils.ExtendedMimeTypeResolver mimeTypes) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveExceptionInstantiates a new JCR local dropbox drive.- Parameters:
apiFactory- the API factoryprovider- the providerdriveNode- the drive nodesessionProviders- the session providersfinder- the findermimeTypes- the mime types- Throws:
javax.jcr.RepositoryException- the repository exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
-
Method Detail
-
initDrive
protected void initDrive(javax.jcr.Node driveNode) throws org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException- Overrides:
initDrivein classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveExceptionjavax.jcr.RepositoryException
-
updateState
protected void updateState(String cursor)
Update state.- Parameters:
cursor- the cursor
-
loadUser
protected static DropboxUser loadUser(org.exoplatform.clouddrive.dropbox.DropboxConnector.API apiFactory, DropboxProvider provider, javax.jcr.Node driveNode) throws javax.jcr.RepositoryException, DropboxException, org.exoplatform.services.cms.clouddrives.CloudDriveException
Load user from the drive Node.- Parameters:
apiFactory-DropboxConnector.APIAPI factoryprovider-DropboxProviderdriveNode-Noderoot of the drive- Returns:
DropboxUser- Throws:
javax.jcr.RepositoryException- the repository exceptionDropboxException- the dropbox exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
onUserTokenRefresh
public void onUserTokenRefresh(org.exoplatform.services.cms.clouddrives.oauth2.UserToken token) throws org.exoplatform.services.cms.clouddrives.CloudDriveException- Specified by:
onUserTokenRefreshin interfaceorg.exoplatform.services.cms.clouddrives.oauth2.UserTokenRefreshListener- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException
-
onUserTokenRemove
public void onUserTokenRemove() throws org.exoplatform.services.cms.clouddrives.CloudDriveException- Specified by:
onUserTokenRemovein interfaceorg.exoplatform.services.cms.clouddrives.oauth2.UserTokenRefreshListener- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException
-
getFileContent
public org.exoplatform.services.cms.clouddrives.viewer.ContentReader getFileContent(String idPath) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException
- Specified by:
getFileContentin interfaceorg.exoplatform.services.cms.clouddrives.CloudDriveStorage- Overrides:
getFileContentin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
javax.jcr.RepositoryExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException
-
getState
public org.exoplatform.services.cms.clouddrives.CloudDrive.FilesState getState() throws org.exoplatform.services.cms.clouddrives.DriveRemovedException, org.exoplatform.services.cms.clouddrives.RefreshAccessException, org.exoplatform.services.cms.clouddrives.CloudProviderException, javax.jcr.RepositoryException- Overrides:
getStatein classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.DriveRemovedExceptionorg.exoplatform.services.cms.clouddrives.RefreshAccessExceptionorg.exoplatform.services.cms.clouddrives.CloudProviderExceptionjavax.jcr.RepositoryException
-
isSharingSupported
public boolean isSharingSupported()
- Specified by:
isSharingSupportedin interfaceorg.exoplatform.services.cms.clouddrives.CloudDriveSecurity- Overrides:
isSharingSupportedin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive
-
shareFile
public void shareFile(javax.jcr.Node fileNode, String... users) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException- Specified by:
shareFilein interfaceorg.exoplatform.services.cms.clouddrives.CloudDriveSecurity- Overrides:
shareFilein classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
javax.jcr.RepositoryExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException
-
unshareFile
public void unshareFile(javax.jcr.Node fileNode, String... users) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException- Specified by:
unshareFilein interfaceorg.exoplatform.services.cms.clouddrives.CloudDriveSecurity- Overrides:
unshareFilein classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
javax.jcr.RepositoryExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException
-
getConnectCommand
protected org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.ConnectCommand getConnectCommand() throws org.exoplatform.services.cms.clouddrives.DriveRemovedException, javax.jcr.RepositoryException- Specified by:
getConnectCommandin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.DriveRemovedExceptionjavax.jcr.RepositoryException
-
getSyncCommand
protected org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive.SyncCommand getSyncCommand() throws org.exoplatform.services.cms.clouddrives.DriveRemovedException, org.exoplatform.services.cms.clouddrives.SyncNotSupportedException, javax.jcr.RepositoryException- Specified by:
getSyncCommandin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.DriveRemovedExceptionorg.exoplatform.services.cms.clouddrives.SyncNotSupportedExceptionjavax.jcr.RepositoryException
-
createFileAPI
protected org.exoplatform.services.cms.clouddrives.CloudFileAPI createFileAPI() throws org.exoplatform.services.cms.clouddrives.DriveRemovedException, org.exoplatform.services.cms.clouddrives.SyncNotSupportedException, javax.jcr.RepositoryException- Specified by:
createFileAPIin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.DriveRemovedExceptionorg.exoplatform.services.cms.clouddrives.SyncNotSupportedExceptionjavax.jcr.RepositoryException
-
readChangeId
protected Long readChangeId() throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException
- Specified by:
readChangeIdin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
javax.jcr.RepositoryExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException
-
saveChangeId
protected void saveChangeId(Long id) throws org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException
- Specified by:
saveChangeIdin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveExceptionjavax.jcr.RepositoryException
-
getUser
public DropboxUser getUser()
- Specified by:
getUserin classorg.exoplatform.services.cms.clouddrives.CloudDrive
-
refreshAccess
protected void refreshAccess() throws org.exoplatform.services.cms.clouddrives.CloudDriveException- Specified by:
refreshAccessin classorg.exoplatform.services.cms.clouddrives.CloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException
-
updateAccess
protected void updateAccess(org.exoplatform.services.cms.clouddrives.CloudUser newUser) throws org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException- Specified by:
updateAccessin classorg.exoplatform.services.cms.clouddrives.CloudDrive- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveExceptionjavax.jcr.RepositoryException
-
fixNameConflict
protected void fixNameConflict(javax.jcr.Node file) throws javax.jcr.RepositoryException- Overrides:
fixNameConflictin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
javax.jcr.RepositoryException
-
normalizeName
protected void normalizeName(javax.jcr.Node fileNode) throws javax.jcr.RepositoryExceptionEnsure the Dropbox file node has name in lower-case. If name requires change it will be renamed in the current session.
This step required forJCRLocalDropboxDrive.DropboxDrivework.
NOTE: this method does't check if it is a cloud file and doesn't respect JCR namespaces and will check against the whole name of the file.- Parameters:
fileNode-Node- Throws:
javax.jcr.RepositoryException- the repository exception
-
initDropboxFile
protected void initDropboxFile(javax.jcr.Node localNode, String rev, Long size) throws javax.jcr.RepositoryException, DropboxExceptionInitialize Dropbox file.- Parameters:
localNode-Noderev- the revsize- the size- Throws:
javax.jcr.RepositoryException- the repository exceptionDropboxException- the dropbox exception
-
initDropboxFolder
protected void initDropboxFolder(javax.jcr.Node localNode, String cursor) throws javax.jcr.RepositoryException, DropboxExceptionInitialize Dropbox folder.- Parameters:
localNode-Nodecursor- String a cursor of last synchronization, ifnullit will be ignored- Throws:
javax.jcr.RepositoryException- the repository exceptionDropboxException- the dropbox exception
-
initDropboxPath
protected void initDropboxPath(javax.jcr.Node localNode, String path) throws javax.jcr.RepositoryExceptionInit Dropbox dbxPath of local item.- Parameters:
localNode- the local nodepath- the path- Throws:
javax.jcr.RepositoryException- the repository exception
-
getDropboxPath
protected String getDropboxPath(javax.jcr.Node localNode) throws javax.jcr.RepositoryException
Get Dropbox path saved in local item. If this path not found in the item, anullwill be returned.- Parameters:
localNode- the local node- Returns:
- the Dropbox path or
null - Throws:
javax.jcr.RepositoryException- the repository exception
-
updateItem
protected org.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudFile updateItem(DropboxAPI api, JCRLocalDropboxDrive.MetadataInfo update, javax.jcr.Node parent, javax.jcr.Node node) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException
Update, create or delete a local node of Cloud File. If the node isnullthen it will be open on the given parent and created if not already exists. If item metadata is not file or folder type, then CloudDriveException will be thrown.- Parameters:
api-DropboxAPIupdate- the updateparent-Node, can benullif node givennode-Node, can benullif parent given- Returns:
JCRLocalCloudFile- Throws:
javax.jcr.RepositoryException- for storage errorsorg.exoplatform.services.cms.clouddrives.CloudDriveException- for drive or format errors, or if item metadata not of existing file or folder
-
createSharedLink
protected String createSharedLink(javax.jcr.Node fileNode) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException
Creates the shared link.- Parameters:
fileNode- the file node- Returns:
- the string
- Throws:
javax.jcr.RepositoryException- the repository exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
link
protected String link(javax.jcr.Node fileNode) throws javax.jcr.RepositoryException
- Overrides:
linkin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
javax.jcr.RepositoryException
-
previewLink
protected String previewLink(String type, javax.jcr.Node fileNode) throws javax.jcr.RepositoryException
- Overrides:
previewLinkin classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive- Throws:
javax.jcr.RepositoryException
-
findMimetype
protected String findMimetype(String fileName)
Find mimetype.- Parameters:
fileName- the file name- Returns:
- the string
-
fetchSubtree
protected org.exoplatform.clouddrive.dropbox.DropboxAPI.ListFolder fetchSubtree(DropboxAPI api, String itemId, javax.jcr.Node node, Collection<org.exoplatform.services.cms.clouddrives.utils.ChunkIterator<?>> iterators, JCRLocalDropboxDrive.Changes changes) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.CloudDriveException
Fetch subtree (children) of given item from remote side.- Parameters:
api- the apiitemId- the item idnode- the nodeiterators- the iteratorschanges- the changes- Returns:
- the list folder
- Throws:
javax.jcr.RepositoryException- the repository exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
fetchItem
protected void fetchItem(DropboxAPI api, JCRLocalDropboxDrive.MetadataInfo item, String parentId, javax.jcr.Node parentNode, Collection<org.exoplatform.services.cms.clouddrives.utils.ChunkIterator<?>> iterators, JCRLocalDropboxDrive.Changes changes) throws javax.jcr.RepositoryException, org.exoplatform.services.cms.clouddrives.NotFoundException, org.exoplatform.services.cms.clouddrives.CloudDriveException
Fetch remote item, for a folder do recursive.- Parameters:
api- the apiitem- the item metadataparentId- the parent IDparentNode- the parent nodeiterators- the iterators for progress tracking, can benullchanges- the changes command (e.g. connect, sync or restore), nevernull- Throws:
javax.jcr.RepositoryException- the repository exceptionorg.exoplatform.services.cms.clouddrives.NotFoundException- the not found exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
folderCursor
protected String folderCursor(javax.jcr.Node node) throws javax.jcr.RepositoryException
Folder cursor.- Parameters:
node- the node- Returns:
- the string
- Throws:
javax.jcr.RepositoryException- the repository exception
-
nodeName
protected String nodeName(String title)
- Overrides:
nodeNamein classorg.exoplatform.services.cms.clouddrives.jcr.JCRLocalCloudDrive
-
itemInfo
protected JCRLocalDropboxDrive.MetadataInfo itemInfo(com.dropbox.core.v2.files.Metadata item)
Metadata info.- Parameters:
item- the item- Returns:
- the info
-
hasLocationChanged
protected boolean hasLocationChanged(javax.jcr.Node node, JCRLocalDropboxDrive.ItemInfo item) throws javax.jcr.RepositoryExceptionChecks for location changed.- Parameters:
node- the local item nodeitem- the remote item- Returns:
- true, if successful
- Throws:
javax.jcr.RepositoryException- the repository exception
-
hasSameId
protected boolean hasSameId(javax.jcr.Node node, JCRLocalDropboxDrive.ItemInfo item) throws javax.jcr.RepositoryExceptionChecks for same ID of local node and remote item.- Parameters:
node- the nodeitem- the item- Returns:
- true, if successful
- Throws:
javax.jcr.RepositoryException- the repository exception
-
hasDifferentRev
protected boolean hasDifferentRev(javax.jcr.Node node, JCRLocalDropboxDrive.FileInfo file) throws javax.jcr.RepositoryExceptionChecks for different rev.- Parameters:
node- the nodefile- the file- Returns:
- true, if successful
- Throws:
javax.jcr.RepositoryException- the repository exception
-
-