Package org.nuxeo.drive.service.impl
Class NuxeoDriveManagerImpl
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.drive.service.impl.NuxeoDriveManagerImpl
- All Implemented Interfaces:
NuxeoDriveManager,Adaptable,Component,Extensible,TimestampedService
Manage list of NuxeoDrive synchronization roots and devices for a given nuxeo user.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected FileSystemChangeFinderprotected static final longprotected CacheCache holding the collection sync root member ids for a given user (first map key) and repository (second map key).static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected CacheCache holding the synchronization roots for a given user (first map key) and repository (second map key).static final TimeZoneFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToLocallyEditedCollection(CoreSession session, DocumentModel doc) Adds the givenDocumentModelto theLOCALLY_EDITED_COLLECTION_NAMEcollection.protected voidcheckCanUpdateSynchronizationRoot(DocumentModel newRootContainer) protected voidcomputeCollectionSyncRootMemberIds(NuxeoPrincipal principal) protected Map<String, SynchronizationRoots> computeSynchronizationRoots(String query, NuxeoPrincipal principal) protected StringcomputeSyncRootsQuery(String username) protected voidfireEvent(DocumentModel sourceDocument, CoreSession session, String eventName, String impactedUserName) intThe component notification order forComponent.start(ComponentContext).Gets theFileSystemChangeFindermember.getChangeSummary(NuxeoPrincipal principal, Map<String, Set<IdRef>> lastSyncRootRefs, long lowerBound) Uses theAuditChangeFinderto get the summary of document changes for the given user and lower bound.protected CachegetCollectionSyncRootMemberIds(NuxeoPrincipal principal) Fetch all the collection sync root member ids for a given user.Fetch the list of synchronization root refs for a given user and a given session repository.getSynchronizationRoots(NuxeoPrincipal principal) Fetch all the synchronization root references and paths for a given user.protected CachevoidhandleFolderDeletion(IdRef deleted) Method to be called by a CoreEvent listener monitoring documents deletions to cleanup references to recently deleted documents and invalidate the caches.voidInvalidate the collection sync root member cache for all users so as to query the repository next timeNuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal)is called.voidInvalidate the collection sync root member cache for a given user so as to query the repository next timeNuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal)is called.voidinvalidateSynchronizationRootsCache(String userName) Invalidate the synchronization roots cache for a given user so as to query the repository next timeNuxeoDriveManager.getSynchronizationRoots(NuxeoPrincipal)is called.booleanisSynchronizationRoot(NuxeoPrincipal principal, DocumentModel doc) Checks if the givenDocumentModelis a synchronization root for the given user.protected Map<String, SynchronizationRoots> queryAndFetchSynchronizationRoots(CoreSession session, String query) voidregisterSynchronizationRoot(NuxeoPrincipal principal, DocumentModel newRootContainer, CoreSession session) voidstart(ComponentContext context) Sorts the contributed factories according to their order.voidstop(ComponentContext context) Stop the component.voidunregisterSynchronizationRoot(NuxeoPrincipal principal, DocumentModel rootContainer, CoreSession session) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
-
Field Details
-
CHANGE_FINDER_EP
- See Also:
-
NUXEO_DRIVE_FACET
- See Also:
-
DRIVE_SUBSCRIPTIONS_PROPERTY
- See Also:
-
DOCUMENT_CHANGE_LIMIT_PROPERTY
- See Also:
-
UTC
-
DRIVE_SYNC_ROOT_CACHE
- See Also:
-
DRIVE_COLLECTION_SYNC_ROOT_MEMBER_CACHE
- See Also:
-
LOCALLY_EDITED_COLLECTION_NAME
- See Also:
-
COLLECTION_CONTENT_PAGE_SIZE
protected static final long COLLECTION_CONTENT_PAGE_SIZE- See Also:
-
syncRootCache
Cache holding the synchronization roots for a given user (first map key) and repository (second map key). -
collectionSyncRootMemberCache
Cache holding the collection sync root member ids for a given user (first map key) and repository (second map key). -
changeFinder
-
-
Constructor Details
-
NuxeoDriveManagerImpl
public NuxeoDriveManagerImpl()
-
-
Method Details
-
getSyncRootCache
-
getCollectionSyncRootMemberCache
-
clearCache
protected void clearCache() -
invalidateSynchronizationRootsCache
Description copied from interface:NuxeoDriveManagerInvalidate the synchronization roots cache for a given user so as to query the repository next timeNuxeoDriveManager.getSynchronizationRoots(NuxeoPrincipal)is called.- Specified by:
invalidateSynchronizationRootsCachein interfaceNuxeoDriveManager- Parameters:
userName- the principal name of the user to invalidate the cache for.
-
invalidateCollectionSyncRootMemberCache
Description copied from interface:NuxeoDriveManagerInvalidate the collection sync root member cache for a given user so as to query the repository next timeNuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal)is called.- Specified by:
invalidateCollectionSyncRootMemberCachein interfaceNuxeoDriveManager- Parameters:
userName- the principal name of the user to invalidate the cache for.
-
invalidateCollectionSyncRootMemberCache
public void invalidateCollectionSyncRootMemberCache()Description copied from interface:NuxeoDriveManagerInvalidate the collection sync root member cache for all users so as to query the repository next timeNuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal)is called.- Specified by:
invalidateCollectionSyncRootMemberCachein interfaceNuxeoDriveManager
-
registerSynchronizationRoot
public void registerSynchronizationRoot(NuxeoPrincipal principal, DocumentModel newRootContainer, CoreSession session) - Specified by:
registerSynchronizationRootin interfaceNuxeoDriveManager- Parameters:
principal- the Nuxeo Drive usernewRootContainer- the folderish document to be used as synchronization root: must be bound to an active session
-
unregisterSynchronizationRoot
public void unregisterSynchronizationRoot(NuxeoPrincipal principal, DocumentModel rootContainer, CoreSession session) - Specified by:
unregisterSynchronizationRootin interfaceNuxeoDriveManager- Parameters:
principal- the Nuxeo Drive userrootContainer- the folderish document that should no longer be used as a synchronization root
-
getSynchronizationRootReferences
Description copied from interface:NuxeoDriveManagerFetch 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.- Specified by:
getSynchronizationRootReferencesin interfaceNuxeoDriveManager- Parameters:
session- active CoreSession instance to the repository hosting the roots.- Returns:
- the ordered set of non deleted synchronization root references for that user
-
handleFolderDeletion
Description copied from interface:NuxeoDriveManagerMethod to be called by a CoreEvent listener monitoring documents deletions to cleanup references to recently deleted documents and invalidate the caches.- Specified by:
handleFolderDeletionin interfaceNuxeoDriveManager
-
fireEvent
protected void fireEvent(DocumentModel sourceDocument, CoreSession session, String eventName, String impactedUserName) -
getChangeSummary
public FileSystemChangeSummary getChangeSummary(NuxeoPrincipal principal, Map<String, Set<IdRef>> lastSyncRootRefs, long lowerBound) Uses theAuditChangeFinderto get the summary of document changes for the given user and lower bound.The
DOCUMENT_CHANGE_LIMIT_PROPERTYFramework property is used as a limit of document changes to fetch from the audit logs. Default value is 1000. IflowerBoundis missing (i.e. set to a negative value), the filesystem change summary is empty but the returned upper bound is set to the greater event log id so that the client can reuse it as a starting id for a future incremental diff request.- Specified by:
getChangeSummaryin interfaceNuxeoDriveManager- Parameters:
lastSyncRootRefs- the map keyed by repository names of document refs for the synchronization roots that were active during last synchronizationlowerBound- the lower bound sent by the user's device. Typically set to the value returned byFileSystemChangeSummary.getUpperBound()of the previous call toNuxeoDriveManager.getChangeSummary(NuxeoPrincipal, Map, long)or 0 for catching every event since the repository initialization.- Returns:
- the summary of document changes
-
getSynchronizationRoots
Description copied from interface:NuxeoDriveManagerFetch 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.- Specified by:
getSynchronizationRootsin interfaceNuxeoDriveManager- 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
Description copied from interface:NuxeoDriveManagerFetch all the collection sync root member ids for a given user.- Specified by:
getCollectionSyncRootMemberIdsin interfaceNuxeoDriveManager- 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.
-
isSynchronizationRoot
Description copied from interface:NuxeoDriveManagerChecks if the givenDocumentModelis a synchronization root for the given user.- Specified by:
isSynchronizationRootin interfaceNuxeoDriveManager
-
computeSynchronizationRoots
protected Map<String,SynchronizationRoots> computeSynchronizationRoots(String query, NuxeoPrincipal principal) -
queryAndFetchSynchronizationRoots
protected Map<String,SynchronizationRoots> queryAndFetchSynchronizationRoots(CoreSession session, String query) -
computeCollectionSyncRootMemberIds
-
checkCanUpdateSynchronizationRoot
-
getChangeFinder
Description copied from interface:NuxeoDriveManagerGets theFileSystemChangeFindermember.- Specified by:
getChangeFinderin interfaceNuxeoDriveManager
-
computeSyncRootsQuery
- Since:
- 5.9.5
-
addToLocallyEditedCollection
Description copied from interface:NuxeoDriveManagerAdds the givenDocumentModelto theLOCALLY_EDITED_COLLECTION_NAMEcollection.- Specified by:
addToLocallyEditedCollectionin interfaceNuxeoDriveManager
-
getApplicationStartedOrder
public int getApplicationStartedOrder()Description copied from interface:ComponentThe component notification order forComponent.start(ComponentContext).Components are notified in increasing order. Order 1000 is the default order for components that don't care. Order 100 is the repository initialization.
- Specified by:
getApplicationStartedOrderin interfaceComponent- Returns:
- the order, 1000 by default
-
start
Sorts the contributed factories according to their order.- Specified by:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent
-