public class NuxeoDriveManagerImpl extends DefaultComponent implements NuxeoDriveManager
| Modifier and Type | Field and Description |
|---|---|
static String |
DOCUMENT_CHANGE_LIMIT_PROPERTY |
static String |
DRIVE_SUBSCRIPTIONS_PROPERTY |
static String |
NUXEO_DRIVE_FACET |
LOCALLY_EDITED_COLLECTION_NAME| Constructor and Description |
|---|
NuxeoDriveManagerImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addToLocallyEditedCollection(CoreSession session,
DocumentModel doc)
Adds the given
DocumentModel to the
NuxeoDriveManager.LOCALLY_EDITED_COLLECTION_NAME collection. |
FileSystemChangeFinder |
getChangeFinder()
Gets the
FileSystemChangeFinder member. |
FileSystemChangeSummary |
getChangeSummary(Principal principal,
Map<String,Set<IdRef>> lastSyncRootRefs,
long lastSuccessfulSync)
Uses the
AuditChangeFinder to get the summary of document changes
for the given user and last successful synchronization date. |
FileSystemChangeSummary |
getChangeSummaryIntegerBounds(Principal 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. |
Map<String,Set<String>> |
getCollectionSyncRootMemberIds(Principal 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(Principal principal)
Fetch all the synchronization root references and paths for a given user.
|
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(Principal) 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(Principal) 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(Principal) is called. |
boolean |
isSynchronizationRoot(Principal principal,
DocumentModel doc)
Checks if the given
DocumentModel is a synchronization root for
the given user. |
void |
registerSynchronizationRoot(Principal principal,
DocumentModel newRootContainer,
CoreSession session) |
void |
setChangeFinder(FileSystemChangeFinder changeFinder)
Sets the
FileSystemChangeFinder member. |
void |
unregisterSynchronizationRoot(Principal principal,
DocumentModel rootContainer,
CoreSession session) |
activate, applicationStarted, deactivate, getAdapter, getApplicationStartedOrder, getLastModified, registerContribution, registerExtension, setLastModified, unregisterContribution, unregisterExtensionpublic static final String NUXEO_DRIVE_FACET
public static final String DRIVE_SUBSCRIPTIONS_PROPERTY
public static final String DOCUMENT_CHANGE_LIMIT_PROPERTY
public void invalidateSynchronizationRootsCache(String userName)
NuxeoDriveManagerNuxeoDriveManager.getSynchronizationRoots(Principal) is called.invalidateSynchronizationRootsCache in interface NuxeoDriveManageruserName - the principal name of the user to invalidate the cache
for.public void invalidateCollectionSyncRootMemberCache(String userName)
NuxeoDriveManagerNuxeoDriveManager.getCollectionSyncRootMemberIds(Principal) is called.invalidateCollectionSyncRootMemberCache in interface NuxeoDriveManageruserName - the principal name of the user to invalidate the cache
for.public void invalidateCollectionSyncRootMemberCache()
NuxeoDriveManagerNuxeoDriveManager.getCollectionSyncRootMemberIds(Principal) is called.invalidateCollectionSyncRootMemberCache in interface NuxeoDriveManagerpublic void registerSynchronizationRoot(Principal principal, DocumentModel newRootContainer, CoreSession session) throws ClientException
registerSynchronizationRoot in interface NuxeoDriveManagerprincipal - the Nuxeo Drive usernewRootContainer - the folderish document to be used as
synchronization root: must be bound to an active sessionClientExceptionpublic void unregisterSynchronizationRoot(Principal principal, DocumentModel rootContainer, CoreSession session) throws ClientException
unregisterSynchronizationRoot in interface NuxeoDriveManagerprincipal - the Nuxeo Drive userrootContainer - the folderish document that should no longer be used
as a synchronization rootClientExceptionpublic Set<IdRef> getSynchronizationRootReferences(CoreSession session) throws ClientException
NuxeoDriveManagergetSynchronizationRootReferences in interface NuxeoDriveManagersession - active CoreSession instance to the repository hosting the
roots.ClientException#getSynchronizationRootPaths(String, CoreSession)public void handleFolderDeletion(IdRef deleted) throws ClientException
NuxeoDriveManagerhandleFolderDeletion in interface NuxeoDriveManagerClientExceptionpublic FileSystemChangeSummary getChangeSummary(Principal principal, Map<String,Set<IdRef>> lastSyncRootRefs, long lastSuccessfulSync) throws ClientException
AuditChangeFinder to get the summary of document changes
for the given user and last successful synchronization date.
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 lastSuccessfulSync is missing (i.e. set to a negative value),
the filesystem change summary is empty but the returned sync date is set
to the actual server timestamp so that the client can reuse it as a
starting timestamp 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 synchornizationlastSuccessfulSync - the last successful synchronization date of the
user's device. This time is expected to be in milliseconds
since 1970-01-01 UTC as measured on the Nuxeo server clock,
typically set to the value returned by
FileSystemChangeSummary.getSyncDate() of the previous
call to
NuxeoDriveManager.getChangeSummary(Principal, Map, long)
or 0 for catching every event since the repository
initialization.ClientExceptionpublic FileSystemChangeSummary getChangeSummaryIntegerBounds(Principal principal, Map<String,Set<IdRef>> lastSyncRootRefs, long lowerBound) throws ClientException
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.
getChangeSummaryIntegerBounds in interface NuxeoDriveManagerlastSyncRootRefs - the map keyed by repository names of document
refs for the synchronization roots that were active during
last synchornizationlowerBound - the lower bound sent by the user's device. Typically
set to the value returned by
FileSystemChangeSummary.getUpperBound() of the
previous call to
NuxeoDriveManager.getChangeSummaryIntegerBounds(Principal, Map, long)
or 0 for catching every event since the repository
initialization.ClientExceptionpublic Map<String,SynchronizationRoots> getSynchronizationRoots(Principal principal) throws ClientException
NuxeoDriveManagergetSynchronizationRoots in interface NuxeoDriveManagerprincipal - the user to fetch the roots forClientExceptionpublic Map<String,Set<String>> getCollectionSyncRootMemberIds(Principal principal) throws ClientException
NuxeoDriveManagergetCollectionSyncRootMemberIds in interface NuxeoDriveManagerprincipal - the user to fetch the ids forClientExceptionpublic boolean isSynchronizationRoot(Principal principal, DocumentModel doc) throws ClientException
NuxeoDriveManagerDocumentModel is a synchronization root for
the given user.isSynchronizationRoot in interface NuxeoDriveManagerClientExceptionpublic FileSystemChangeFinder getChangeFinder()
NuxeoDriveManagerFileSystemChangeFinder member.getChangeFinder in interface NuxeoDriveManagerpublic void setChangeFinder(FileSystemChangeFinder changeFinder)
NuxeoDriveManagerFileSystemChangeFinder member.
TODO: make it overridable with an extension point and remove setter.
setChangeFinder in interface NuxeoDriveManagerpublic void addToLocallyEditedCollection(CoreSession session, DocumentModel doc) throws ClientException
NuxeoDriveManagerDocumentModel to the
NuxeoDriveManager.LOCALLY_EDITED_COLLECTION_NAME collection.addToLocallyEditedCollection in interface NuxeoDriveManagerClientExceptionCopyright © 2014 Nuxeo SA. All rights reserved.