public class FilesystemBlobProvider extends AbstractBlobProvider
This blob provider MUST be configured with a "root" property that specifies the minimum root path for all files:
<blobprovider name="myfsblobprovider">
<class>org.nuxeo.ecm.core.blob.FilesystemBlobProvider</class>
<property name="root">/base/directory/for/files</property>
</blobprovider>
A root of /
may be used to allow any path.
Blobs are constructed through createBlob(org.nuxeo.ecm.core.blob.BlobManager.BlobInfo)
. The constructed blob's key, which will be
stored in the document database, contains a path relative to the root.
Modifier and Type | Field and Description |
---|---|
protected String |
root
The root ending with /, or an empty string.
|
static String |
ROOT_PROP |
blobProviderId, properties
Constructor and Description |
---|
FilesystemBlobProvider() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this blob provider and releases resources that may be held by it.
|
ManagedBlob |
createBlob(BlobManager.BlobInfo blobInfo)
Creates a filesystem blob with the given information.
|
InputStream |
getStream(ManagedBlob blob)
Gets an
InputStream for the data of a managed blob. |
void |
initialize(String blobProviderId,
Map<String,String> properties)
Initializes the blob provider.
|
Blob |
readBlob(BlobManager.BlobInfo blobInfo)
Reads a
Blob from storage. |
boolean |
supportsUserUpdate()
Checks if user update is supported.
|
String |
writeBlob(Blob blob,
Document doc)
Writes a
Blob to storage and returns information about it. |
supportsUserUpdateDefaultFalse, supportsUserUpdateDefaultTrue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
freezeVersion, getAppLinks, getAvailableConversions, getBinaryManager, getConvertedStream, getThumbnail, getURI, isVersion, performsExternalAccessControl
public static final String ROOT_PROP
public FilesystemBlobProvider()
public void initialize(String blobProviderId, Map<String,String> properties) throws IOException
BlobProvider
initialize
in interface BlobProvider
initialize
in class AbstractBlobProvider
blobProviderId
- the blob provider id for this binary managerproperties
- initialization propertiesIOException
public void close()
BlobProvider
public Blob readBlob(BlobManager.BlobInfo blobInfo) throws IOException
BlobProvider
Blob
from storage.blobInfo
- the blob informationIOException
public InputStream getStream(ManagedBlob blob) throws IOException
BlobProvider
InputStream
for the data of a managed blob.
Like all InputStream
, the result must be closed when done with it to avoid resource leaks.
blob
- the managed blobIOException
public boolean supportsUserUpdate()
BlobProvider
A user update refers to the fact that a blob from this provider may be overwritten with another blob, wherever the original blob may occur (usually in a document property).
supportsUserUpdate
in interface BlobProvider
supportsUserUpdate
in class AbstractBlobProvider
true
if user update is supportedpublic String writeBlob(Blob blob, Document doc) throws IOException
BlobProvider
Blob
to storage and returns information about it.
Called to store a user-created blob.
blob
- the blobdoc
- the document to which this blob belongsIOException
public ManagedBlob createBlob(BlobManager.BlobInfo blobInfo) throws IOException
The passed BlobManager.BlobInfo
contains information about the blob, and the key is a file path.
blobInfo
- the blob info where the key is a file pathIOException
Copyright © 2016 Nuxeo SA. All rights reserved.