Class FileSystemItemAdapterServiceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.drive.service.impl.FileSystemItemAdapterServiceImpl
-
- All Implemented Interfaces:
FileSystemItemAdapterService
,Adaptable
,Component
,Extensible
,TimestampedService
public class FileSystemItemAdapterServiceImpl extends DefaultComponent implements FileSystemItemAdapterService
Default implementation of theFileSystemItemAdapterService
.- Author:
- Antoine Taillefer
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTIVE_FILE_SYSTEM_ITEM_FACTORIES_EP
protected ActiveFileSystemItemFactoryRegistry
activeFileSystemItemFactoryRegistry
protected ActiveTopLevelFolderItemFactoryRegistry
activeTopLevelFolderItemFactoryRegistry
protected static String
CONCURRENT_SCROLL_BATCH_LIMIT
protected static int
CONCURRENT_SCROLL_BATCH_LIMIT_DEFAULT
static String
FILE_SYSTEM_ITEM_FACTORY_EP
protected List<FileSystemItemFactoryWrapper>
fileSystemItemFactories
protected FileSystemItemFactoryRegistry
fileSystemItemFactoryRegistry
protected Semaphore
scrollBatchSemaphore
static String
TOP_LEVEL_FOLDER_ITEM_FACTORY_EP
protected TopLevelFolderItemFactory
topLevelFolderItemFactory
protected TopLevelFolderItemFactoryRegistry
topLevelFolderItemFactoryRegistry
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description FileSystemItemAdapterServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
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
generalFactoryMatches(FileSystemItemFactoryWrapper factory)
Set<String>
getActiveFileSystemItemFactories()
Gets the activeFileSystemItem
factory names.FileSystemItem
getFileSystemItem(DocumentModel doc)
Gets theFileSystemItem
for the givenDocumentModel
.FileSystemItem
getFileSystemItem(DocumentModel doc, boolean includeDeleted)
Gets theFileSystemItem
for the givenDocumentModel
.FileSystemItem
getFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint)
Gets theFileSystemItem
for the givenDocumentModel
.FileSystemItem
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
.FileSystemItem
getFileSystemItem(DocumentModel doc, FolderItem parentItem)
FileSystemItem
getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted)
FileSystemItem
getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint)
FileSystemItem
getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo)
List<FileSystemItemFactoryWrapper>
getFileSystemItemFactories()
FileSystemItemFactory
getFileSystemItemFactory(String name)
Map<String,FileSystemItemFactoryDescriptor>
getFileSystemItemFactoryDescriptors()
FileSystemItemFactory
getFileSystemItemFactoryForId(String id)
Iterates on the ordered contributed file system item factories until if finds one that can handle the givenFileSystemItem
id.Semaphore
getScrollBatchSemaphore()
Allows to limit the number of concurrent scrolls run byFolderItem.scrollDescendants(String, int, long)
.TopLevelFolderItemFactory
getTopLevelFolderItemFactory()
Gets theTopLevelFolderItemFactory
.VirtualFolderItemFactory
getVirtualFolderItemFactory(String factoryName)
Gets theVirtualFolderItemFactory
for the given factory name.void
registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
void
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 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
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
FILE_SYSTEM_ITEM_FACTORY_EP
public static final String FILE_SYSTEM_ITEM_FACTORY_EP
- See Also:
- Constant Field Values
-
TOP_LEVEL_FOLDER_ITEM_FACTORY_EP
public static final String TOP_LEVEL_FOLDER_ITEM_FACTORY_EP
- See Also:
- Constant Field Values
-
ACTIVE_FILE_SYSTEM_ITEM_FACTORIES_EP
public static final String ACTIVE_FILE_SYSTEM_ITEM_FACTORIES_EP
- See Also:
- Constant Field Values
-
CONCURRENT_SCROLL_BATCH_LIMIT
protected static final String CONCURRENT_SCROLL_BATCH_LIMIT
- See Also:
- Constant Field Values
-
CONCURRENT_SCROLL_BATCH_LIMIT_DEFAULT
protected static final int CONCURRENT_SCROLL_BATCH_LIMIT_DEFAULT
- See Also:
- Constant Field Values
-
topLevelFolderItemFactoryRegistry
protected TopLevelFolderItemFactoryRegistry topLevelFolderItemFactoryRegistry
-
fileSystemItemFactoryRegistry
protected FileSystemItemFactoryRegistry fileSystemItemFactoryRegistry
-
activeTopLevelFolderItemFactoryRegistry
protected ActiveTopLevelFolderItemFactoryRegistry activeTopLevelFolderItemFactoryRegistry
-
activeFileSystemItemFactoryRegistry
protected ActiveFileSystemItemFactoryRegistry activeFileSystemItemFactoryRegistry
-
topLevelFolderItemFactory
protected TopLevelFolderItemFactory topLevelFolderItemFactory
-
fileSystemItemFactories
protected List<FileSystemItemFactoryWrapper> fileSystemItemFactories
-
scrollBatchSemaphore
protected Semaphore scrollBatchSemaphore
-
-
Method Detail
-
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
public void activate(ComponentContext context)
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
public void deactivate(ComponentContext context)
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
public void start(ComponentContext context)
Sorts the contributed factories according to their order and initializes thescrollBatchSemaphore
.- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
stop
public void stop(ComponentContext context) throws InterruptedException
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
- Throws:
InterruptedException
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc)
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel)
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted)
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean)
-
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean, boolean)
-
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean, boolean, boolean)
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem)
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem)
-
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem, boolean)
-
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem, boolean, boolean)
-
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:
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem, boolean, boolean, boolean)
-
getFileSystemItemFactoryForId
public FileSystemItemFactory getFileSystemItemFactoryForId(String id)
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:
FileSystemItemFactory.canHandleFileSystemItemId(String)
-
getTopLevelFolderItemFactory
public TopLevelFolderItemFactory getTopLevelFolderItemFactory()
Description copied from interface:FileSystemItemAdapterService
Gets theTopLevelFolderItemFactory
.- Specified by:
getTopLevelFolderItemFactory
in interfaceFileSystemItemAdapterService
-
getVirtualFolderItemFactory
public VirtualFolderItemFactory getVirtualFolderItemFactory(String factoryName)
Description copied from interface:FileSystemItemAdapterService
Gets theVirtualFolderItemFactory
for the given factory name.- Specified by:
getVirtualFolderItemFactory
in interfaceFileSystemItemAdapterService
-
getActiveFileSystemItemFactories
public Set<String> getActiveFileSystemItemFactories()
Description copied from interface:FileSystemItemAdapterService
Gets the activeFileSystemItem
factory names.- Specified by:
getActiveFileSystemItemFactories
in interfaceFileSystemItemAdapterService
-
getScrollBatchSemaphore
public Semaphore 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
public Map<String,FileSystemItemFactoryDescriptor> getFileSystemItemFactoryDescriptors()
-
getFileSystemItemFactories
public List<FileSystemItemFactoryWrapper> getFileSystemItemFactories()
-
getFileSystemItemFactory
public FileSystemItemFactory getFileSystemItemFactory(String name)
-
setActiveFactories
@Deprecated public void 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
protected boolean generalFactoryMatches(FileSystemItemFactoryWrapper factory)
-
docTypeFactoryMatches
protected boolean docTypeFactoryMatches(FileSystemItemFactoryWrapper factory, DocumentModel doc)
-
facetFactoryMatches
protected boolean facetFactoryMatches(FileSystemItemFactoryWrapper factory, DocumentModel doc, boolean relaxSyncRootConstraint)
-
syncRootFactoryMatches
protected boolean syncRootFactoryMatches(DocumentModel doc, boolean relaxSyncRootConstraint)
-
-