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 StringACTIVE_FILE_SYSTEM_ITEM_FACTORIES_EPprotected ActiveFileSystemItemFactoryRegistryactiveFileSystemItemFactoryRegistryprotected ActiveTopLevelFolderItemFactoryRegistryactiveTopLevelFolderItemFactoryRegistryprotected static StringCONCURRENT_SCROLL_BATCH_LIMITprotected static intCONCURRENT_SCROLL_BATCH_LIMIT_DEFAULTstatic StringFILE_SYSTEM_ITEM_FACTORY_EPprotected List<FileSystemItemFactoryWrapper>fileSystemItemFactoriesprotected FileSystemItemFactoryRegistryfileSystemItemFactoryRegistryprotected SemaphorescrollBatchSemaphorestatic StringTOP_LEVEL_FOLDER_ITEM_FACTORY_EPprotected TopLevelFolderItemFactorytopLevelFolderItemFactoryprotected TopLevelFolderItemFactoryRegistrytopLevelFolderItemFactoryRegistry-
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 voidactivate(ComponentContext context)Activates the component.voiddeactivate(ComponentContext context)Deactivates the component.protected booleandocTypeFactoryMatches(FileSystemItemFactoryWrapper factory, DocumentModel doc)protected booleanfacetFactoryMatches(FileSystemItemFactoryWrapper factory, DocumentModel doc, boolean relaxSyncRootConstraint)protected booleangeneralFactoryMatches(FileSystemItemFactoryWrapper factory)Set<String>getActiveFileSystemItemFactories()Gets the activeFileSystemItemfactory names.FileSystemItemgetFileSystemItem(DocumentModel doc)Gets theFileSystemItemfor the givenDocumentModel.FileSystemItemgetFileSystemItem(DocumentModel doc, boolean includeDeleted)Gets theFileSystemItemfor the givenDocumentModel.FileSystemItemgetFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint)Gets theFileSystemItemfor the givenDocumentModel.FileSystemItemgetFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo)Gets theFileSystemItemfor the givenDocumentModel.protected FileSystemItemgetFileSystemItem(DocumentModel doc, boolean forceParentItem, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo)Tries to adapt the given document as the top levelFolderItem.FileSystemItemgetFileSystemItem(DocumentModel doc, FolderItem parentItem)FileSystemItemgetFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted)FileSystemItemgetFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint)FileSystemItemgetFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo)List<FileSystemItemFactoryWrapper>getFileSystemItemFactories()FileSystemItemFactorygetFileSystemItemFactory(String name)Map<String,FileSystemItemFactoryDescriptor>getFileSystemItemFactoryDescriptors()FileSystemItemFactorygetFileSystemItemFactoryForId(String id)Iterates on the ordered contributed file system item factories until if finds one that can handle the givenFileSystemItemid.SemaphoregetScrollBatchSemaphore()Allows to limit the number of concurrent scrolls run byFolderItem.scrollDescendants(String, int, long).TopLevelFolderItemFactorygetTopLevelFolderItemFactory()Gets theTopLevelFolderItemFactory.VirtualFolderItemFactorygetVirtualFolderItemFactory(String factoryName)Gets theVirtualFolderItemFactoryfor the given factory name.voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)voidsetActiveFactories()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 strategyvoidstart(ComponentContext context)Sorts the contributed factories according to their order and initializes thescrollBatchSemaphore.voidstop(ComponentContext context)Stop the component.protected booleansyncRootFactoryMatches(DocumentModel doc, boolean relaxSyncRootConstraint)voidunregisterContribution(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:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
- Overrides:
unregisterContributionin classDefaultComponent
-
activate
public void activate(ComponentContext context)
Description copied from interface:ComponentActivates the component.This method is called by the runtime when a component is activated.
- Specified by:
activatein interfaceComponent- Overrides:
activatein classDefaultComponent- Parameters:
context- the runtime context
-
deactivate
public void deactivate(ComponentContext context)
Description copied from interface:ComponentDeactivates the component.This method is called by the runtime when a component is deactivated.
- Specified by:
deactivatein interfaceComponent- Overrides:
deactivatein 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:
startin interfaceComponent- Overrides:
startin classDefaultComponent
-
stop
public void stop(ComponentContext context) throws InterruptedException
Description copied from interface:ComponentStop the component.- Specified by:
stopin interfaceComponent- Overrides:
stopin classDefaultComponent- Throws:
InterruptedException
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc)
Description copied from interface:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModel. If the document is in the trash it is not considered as adaptable as aFileSystemItem, thus the method returns null.- Specified by:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis not adaptable as aFileSystemItem - See Also:
FileSystemItemFactory.getFileSystemItem(DocumentModel)
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted)
Description copied from interface:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModel. IfincludeDeletedis 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:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis not adaptable as aFileSystemItem - See Also:
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean)
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint)
Description copied from interface:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModel.If
includeDeletedis 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
relaxSyncRootConstraintis true no filter is applied on the synchronization root aspect for the current user.- Specified by:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis 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:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModel.If
includeDeletedis 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
relaxSyncRootConstraintis true no filter is applied on the synchronization root aspect for the current user.If
getLockInfois true theLockis fetched from theDocumentModeland set on the returnedFileSystemItem.- Specified by:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis not adaptable as aFileSystemItem - See Also:
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean, boolean, boolean)
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem)
Description copied from interface:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModelforcing 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:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis not adaptable as aFileSystemItem - See Also:
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem)
-
getFileSystemItem
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted)
Description copied from interface:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModelforcing its parent with the givenparentItem. IfincludeDeletedis 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:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis 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:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModelforcing its parent with the givenparentItem.If
includeDeletedis 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
relaxSyncRootConstraintis true no filter is applied on the synchronization root aspect for the current user.- Specified by:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis 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:FileSystemItemAdapterServiceGets theFileSystemItemfor the givenDocumentModelforcing its parent with the givenparentItem.If
includeDeletedis 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
relaxSyncRootConstraintis true no filter is applied on the synchronization root aspect for the current user.If
getLockInfois true theLockis fetched from theDocumentModeland set on the returnedFileSystemItem.- Specified by:
getFileSystemItemin interfaceFileSystemItemAdapterService- Returns:
- the
FileSystemItemor null if theDocumentModelis 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 givenFileSystemItemid.- Specified by:
getFileSystemItemFactoryForIdin interfaceFileSystemItemAdapterService- See Also:
FileSystemItemFactory.canHandleFileSystemItemId(String)
-
getTopLevelFolderItemFactory
public TopLevelFolderItemFactory getTopLevelFolderItemFactory()
Description copied from interface:FileSystemItemAdapterServiceGets theTopLevelFolderItemFactory.- Specified by:
getTopLevelFolderItemFactoryin interfaceFileSystemItemAdapterService
-
getVirtualFolderItemFactory
public VirtualFolderItemFactory getVirtualFolderItemFactory(String factoryName)
Description copied from interface:FileSystemItemAdapterServiceGets theVirtualFolderItemFactoryfor the given factory name.- Specified by:
getVirtualFolderItemFactoryin interfaceFileSystemItemAdapterService
-
getActiveFileSystemItemFactories
public Set<String> getActiveFileSystemItemFactories()
Description copied from interface:FileSystemItemAdapterServiceGets the activeFileSystemItemfactory names.- Specified by:
getActiveFileSystemItemFactoriesin interfaceFileSystemItemAdapterService
-
getScrollBatchSemaphore
public Semaphore getScrollBatchSemaphore()
Description copied from interface:FileSystemItemAdapterServiceAllows to limit the number of concurrent scrolls run byFolderItem.scrollDescendants(String, int, long).- Specified by:
getScrollBatchSemaphorein 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 nullFileSystemItemfor 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
defaultFileSystemItemFactorybound 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)
-
-