Class FileSystemItemAdapterServiceImpl
- All Implemented Interfaces:
FileSystemItemAdapterService
,Adaptable
,Component
,Extensible
,TimestampedService
FileSystemItemAdapterService
.- Author:
- Antoine Taillefer
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected ActiveFileSystemItemFactoryRegistry
protected ActiveTopLevelFolderItemFactoryRegistry
protected static final String
protected static final int
static final String
protected List<FileSystemItemFactoryWrapper>
protected FileSystemItemFactoryRegistry
protected Semaphore
static final String
protected TopLevelFolderItemFactory
protected TopLevelFolderItemFactoryRegistry
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(ComponentContext context) Activates the component.void
deactivate
(ComponentContext context) Deactivates the component.protected boolean
docTypeFactoryMatches
(FileSystemItemFactoryWrapper factory, DocumentModel doc) protected boolean
facetFactoryMatches
(FileSystemItemFactoryWrapper factory, DocumentModel doc, boolean relaxSyncRootConstraint) protected boolean
Gets the activeFileSystemItem
factory names.Gets theFileSystemItem
for the givenDocumentModel
.getFileSystemItem
(DocumentModel doc, boolean includeDeleted) Gets theFileSystemItem
for the givenDocumentModel
.getFileSystemItem
(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint) Gets theFileSystemItem
for the givenDocumentModel
.getFileSystemItem
(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo) Gets theFileSystemItem
for the givenDocumentModel
.protected FileSystemItem
getFileSystemItem
(DocumentModel doc, boolean forceParentItem, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo) Tries to adapt the given document as the top levelFolderItem
.getFileSystemItem
(DocumentModel doc, FolderItem parentItem) getFileSystemItem
(DocumentModel doc, FolderItem parentItem, boolean includeDeleted) getFileSystemItem
(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint) getFileSystemItem
(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo) Iterates on the ordered contributed file system item factories until if finds one that can handle the givenFileSystemItem
id.Allows to limit the number of concurrent scrolls run byFolderItem.scrollDescendants(String, int, long)
.Gets theTopLevelFolderItemFactory
.getVirtualFolderItemFactory
(String factoryName) Gets theVirtualFolderItemFactory
for the given factory name.void
registerContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) void
Deprecated.since 9.3 this is method is not needed anymore with hot reload and standby strategy, but kept due to some issues in operation NuxeoDriveSetActiveFactories which freeze Jetty in unit tests when wanting to use standby strategyvoid
start
(ComponentContext context) Sorts the contributed factories according to their order and initializes thescrollBatchSemaphore
.void
stop
(ComponentContext context) Stop the component.protected boolean
syncRootFactoryMatches
(DocumentModel doc, boolean relaxSyncRootConstraint) void
unregisterContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
addRuntimeMessage, addRuntimeMessage, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
FILE_SYSTEM_ITEM_FACTORY_EP
- See Also:
-
TOP_LEVEL_FOLDER_ITEM_FACTORY_EP
- See Also:
-
ACTIVE_FILE_SYSTEM_ITEM_FACTORIES_EP
- See Also:
-
CONCURRENT_SCROLL_BATCH_LIMIT
- See Also:
-
CONCURRENT_SCROLL_BATCH_LIMIT_DEFAULT
protected static final int CONCURRENT_SCROLL_BATCH_LIMIT_DEFAULT- See Also:
-
topLevelFolderItemFactoryRegistry
-
fileSystemItemFactoryRegistry
-
activeTopLevelFolderItemFactoryRegistry
-
activeFileSystemItemFactoryRegistry
-
topLevelFolderItemFactory
-
fileSystemItemFactories
-
scrollBatchSemaphore
-
-
Constructor Details
-
FileSystemItemAdapterServiceImpl
public FileSystemItemAdapterServiceImpl()
-
-
Method Details
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContribution
in classDefaultComponent
-
activate
Description copied from interface:Component
Activates the component.This method is called by the runtime when a component is activated.
- Specified by:
activate
in interfaceComponent
- Overrides:
activate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
deactivate
Description copied from interface:Component
Deactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivate
in interfaceComponent
- Overrides:
deactivate
in classDefaultComponent
- Parameters:
context
- the runtime context
-
start
Sorts the contributed factories according to their order and initializes thescrollBatchSemaphore
.- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
stop
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
- Throws:
InterruptedException
-
getFileSystemItem
Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
. If the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItem
Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
. IfincludeDeleted
is true no filter is applied on the "trashed" state, else if the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint) Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
.If
includeDeleted
is true no filter is applied on the "trashed" state, else if the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.If
relaxSyncRootConstraint
is true no filter is applied on the synchronization root aspect for the current user.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo) Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
.If
includeDeleted
is true no filter is applied on the "trashed" state, else if the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.If
relaxSyncRootConstraint
is true no filter is applied on the synchronization root aspect for the current user.If
getLockInfo
is true theLock
is fetched from theDocumentModel
and set on the returnedFileSystemItem
.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItem
Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
forcing its parent with the givenparentItem
. If the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted) Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
forcing its parent with the givenparentItem
. IfincludeDeleted
is true no filter is applied on the "trashed" state, else if the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint) Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
forcing its parent with the givenparentItem
.If
includeDeleted
is true no filter is applied on the "trashed" state, else if the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.If
relaxSyncRootConstraint
is true no filter is applied on the synchronization root aspect for the current user.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo) Description copied from interface:FileSystemItemAdapterService
Gets theFileSystemItem
for the givenDocumentModel
forcing its parent with the givenparentItem
.If
includeDeleted
is true no filter is applied on the "trashed" state, else if the document is in the trash it is not considered as adaptable as aFileSystemItem
, thus the method returns null.If
relaxSyncRootConstraint
is true no filter is applied on the synchronization root aspect for the current user.If
getLockInfo
is true theLock
is fetched from theDocumentModel
and set on the returnedFileSystemItem
.- Specified by:
getFileSystemItem
in interfaceFileSystemItemAdapterService
- Returns:
- the
FileSystemItem
or null if theDocumentModel
is not adaptable as aFileSystemItem
- See Also:
-
getFileSystemItemFactoryForId
Iterates on the ordered contributed file system item factories until if finds one that can handle the givenFileSystemItem
id.- Specified by:
getFileSystemItemFactoryForId
in interfaceFileSystemItemAdapterService
- See Also:
-
getTopLevelFolderItemFactory
Description copied from interface:FileSystemItemAdapterService
Gets theTopLevelFolderItemFactory
.- Specified by:
getTopLevelFolderItemFactory
in interfaceFileSystemItemAdapterService
-
getVirtualFolderItemFactory
Description copied from interface:FileSystemItemAdapterService
Gets theVirtualFolderItemFactory
for the given factory name.- Specified by:
getVirtualFolderItemFactory
in interfaceFileSystemItemAdapterService
-
getActiveFileSystemItemFactories
Description copied from interface:FileSystemItemAdapterService
Gets the activeFileSystemItem
factory names.- Specified by:
getActiveFileSystemItemFactories
in interfaceFileSystemItemAdapterService
-
getScrollBatchSemaphore
Description copied from interface:FileSystemItemAdapterService
Allows to limit the number of concurrent scrolls run byFolderItem.scrollDescendants(String, int, long)
.- Specified by:
getScrollBatchSemaphore
in interfaceFileSystemItemAdapterService
-
getFileSystemItemFactoryDescriptors
-
getFileSystemItemFactories
-
getFileSystemItemFactory
-
setActiveFactories
Deprecated.since 9.3 this is method is not needed anymore with hot reload and standby strategy, but kept due to some issues in operation NuxeoDriveSetActiveFactories which freeze Jetty in unit tests when wanting to use standby strategy -
getFileSystemItem
protected FileSystemItem getFileSystemItem(DocumentModel doc, boolean forceParentItem, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo) Tries to adapt the given document as the top levelFolderItem
. If it doesn't match, iterates on the ordered contributed file system item factories until it finds one that matches and retrieves a non nullFileSystemItem
for the given document. A file system item factory matches if:- It is not bound to any docType nor facet (this is the case for the default factory contribution
defaultFileSystemItemFactory
bound toDefaultFileSystemItemFactory
) - It is bound to a docType that matches the given doc's type
- It is bound to a facet that matches one of the given doc's facets
- It is not bound to any docType nor facet (this is the case for the default factory contribution
-
generalFactoryMatches
-
docTypeFactoryMatches
-
facetFactoryMatches
protected boolean facetFactoryMatches(FileSystemItemFactoryWrapper factory, DocumentModel doc, boolean relaxSyncRootConstraint) -
syncRootFactoryMatches
-