public class NuxeoDriveManagerImpl extends DefaultComponent implements NuxeoDriveManager
| Modifier and Type | Field and Description |
|---|---|
static String |
CHANGE_FINDER_EP |
protected FileSystemChangeFinder |
changeFinder |
protected static ChangeFinderRegistry |
changeFinderRegistry |
protected static long |
COLLECTION_CONTENT_PAGE_SIZE |
protected Cache |
collectionSyncRootMemberCache
Cache holding the collection sync root member ids for a given user (first map key) and repository (second map
key).
|
static String |
DOCUMENT_CHANGE_LIMIT_PROPERTY |
static String |
DRIVE_COLLECTION_SYNC_ROOT__MEMBER_CACHE |
static String |
DRIVE_SUBSCRIPTIONS_PROPERTY |
static String |
DRIVE_SYNC_ROOT_CACHE |
static String |
NUXEO_DRIVE_FACET |
protected Cache |
syncRootCache
Cache holding the synchronization roots for a given user (first map key) and repository (second map key).
|
static TimeZone |
UTC |
lastModified, nameLOCALLY_EDITED_COLLECTION_NAME| Constructor and Description |
|---|
NuxeoDriveManagerImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
activate(ComponentContext context)
Activates the component.
|
void |
addToLocallyEditedCollection(CoreSession session,
DocumentModel doc)
Adds the given
DocumentModel to the NuxeoDriveManager.LOCALLY_EDITED_COLLECTION_NAME collection. |
protected void |
checkCanUpdateSynchronizationRoot(DocumentModel newRootContainer,
CoreSession session) |
protected void |
clearCache() |
protected Map<String,Set<String>> |
computeCollectionSyncRootMemberIds(NuxeoPrincipal principal) |
protected Map<String,SynchronizationRoots> |
computeSynchronizationRoots(String query,
NuxeoPrincipal principal) |
protected String |
computeSyncRootsQuery(String username) |
void |
deactivate(ComponentContext context)
Deactivates the component.
|
protected void |
fireEvent(DocumentModel sourceDocument,
CoreSession session,
String eventName,
String impactedUserName) |
int |
getApplicationStartedOrder()
The component notification order for
Component.applicationStarted(org.nuxeo.runtime.model.ComponentContext). |
FileSystemChangeFinder |
getChangeFinder()
Gets the
FileSystemChangeFinder member. |
FileSystemChangeSummary |
getChangeSummary(NuxeoPrincipal principal,
Map<String,Set<IdRef>> lastSyncRootRefs,
long lowerBound)
Uses the
AuditChangeFinder to get the summary of document changes for the given user and lower bound. |
protected Cache |
getCollectionSyncRootMemberCache() |
Map<String,Set<String>> |
getCollectionSyncRootMemberIds(NuxeoPrincipal principal)
Fetch all the collection sync root member ids for a given user.
|
Set<IdRef> |
getSynchronizationRootReferences(CoreSession session)
Fetch the list of synchronization root refs for a given user and a given session repository.
|
Map<String,SynchronizationRoots> |
getSynchronizationRoots(NuxeoPrincipal principal)
Fetch all the synchronization root references and paths for a given user.
|
protected Cache |
getSyncRootCache() |
void |
handleFolderDeletion(IdRef deleted)
Method to be called by a CoreEvent listener monitoring documents deletions to cleanup references to recently
deleted documents and invalidate the caches.
|
void |
invalidateCollectionSyncRootMemberCache()
Invalidate the collection sync root member cache for all users so as to query the repository next time
NuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal) is called. |
void |
invalidateCollectionSyncRootMemberCache(String userName)
Invalidate the collection sync root member cache for a given user so as to query the repository next time
NuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal) is called. |
void |
invalidateSynchronizationRootsCache(String userName)
Invalidate the synchronization roots cache for a given user so as to query the repository next time
NuxeoDriveManager.getSynchronizationRoots(NuxeoPrincipal) is called. |
boolean |
isSynchronizationRoot(NuxeoPrincipal principal,
DocumentModel doc)
Checks if the given
DocumentModel is a synchronization root for the given user. |
protected Map<String,SynchronizationRoots> |
queryAndFetchSynchronizationRoots(CoreSession session,
String query) |
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
registerSynchronizationRoot(NuxeoPrincipal principal,
DocumentModel newRootContainer,
CoreSession session) |
void |
start(ComponentContext context)
Sorts the contributed factories according to their order.
|
void |
stop(ComponentContext context)
Stop the component.
|
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
void |
unregisterSynchronizationRoot(NuxeoPrincipal principal,
DocumentModel rootContainer,
CoreSession session) |
getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterExtensionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplicationStartedpublic static final String CHANGE_FINDER_EP
public static final String NUXEO_DRIVE_FACET
public static final String DRIVE_SUBSCRIPTIONS_PROPERTY
public static final String DOCUMENT_CHANGE_LIMIT_PROPERTY
public static final String DRIVE_SYNC_ROOT_CACHE
public static final String DRIVE_COLLECTION_SYNC_ROOT__MEMBER_CACHE
protected static final long COLLECTION_CONTENT_PAGE_SIZE
protected Cache syncRootCache
protected Cache collectionSyncRootMemberCache
protected static ChangeFinderRegistry changeFinderRegistry
protected FileSystemChangeFinder changeFinder
public NuxeoDriveManagerImpl()
protected Cache getSyncRootCache()
protected Cache getCollectionSyncRootMemberCache()
protected void clearCache()
public void invalidateSynchronizationRootsCache(String userName)
NuxeoDriveManagerNuxeoDriveManager.getSynchronizationRoots(NuxeoPrincipal) is called.invalidateSynchronizationRootsCache in interface NuxeoDriveManageruserName - the principal name of the user to invalidate the cache for.public void invalidateCollectionSyncRootMemberCache(String userName)
NuxeoDriveManagerNuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal) is called.invalidateCollectionSyncRootMemberCache in interface NuxeoDriveManageruserName - the principal name of the user to invalidate the cache for.public void invalidateCollectionSyncRootMemberCache()
NuxeoDriveManagerNuxeoDriveManager.getCollectionSyncRootMemberIds(NuxeoPrincipal) is called.invalidateCollectionSyncRootMemberCache in interface NuxeoDriveManagerpublic void registerSynchronizationRoot(NuxeoPrincipal principal, DocumentModel newRootContainer, CoreSession session)
registerSynchronizationRoot in interface NuxeoDriveManagerprincipal - the Nuxeo Drive usernewRootContainer - the folderish document to be used as synchronization root: must be bound to an active
sessionpublic void unregisterSynchronizationRoot(NuxeoPrincipal principal, DocumentModel rootContainer, CoreSession session)
unregisterSynchronizationRoot in interface NuxeoDriveManagerprincipal - the Nuxeo Drive userrootContainer - the folderish document that should no longer be used as a synchronization rootpublic Set<IdRef> getSynchronizationRootReferences(CoreSession session)
NuxeoDriveManagergetSynchronizationRootReferences in interface NuxeoDriveManagersession - active CoreSession instance to the repository hosting the roots.#getSynchronizationRootPaths(String, CoreSession)public void handleFolderDeletion(IdRef deleted)
NuxeoDriveManagerhandleFolderDeletion in interface NuxeoDriveManagerprotected void fireEvent(DocumentModel sourceDocument, CoreSession session, String eventName, String impactedUserName)
public FileSystemChangeSummary getChangeSummary(NuxeoPrincipal principal, Map<String,Set<IdRef>> lastSyncRootRefs, long lowerBound)
AuditChangeFinder to get the summary of document changes for the given user and lower bound.
The DOCUMENT_CHANGE_LIMIT_PROPERTY Framework property is used as a limit of document changes to fetch
from the audit logs. Default value is 1000. If lowerBound is 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.
getChangeSummary in interface NuxeoDriveManagerlastSyncRootRefs - 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 by
FileSystemChangeSummary.getUpperBound() of the previous call to
NuxeoDriveManager.getChangeSummary(NuxeoPrincipal, Map, long) or 0 for catching every event
since the repository initialization.public Map<String,SynchronizationRoots> getSynchronizationRoots(NuxeoPrincipal principal)
NuxeoDriveManagergetSynchronizationRoots in interface NuxeoDriveManagerprincipal - the user to fetch the roots forpublic Map<String,Set<String>> getCollectionSyncRootMemberIds(NuxeoPrincipal principal)
NuxeoDriveManagergetCollectionSyncRootMemberIds in interface NuxeoDriveManagerprincipal - the user to fetch the ids forpublic boolean isSynchronizationRoot(NuxeoPrincipal principal, DocumentModel doc)
NuxeoDriveManagerDocumentModel is a synchronization root for the given user.isSynchronizationRoot in interface NuxeoDriveManagerprotected Map<String,SynchronizationRoots> computeSynchronizationRoots(String query, NuxeoPrincipal principal)
protected Map<String,SynchronizationRoots> queryAndFetchSynchronizationRoots(CoreSession session, String query)
protected Map<String,Set<String>> computeCollectionSyncRootMemberIds(NuxeoPrincipal principal)
protected void checkCanUpdateSynchronizationRoot(DocumentModel newRootContainer, CoreSession session)
public FileSystemChangeFinder getChangeFinder()
NuxeoDriveManagerFileSystemChangeFinder member.getChangeFinder in interface NuxeoDriveManagerprotected String computeSyncRootsQuery(String username)
public void addToLocallyEditedCollection(CoreSession session, DocumentModel doc)
NuxeoDriveManagerDocumentModel to the NuxeoDriveManager.LOCALLY_EDITED_COLLECTION_NAME collection.addToLocallyEditedCollection in interface NuxeoDriveManagerpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution in class DefaultComponentpublic void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution in class DefaultComponentpublic void activate(ComponentContext context)
ComponentThis method is called by the runtime when a component is activated.
activate in interface Componentactivate in class DefaultComponentcontext - the runtime contextpublic void deactivate(ComponentContext context)
ComponentThis method is called by the runtime when a component is deactivated.
deactivate in interface Componentdeactivate in class DefaultComponentcontext - the runtime contextpublic int getApplicationStartedOrder()
ComponentComponent.applicationStarted(org.nuxeo.runtime.model.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.
getApplicationStartedOrder in interface Componentpublic void start(ComponentContext context)
start in interface Componentstart in class DefaultComponentpublic void stop(ComponentContext context)
Componentstop in interface Componentstop in class DefaultComponentCopyright © 2018 Nuxeo. All rights reserved.