public class FileSystemItemAdapterServiceImpl extends DefaultComponent implements FileSystemItemAdapterService
FileSystemItemAdapterService
.Modifier and Type | Field and Description |
---|---|
static String |
ACTIVE_FILE_SYSTEM_ITEM_FACTORIES_EP |
protected ActiveFileSystemItemFactoryRegistry |
activeFileSystemItemFactoryRegistry |
protected ActiveTopLevelFolderItemFactoryRegistry |
activeTopLevelFolderItemFactoryRegistry |
protected static String |
CONCURRENT_SCROLL_BATCH_LIMIT |
protected static String |
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 |
lastModified
Constructor and Description |
---|
FileSystemItemAdapterServiceImpl() |
Modifier and Type | Method and 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 active
FileSystemItem factory names. |
FileSystemItem |
getFileSystemItem(DocumentModel doc)
Gets the
FileSystemItem for the given DocumentModel . |
FileSystemItem |
getFileSystemItem(DocumentModel doc,
boolean includeDeleted)
Gets the
FileSystemItem for the given DocumentModel . |
FileSystemItem |
getFileSystemItem(DocumentModel doc,
boolean includeDeleted,
boolean relaxSyncRootConstraint)
Gets the
FileSystemItem for the given DocumentModel . |
FileSystemItem |
getFileSystemItem(DocumentModel doc,
boolean includeDeleted,
boolean relaxSyncRootConstraint,
boolean getLockInfo)
Gets the
FileSystemItem for the given DocumentModel . |
protected FileSystemItem |
getFileSystemItem(DocumentModel doc,
boolean forceParentItem,
FolderItem parentItem,
boolean includeDeleted,
boolean relaxSyncRootConstraint,
boolean getLockInfo)
Tries to adapt the given document as the top level
FolderItem . |
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 given
FileSystemItem id. |
Semaphore |
getScrollBatchSemaphore()
Allows to limit the number of concurrent scrolls run by
FolderItem.scrollDescendants(String, int, long) . |
TopLevelFolderItemFactory |
getTopLevelFolderItemFactory()
Gets the
TopLevelFolderItemFactory . |
VirtualFolderItemFactory |
getVirtualFolderItemFactory(String factoryName)
Gets the
VirtualFolderItemFactory 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 strategy
|
void |
start(ComponentContext context)
Sorts the contributed factories according to their order and initializes the
scrollBatchSemaphore . |
void |
stop(ComponentContext context)
Stop the component.
|
protected boolean |
syncRootFactoryMatches(DocumentModel doc,
boolean relaxSyncRootConstraint) |
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
getAdapter, getLastModified, registerExtension, setLastModified, setModifiedNow, unregisterExtension
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted, getApplicationStartedOrder
public static final String FILE_SYSTEM_ITEM_FACTORY_EP
public static final String TOP_LEVEL_FOLDER_ITEM_FACTORY_EP
public static final String ACTIVE_FILE_SYSTEM_ITEM_FACTORIES_EP
protected static final String CONCURRENT_SCROLL_BATCH_LIMIT
protected static final String CONCURRENT_SCROLL_BATCH_LIMIT_DEFAULT
protected TopLevelFolderItemFactoryRegistry topLevelFolderItemFactoryRegistry
protected FileSystemItemFactoryRegistry fileSystemItemFactoryRegistry
protected ActiveTopLevelFolderItemFactoryRegistry activeTopLevelFolderItemFactoryRegistry
protected ActiveFileSystemItemFactoryRegistry activeFileSystemItemFactoryRegistry
protected TopLevelFolderItemFactory topLevelFolderItemFactory
protected List<FileSystemItemFactoryWrapper> fileSystemItemFactories
protected Semaphore scrollBatchSemaphore
public FileSystemItemAdapterServiceImpl()
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextpublic void start(ComponentContext context)
scrollBatchSemaphore
.start
in interface Component
start
in class DefaultComponent
public void stop(ComponentContext context) throws InterruptedException
Component
stop
in interface Component
stop
in class DefaultComponent
InterruptedException
public FileSystemItem getFileSystemItem(DocumentModel doc)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
. If the document is in the "deleted" life
cycle state it is not considered as adaptable as a FileSystemItem
, thus the method returns null.getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel)
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
. If includeDeleted
is true no filter
is applied on the "deleted" life cycle state, else if the document is in this state it is not considered as
adaptable as a FileSystemItem
, thus the method returns null.getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean)
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
.
If includeDeleted
is true no filter is applied on the "deleted" life cycle state, else if the document is
in this state it is not considered as adaptable as a FileSystemItem
, thus the method returns null.
If relaxSyncRootConstraint
is true no filter is applied on the synchronization root aspect for the
current user.
getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean, boolean)
public FileSystemItem getFileSystemItem(DocumentModel doc, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
.
If includeDeleted
is true no filter is applied on the "deleted" life cycle state, else if the document is
in this state it is not considered as adaptable as a FileSystemItem
, 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 the Lock
is fetched from the DocumentModel
and set on the returned
FileSystemItem
.
getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel, boolean, boolean, boolean)
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
forcing its parent with the given
parentItem
. If the document is in the "deleted" life cycle state it is not considered as adaptable as a
FileSystemItem
, thus the method returns null.getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem)
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
forcing its parent with the given
parentItem
. If includeDeleted
is true no filter is applied on the "deleted" life cycle state,
else if the document is in this state it is not considered as adaptable as a FileSystemItem
, thus the
method returns null.getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem, boolean)
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
forcing its parent with the given
parentItem
.
If includeDeleted
is true no filter is applied on the "deleted" life cycle state, else if the document is
in this state it is not considered as adaptable as a FileSystemItem
, thus the method returns null.
If relaxSyncRootConstraint
is true no filter is applied on the synchronization root aspect for the
current user.
getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem, boolean, boolean)
public FileSystemItem getFileSystemItem(DocumentModel doc, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo)
FileSystemItemAdapterService
FileSystemItem
for the given DocumentModel
forcing its parent with the given
parentItem
.
If includeDeleted
is true no filter is applied on the "deleted" life cycle state, else if the document is
in this state it is not considered as adaptable as a FileSystemItem
, 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 the Lock
is fetched from the DocumentModel
and set on the returned
FileSystemItem
.
getFileSystemItem
in interface FileSystemItemAdapterService
FileSystemItem
or null if the DocumentModel
is not adaptable as a
FileSystemItem
FileSystemItemFactory.getFileSystemItem(DocumentModel, FolderItem, boolean, boolean, boolean)
public FileSystemItemFactory getFileSystemItemFactoryForId(String id)
FileSystemItem
id.getFileSystemItemFactoryForId
in interface FileSystemItemAdapterService
FileSystemItemFactory.canHandleFileSystemItemId(String)
public TopLevelFolderItemFactory getTopLevelFolderItemFactory()
FileSystemItemAdapterService
TopLevelFolderItemFactory
.getTopLevelFolderItemFactory
in interface FileSystemItemAdapterService
public VirtualFolderItemFactory getVirtualFolderItemFactory(String factoryName)
FileSystemItemAdapterService
VirtualFolderItemFactory
for the given factory name.getVirtualFolderItemFactory
in interface FileSystemItemAdapterService
public Set<String> getActiveFileSystemItemFactories()
FileSystemItemAdapterService
FileSystemItem
factory names.getActiveFileSystemItemFactories
in interface FileSystemItemAdapterService
public Semaphore getScrollBatchSemaphore()
FileSystemItemAdapterService
FolderItem.scrollDescendants(String, int, long)
.getScrollBatchSemaphore
in interface FileSystemItemAdapterService
public Map<String,FileSystemItemFactoryDescriptor> getFileSystemItemFactoryDescriptors()
public List<FileSystemItemFactoryWrapper> getFileSystemItemFactories()
public FileSystemItemFactory getFileSystemItemFactory(String name)
@Deprecated public void setActiveFactories()
protected FileSystemItem getFileSystemItem(DocumentModel doc, boolean forceParentItem, FolderItem parentItem, boolean includeDeleted, boolean relaxSyncRootConstraint, boolean getLockInfo)
FolderItem
. If it doesn't match, iterates on the
ordered contributed file system item factories until it finds one that matches and retrieves a non null
FileSystemItem
for the given document. A file system item factory matches if:
defaultFileSystemItemFactory
bound to DefaultFileSystemItemFactory
)protected boolean generalFactoryMatches(FileSystemItemFactoryWrapper factory)
protected boolean docTypeFactoryMatches(FileSystemItemFactoryWrapper factory, DocumentModel doc)
protected boolean facetFactoryMatches(FileSystemItemFactoryWrapper factory, DocumentModel doc, boolean relaxSyncRootConstraint)
protected boolean syncRootFactoryMatches(DocumentModel doc, boolean relaxSyncRootConstraint)
Copyright © 2018 Nuxeo. All rights reserved.