Interface NuxeoDriveManager

  • All Known Implementing Classes:
    NuxeoDriveManagerImpl

    public interface NuxeoDriveManager
    Manage list of NuxeoDrive synchronization roots and devices for a given nuxeo user.
    • Method Detail

      • registerSynchronizationRoot

        void registerSynchronizationRoot​(NuxeoPrincipal principal,
                                         DocumentModel newRootContainer,
                                         CoreSession session)
        Parameters:
        principal - the Nuxeo Drive user
        newRootContainer - the folderish document to be used as synchronization root: must be bound to an active session
        Throws:
        SecurityException - if the user does not have write permissions to the container.
      • unregisterSynchronizationRoot

        void unregisterSynchronizationRoot​(NuxeoPrincipal principal,
                                           DocumentModel rootContainer,
                                           CoreSession session)
        Parameters:
        principal - the Nuxeo Drive user
        rootContainer - the folderish document that should no longer be used as a synchronization root
      • getSynchronizationRootReferences

        Set<IdRef> getSynchronizationRootReferences​(CoreSession session)
        Fetch the list of synchronization root refs for a given user and a given session repository. This list is assumed to be short enough (in the order of 100 folder max) so that no paging API is required. The user is taken from the session.getPrincipal() method.
        Parameters:
        session - active CoreSession instance to the repository hosting the roots.
        Returns:
        the ordered set of non deleted synchronization root references for that user
      • getSynchronizationRoots

        Map<String,​SynchronizationRoots> getSynchronizationRoots​(NuxeoPrincipal principal)
        Fetch all the synchronization root references and paths for a given user. This list is assumed to be short enough (in the order of 100 folder max) so that no paging API is required.
        Parameters:
        principal - the user to fetch the roots for
        Returns:
        the map keyed by repository names all active roots definitions for the current user.
      • getCollectionSyncRootMemberIds

        Map<String,​Set<String>> getCollectionSyncRootMemberIds​(NuxeoPrincipal principal)
        Fetch all the collection sync root member ids for a given user.
        Parameters:
        principal - the user to fetch the ids for
        Returns:
        the map keyed by repository names all collection sync root member ids for the current user.
      • handleFolderDeletion

        void handleFolderDeletion​(IdRef ref)
        Method to be called by a CoreEvent listener monitoring documents deletions to cleanup references to recently deleted documents and invalidate the caches.
      • getChangeSummary

        FileSystemChangeSummary getChangeSummary​(NuxeoPrincipal principal,
                                                 Map<String,​Set<IdRef>> lastSyncRootRefs,
                                                 long lowerBound)
        Gets a summary of document changes in all repositories for the given user's synchronization roots, from the lower bound sent by the user's device.

        The summary includes:

        • The list of sync root paths
        • A list of document changes
        • The document models that have changed
        • A status code
        Parameters:
        lastSyncRootRefs - the map keyed by repository names of document refs for the synchronization roots that were active during last synchronization
        lowerBound - the lower bound sent by the user's device. Typically set to the value returned by FileSystemChangeSummary.getUpperBound() of the previous call to getChangeSummary(NuxeoPrincipal, Map, long) or 0 for catching every event since the repository initialization.
        Returns:
        the summary of document changes
      • invalidateSynchronizationRootsCache

        void invalidateSynchronizationRootsCache​(String userName)
        Invalidate the synchronization roots cache for a given user so as to query the repository next time getSynchronizationRoots(NuxeoPrincipal) is called.
        Parameters:
        userName - the principal name of the user to invalidate the cache for.
      • invalidateCollectionSyncRootMemberCache

        void invalidateCollectionSyncRootMemberCache​(String userName)
        Invalidate the collection sync root member cache for a given user so as to query the repository next time getCollectionSyncRootMemberIds(NuxeoPrincipal) is called.
        Parameters:
        userName - the principal name of the user to invalidate the cache for.
      • invalidateCollectionSyncRootMemberCache

        void invalidateCollectionSyncRootMemberCache()
        Invalidate the collection sync root member cache for all users so as to query the repository next time getCollectionSyncRootMemberIds(NuxeoPrincipal) is called.
      • addToLocallyEditedCollection

        void addToLocallyEditedCollection​(CoreSession session,
                                          DocumentModel doc)
        Adds the given DocumentModel to the LOCALLY_EDITED_COLLECTION_NAME collection.
        Since:
        6.0