Class FileManagerService
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.filemanager.service.FileManagerService
-
- All Implemented Interfaces:
FileManager
,Adaptable
,Component
,Extensible
,TimestampedService
public class FileManagerService extends DefaultComponent implements FileManager
FileManager registry service.This is the component to request to perform transformations. See API.
- Author:
- Andreas Kalogeropoulos
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEF_VERSIONING_AFTER_ADD
static VersioningOption
DEF_VERSIONING_OPTION
static String
DEFAULT_FOLDER_TYPE_NAME
static int
MAX
static ComponentName
NAME
static String
PLUGINS_EP
static String
QUERY
static String
UNICITY_EP
static String
VERSIONING_EP
-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description FileManagerService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String
computePluginsExtensionPoint(Class<?> klass)
DocumentModel
createDocumentFromBlob(CoreSession documentManager, Blob input, String path, boolean overwrite, String fullName)
Returns an initialized doc based on a given blob.DocumentModel
createDocumentFromBlob(CoreSession documentManager, Blob input, String path, boolean overwrite, String fullName, boolean noMimeTypeCheck)
Returns an initialized doc based on a given blob.DocumentModel
createFolder(CoreSession documentManager, String fullname, String path, boolean overwrite)
Creates a Folder.DocumentModel
createOrUpdateDocument(FileImporterContext context)
Returns a created or updated document based on the givencontext
.DocumentModel
defaultCreateFolder(CoreSession documentManager, String fullname, String path)
Deprecated.since 9.1, usedefaultCreateFolder(CoreSession, String, String, boolean)
insteadDocumentModel
defaultCreateFolder(CoreSession documentManager, String fullname, String path, boolean overwrite)
DocumentModel
defaultCreateFolder(CoreSession documentManager, String fullname, String path, String containerTypeName, boolean checkAllowedSubTypes)
Deprecated.since 9.1, usedefaultCreateFolder(CoreSession, String, String, String, boolean, boolean)
insteadDocumentModel
defaultCreateFolder(CoreSession documentManager, String fullname, String path, String containerTypeName, boolean checkAllowedSubTypes, boolean overwrite)
boolean
doVersioningAfterAdd()
Deprecated.since 9.1 automatic versioning is now handled at versioning service level, remove versioning behaviors from importersList<DocumentLocation>
findExistingDocumentWithFile(CoreSession documentManager, String path, String digest, NuxeoPrincipal principal)
DocumentModelList
getCreationContainers(CoreSession documentManager, String docType)
Returns the list of document that are to be suggested to the principal of documentManager as a candidate container for a new document of type docType.DocumentModelList
getCreationContainers(NuxeoPrincipal principal, String docType)
Returns the list of document that are to be suggested to principalName as a candidate container for a new document of type docType on all registered repositories.String
getDigestAlgorithm()
List<String>
getFields()
FileImporter
getPluginByName(String name)
VersioningOption
getVersioningOption()
Deprecated.since 9.1 automatic versioning is now handled at versioning service level, remove versioning behaviors from importersboolean
isDigestComputingEnabled()
protected boolean
isImporterAvailable(FileImporter importer, String normalizedMimeType, String mimeType, boolean excludeOneToMany)
boolean
isUnicityEnabled()
void
registerContribution(Object contribution, String xp, ComponentInstance component)
protected void
registerCreationContainerListProviders()
protected void
registerFileImporters()
protected void
registerFolderImporters()
protected void
registerUnicity()
protected void
registerVersioning()
Deprecated.since 9.1void
start(ComponentContext context)
Start the component.void
unregisterContribution(Object contribution, String xp, ComponentInstance component)
DocumentModel
updateDocumentFromBlob(CoreSession documentManager, Blob input, String path, String fullName)
Just applies the same actions as creation but does not changes the doc type.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, stop, 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
-
Methods inherited from interface org.nuxeo.ecm.platform.filemanager.api.FileManager
createFolder
-
-
-
-
Field Detail
-
NAME
public static final ComponentName NAME
-
DEFAULT_FOLDER_TYPE_NAME
public static final String DEFAULT_FOLDER_TYPE_NAME
- See Also:
- Constant Field Values
-
QUERY
public static final String QUERY
- See Also:
- Constant Field Values
-
MAX
public static final int MAX
- See Also:
- Constant Field Values
-
PLUGINS_EP
public static final String PLUGINS_EP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
UNICITY_EP
public static final String UNICITY_EP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
VERSIONING_EP
public static final String VERSIONING_EP
- Since:
- 11.1
- See Also:
- Constant Field Values
-
DEF_VERSIONING_OPTION
public static final VersioningOption DEF_VERSIONING_OPTION
-
DEF_VERSIONING_AFTER_ADD
public static final boolean DEF_VERSIONING_AFTER_ADD
- See Also:
- Constant Field Values
-
-
Method Detail
-
registerContribution
public void registerContribution(Object contribution, String xp, ComponentInstance component)
- Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String xp, ComponentInstance component)
- Overrides:
unregisterContribution
in classDefaultComponent
-
start
public void start(ComponentContext context)
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
registerFileImporters
protected void registerFileImporters()
-
registerFolderImporters
protected void registerFolderImporters()
-
registerCreationContainerListProviders
protected void registerCreationContainerListProviders()
-
registerUnicity
protected void registerUnicity()
-
registerVersioning
@Deprecated(since="9.1") protected void registerVersioning()
Deprecated.since 9.1
-
createFolder
public DocumentModel createFolder(CoreSession documentManager, String fullname, String path, boolean overwrite) throws IOException
Description copied from interface:FileManager
Creates a Folder.- Specified by:
createFolder
in interfaceFileManager
fullname
- the full name of the folderpath
- the path were to create the folderoverwrite
- whether to overwrite an existing folder with the same title or not- Returns:
- the Folder Created
- Throws:
IOException
-
defaultCreateFolder
@Deprecated(since="9.1") public DocumentModel defaultCreateFolder(CoreSession documentManager, String fullname, String path)
Deprecated.since 9.1, usedefaultCreateFolder(CoreSession, String, String, boolean)
instead
-
defaultCreateFolder
public DocumentModel defaultCreateFolder(CoreSession documentManager, String fullname, String path, boolean overwrite)
- Since:
- 9.1
-
defaultCreateFolder
@Deprecated(since="9.1") public DocumentModel defaultCreateFolder(CoreSession documentManager, String fullname, String path, String containerTypeName, boolean checkAllowedSubTypes)
Deprecated.since 9.1, usedefaultCreateFolder(CoreSession, String, String, String, boolean, boolean)
instead
-
defaultCreateFolder
public DocumentModel defaultCreateFolder(CoreSession documentManager, String fullname, String path, String containerTypeName, boolean checkAllowedSubTypes, boolean overwrite)
- Since:
- 9.1
-
createDocumentFromBlob
public DocumentModel createDocumentFromBlob(CoreSession documentManager, Blob input, String path, boolean overwrite, String fullName) throws IOException
Description copied from interface:FileManager
Returns an initialized doc based on a given blob.- Specified by:
createDocumentFromBlob
in interfaceFileManager
input
- the blob containing the content and the mime typepath
- the path were to create the documentoverwrite
- whether to overwrite an existing file with the same title or notfullName
- the fullname that contains the filename- Returns:
- the created Document
- Throws:
IOException
-
createDocumentFromBlob
public DocumentModel createDocumentFromBlob(CoreSession documentManager, Blob input, String path, boolean overwrite, String fullName, boolean noMimeTypeCheck) throws IOException
Description copied from interface:FileManager
Returns an initialized doc based on a given blob.- Specified by:
createDocumentFromBlob
in interfaceFileManager
input
- the blob containing the content and the mime typepath
- the path were to create the documentoverwrite
- whether to overwrite an existing file with the same title or notfullName
- the fullname that contains the filenamenoMimeTypeCheck
- true if the blob's mime-type doesn't have to be checked against fullName- Returns:
- the created Document
- Throws:
IOException
-
createOrUpdateDocument
public DocumentModel createOrUpdateDocument(FileImporterContext context) throws IOException
Description copied from interface:FileManager
Returns a created or updated document based on the givencontext
.The document may not be persisted according to
FileImporterContext.isPersistDocument()
. That's the caller's responsibility to actually persist the document.Note that file importers may not use
FileImporterContext.isPersistDocument()
and always persist the document.- Specified by:
createOrUpdateDocument
in interfaceFileManager
- Returns:
- the created or updated document
- Throws:
IOException
- See Also:
FileImporterContext
-
isImporterAvailable
protected boolean isImporterAvailable(FileImporter importer, String normalizedMimeType, String mimeType, boolean excludeOneToMany)
-
updateDocumentFromBlob
public DocumentModel updateDocumentFromBlob(CoreSession documentManager, Blob input, String path, String fullName)
Description copied from interface:FileManager
Just applies the same actions as creation but does not changes the doc type.- Specified by:
updateDocumentFromBlob
in interfaceFileManager
input
- the blob containing the content and the mime typepath
- the path to the file to updatefullName
- the full name that contains the filename- Returns:
- the updated Document
-
getPluginByName
public FileImporter getPluginByName(String name)
-
findExistingDocumentWithFile
public List<DocumentLocation> findExistingDocumentWithFile(CoreSession documentManager, String path, String digest, NuxeoPrincipal principal)
- Specified by:
findExistingDocumentWithFile
in interfaceFileManager
-
isUnicityEnabled
public boolean isUnicityEnabled()
- Specified by:
isUnicityEnabled
in interfaceFileManager
-
isDigestComputingEnabled
public boolean isDigestComputingEnabled()
- Specified by:
isDigestComputingEnabled
in interfaceFileManager
-
getFields
public List<String> getFields()
- Specified by:
getFields
in interfaceFileManager
-
getCreationContainers
public DocumentModelList getCreationContainers(NuxeoPrincipal principal, String docType)
Description copied from interface:FileManager
Returns the list of document that are to be suggested to principalName as a candidate container for a new document of type docType on all registered repositories.- Specified by:
getCreationContainers
in interfaceFileManager
- Returns:
- the list of candidate containers
-
getCreationContainers
public DocumentModelList getCreationContainers(CoreSession documentManager, String docType)
Description copied from interface:FileManager
Returns the list of document that are to be suggested to the principal of documentManager as a candidate container for a new document of type docType.- Specified by:
getCreationContainers
in interfaceFileManager
- Returns:
- the list of candidate containers
-
getDigestAlgorithm
public String getDigestAlgorithm()
- Specified by:
getDigestAlgorithm
in interfaceFileManager
-
getVersioningOption
@Deprecated(since="9.1") public VersioningOption getVersioningOption()
Deprecated.since 9.1 automatic versioning is now handled at versioning service level, remove versioning behaviors from importersDescription copied from interface:FileManager
Gets the versioning applied on an overwritten document before it is overwritten.- Specified by:
getVersioningOption
in interfaceFileManager
-
doVersioningAfterAdd
@Deprecated(since="9.1") public boolean doVersioningAfterAdd()
Deprecated.since 9.1 automatic versioning is now handled at versioning service level, remove versioning behaviors from importersDescription copied from interface:FileManager
Checks whether versioning should also be applied after a document is added.- Specified by:
doVersioningAfterAdd
in interfaceFileManager
-
-