public class DefaultBlobDispatcher extends Object implements BlobDispatcher
Alternatively, it can be configured through properties to dispatch to a blob provider based on document properties instead of the repository name.
The property name is a list of comma-separated clauses, with each clause consisting of a property, an operator and a
value. The property can be a Document
xpath, ecm:repositoryName
, or, to match the current blob being
dispatched, blob:name
, blob:mime-type
, blob:encoding
, blob:digest
or
blob:length
. Comma-separated clauses are ANDed together. The special name default
defines the default
provider, and must be present.
Available operators between property and value are =, !=, <, and >.
For example, to dispatch to the "first" provider if dc:format is "video", to the "second" provider if the blob's MIME type is "video/mp4", to the "third" provider if the lifecycle state is "approved" and the document is in the default repository, and otherwise to the "fourth" provider:
<property name="dc:format=video">first</property> <property name="blob:mime-type=video/mp4">second</property> <property name="ecm:repositoryName=default,ecm:lifeCycleState=approved">third2</property> <property name="default">fourth</property>
BlobDispatcher.BlobDispatch
Constructor and Description |
---|
DefaultBlobDispatcher() |
Modifier and Type | Method and Description |
---|---|
BlobDispatcher.BlobDispatch |
getBlobProvider(Document doc,
Blob blob)
Decides which
BlobProvider to use to write the given blob, and whether the provider id should be added as
prefix to the managed blob key. |
String |
getBlobProvider(String repositoryName)
Decides which
BlobProvider to use to read a blob from the given repository if no prefix is specified in
the blob key. |
Collection<String> |
getBlobProviderIds()
Gets the provider ids to which this dispatcher can dispatch.
|
void |
initialize(Map<String,String> properties)
Initializes this blob dispatcher.
|
void |
notifyChanges(Document doc,
Set<String> xpaths)
Notifies the blob dispatcher that a set of xpaths have changed on a document.
|
public void initialize(Map<String,String> properties)
BlobDispatcher
initialize
in interface BlobDispatcher
public Collection<String> getBlobProviderIds()
BlobDispatcher
Blobs already having a provider id not listed here won't be touched on write.
getBlobProviderIds
in interface BlobDispatcher
public String getBlobProvider(String repositoryName)
BlobDispatcher
BlobProvider
to use to read a blob from the given repository if no prefix is specified in
the blob key.getBlobProvider
in interface BlobDispatcher
repositoryName
- the repository namepublic BlobDispatcher.BlobDispatch getBlobProvider(Document doc, Blob blob)
BlobDispatcher
BlobProvider
to use to write the given blob, and whether the provider id should be added as
prefix to the managed blob key.getBlobProvider
in interface BlobDispatcher
doc
- the document containing the blobblob
- the blobpublic void notifyChanges(Document doc, Set<String> xpaths)
BlobDispatcher
notifyChanges
in interface BlobDispatcher
doc
- the documentxpaths
- the set of changed xpathsCopyright © 2015 Nuxeo SA. All rights reserved.