public class ContentServiceImpl extends Object implements ContentService, org.springframework.context.ApplicationContextAware
Note: This class was formerly the RoutingContentService
but the
'routing' functionality has been pushed into the store
implementations.
Modifier and Type | Field and Description |
---|---|
protected TransformerDebug |
transformerDebug |
Constructor and Description |
---|
ContentServiceImpl() |
Modifier and Type | Method and Description |
---|---|
List<ContentTransformer> |
getActiveTransformers(String sourceMimetype,
long sourceSize,
String targetMimetype,
TransformationOptions options) |
List<ContentTransformer> |
getActiveTransformers(String sourceMimetype,
String targetMimetype,
TransformationOptions options) |
ContentTransformer |
getImageTransformer()
Fetch the transformer that is capable of transforming image content.
|
long |
getMaxSourceSizeBytes(String sourceMimetype,
String targetMimetype,
TransformationOptions options)
Returns the maximum source size of any content that may transformed between the supplied
mimetypes using the supplied options.
|
org.alfresco.service.cmr.repository.ContentReader |
getRawReader(String contentUrl)
Fetch content from the low-level stores using a content URL.
|
org.alfresco.service.cmr.repository.ContentReader |
getReader(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.namespace.QName propertyQName)
Gets a reader for the content associated with the given node property.
|
long |
getStoreFreeSpace()
Gets the remaing available space in the underlying content store.
|
long |
getStoreTotalSpace()
Gets the total space of the underlying content store (not exclusively Alfresco-controlled binaries).
|
org.alfresco.service.cmr.repository.ContentWriter |
getTempWriter()
Gets a writer to a temporary location.
|
ContentTransformer |
getTransformer(String sourceMimetype,
String targetMimetype)
Fetch the transformer that is capable of transforming the content in the
given source mimetype to the given target mimetype.
|
ContentTransformer |
getTransformer(String sourceUrl,
String sourceMimetype,
long sourceSize,
String targetMimetype,
TransformationOptions options)
Fetch the transformer that is capable of transforming the content in the
given source mimetype to the given target mimetype with the provided transformation
options.
|
ContentTransformer |
getTransformer(String sourceMimetype,
String targetMimetype,
TransformationOptions options) |
List<ContentTransformer> |
getTransformers(String sourceUrl,
String sourceMimetype,
long sourceSize,
String targetMimetype,
TransformationOptions options)
Fetch the transformers that are capable of transforming the content in the
given source mimetype to the given target mimetype with the provided transformation
options.
|
org.alfresco.service.cmr.repository.ContentWriter |
getWriter(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.namespace.QName propertyQName,
boolean update)
Get a content writer for the given node property, choosing to optionally have
the node property updated automatically when the content stream closes.
|
void |
init()
Service initialise
|
boolean |
isTransformable(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer) |
boolean |
isTransformable(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
Returns whether a transformer exists that can read the content from
the reader and write the content back out to the writer with the
provided tranformation options.
|
void |
onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef,
Map<org.alfresco.service.namespace.QName,Serializable> before,
Map<org.alfresco.service.namespace.QName,Serializable> after)
Update properties policy behaviour
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) |
void |
setEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner) |
void |
setIgnoreEmptyContent(boolean ignoreEmptyContent) |
void |
setImageMagickContentTransformer(ContentTransformer imageMagickContentTransformer) |
void |
setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setPolicyComponent(PolicyComponent policyComponent) |
void |
setRetryingTransactionHelper(RetryingTransactionHelper helper) |
void |
setStore(org.alfresco.repo.content.ContentStore store) |
void |
setTransformerDebug(TransformerDebug transformerDebug)
Helper setter of the transformer debug.
|
void |
setTransformerFailover(boolean transformerFailover)
Allows fail over form one transformer to another when there is
more than one transformer available.
|
void |
setTransformerRegistry(ContentTransformerRegistry transformerRegistry) |
void |
transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer)
Transforms the content from the reader and writes the content
back out to the writer.
|
void |
transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
Map<String,Object> options)
Deprecated.
|
void |
transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options) |
protected TransformerDebug transformerDebug
public void setRetryingTransactionHelper(RetryingTransactionHelper helper)
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
public void setTransformerRegistry(ContentTransformerRegistry transformerRegistry)
public void setEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner)
public void setStore(org.alfresco.repo.content.ContentStore store)
public void setPolicyComponent(PolicyComponent policyComponent)
public void setImageMagickContentTransformer(ContentTransformer imageMagickContentTransformer)
public void setIgnoreEmptyContent(boolean ignoreEmptyContent)
public void setTransformerFailover(boolean transformerFailover)
transformerFailover
- true
(the default) indicate
that fail over should take place.public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void setTransformerDebug(TransformerDebug transformerDebug)
transformerDebug
- TransformerDebugpublic void init()
public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, Map<org.alfresco.service.namespace.QName,Serializable> before, Map<org.alfresco.service.namespace.QName,Serializable> after)
nodeRef
- the node referencebefore
- the before values of the propertiesafter
- the after values of the propertiespublic long getStoreFreeSpace()
ContentService
getStoreFreeSpace
in interface ContentService
public long getStoreTotalSpace()
ContentService
getStoreTotalSpace
in interface ContentService
public org.alfresco.service.cmr.repository.ContentReader getRawReader(String contentUrl)
null is never returned, but the reader should always be checked for
existence
.
getRawReader
in interface ContentService
contentUrl
- a content store URLpublic org.alfresco.service.cmr.repository.ContentReader getReader(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName propertyQName)
ContentService
If a content URL is present for the given node then a reader must
be returned. The exists
method should then
be used to detect 'missing' content.
getReader
in interface ContentService
nodeRef
- a reference to a node having a content propertypropertyQName
- the name of the property, which must be of type contentFileContentReader.getSafeContentReader(ContentReader, String, Object[])
public org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName propertyQName, boolean update)
ContentService
If the update flag is off, then the state of the node property will remain unchanged regardless of the state of the written binary data. If the flag is on, then the node property will be updated on the same thread as the code that closed the write channel.
If no node is supplied, then the writer will provide a stream into the backing content store, but will not be associated with any new or previous content.
NOTE: The content URL provided will be registered for automatic cleanup in the event that the transaction, in which this method was called, rolls back. If the transaction is successful, the writer may still be open and available for use but the underlying binary will not be cleaned up subsequently. The recommended pattern is to group calls to retrieve the writer in the same transaction as the calls to subsequently update and close the write stream - including setting of the related content properties.getWriter
in interface ContentService
nodeRef
- a reference to a node having a content property, or null
to just get a valid writer into a backing content store.propertyQName
- the name of the property, which must be of type contentupdate
- true if the property must be updated atomically when the content write
stream is closed (attaches a listener to the stream); false if the client code
will perform the updates itself.public org.alfresco.service.cmr.repository.ContentWriter getTempWriter()
ContentService
getTempWriter
in interface ContentService
public void transform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer)
ContentService
The mimetypes used for the transformation must be set both on
the reader
and on the
writer
.
transform
in interface ContentService
reader
- the source content location and mimetypewriter
- the target content location and mimetypeContentTransformerRegistry
,
ContentTransformer
,
ContentService.transform(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter)
public void transform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, Map<String,Object> options) throws NoTransformerException, org.alfresco.service.cmr.repository.ContentIOException
transform
in interface ContentService
reader
- the source content location and mimetypewriter
- the target content location and mimetypeoptions
- the options for the transformationNoTransformerException
- if no transformer exists for the
given source and target mimetypes of the reader and writerContentIOException
- if the transformation failsContentTransformerRegistry
,
ContentTransformer
public void transform(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options) throws NoTransformerException, org.alfresco.service.cmr.repository.ContentIOException
transform
in interface ContentService
reader
- the source content location and mimetypewriter
- the target content location and mimetypeoptions
- the options for the transformationNoTransformerException
- if no transformer exists for the
given source and target mimetypes of the reader and writerContentIOException
- if the transformation failsContentTransformerRegistry
,
ContentTransformer
public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype)
ContentService
Since no transformation options are provided only the source and destination mimetypes are considered when getting the correct transformer.
getTransformer
in interface ContentService
sourceMimetype
- the source mimetypetargetMimetype
- the target mimetypeContentTransformerRegistry
,
ContentTransformer
public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype, TransformationOptions options)
getTransformer
in interface ContentService
public ContentTransformer getTransformer(String sourceUrl, String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
ContentService
getTransformer
in interface ContentService
sourceUrl
- TODOsourceMimetype
- the source mimetypesourceSize
- the source size (bytes). Ignored if negative.targetMimetype
- the target mimetypeoptions
- the transformation optionsContentService.getTransformer(String, java.lang.String, long, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions)
public List<ContentTransformer> getTransformers(String sourceUrl, String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
ContentService
getTransformers
in interface ContentService
sourceUrl
- TODOsourceMimetype
- the source mimetypesourceSize
- the source size (bytes). Ignored if negative.targetMimetype
- the target mimetypeoptions
- the transformation optionsContentService.getTransformers(String, java.lang.String, long, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions)
public long getMaxSourceSizeBytes(String sourceMimetype, String targetMimetype, TransformationOptions options)
getMaxSourceSizeBytes
in interface ContentService
sourceMimetype
- source mime typetargetMimetype
- target mime typeoptions
- transformation optionspublic List<ContentTransformer> getActiveTransformers(String sourceMimetype, String targetMimetype, TransformationOptions options)
getActiveTransformers
in interface ContentService
public List<ContentTransformer> getActiveTransformers(String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options)
getActiveTransformers
in interface ContentService
public ContentTransformer getImageTransformer()
ContentService
getImageTransformer
in interface ContentService
ContentService.getImageTransformer()
public boolean isTransformable(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer)
isTransformable
in interface ContentService
ContentTransformerRegistry
,
ContentTransformer
public boolean isTransformable(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)
ContentService
If you are about to call ContentService.transform(ContentReader, ContentWriter, TransformationOptions)
it is best NOT to call this method first as it must perform the same steps and will throw
NoTransformerException if there are no transformers.
The mimetypes used for the transformation must be set both on
the reader
and on the
writer
.
isTransformable
in interface ContentService
reader
- the source content location and mimetypewriter
- the target content location and mimetypeoptions
- the transformation optionsContentService.isTransformable(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter, org.alfresco.service.cmr.repository.TransformationOptions)
Copyright © 2005–2017 Alfresco Software. All rights reserved.