|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.content.ContentServiceImpl
public class ContentServiceImpl
Service implementation acting as a level of indirection between the client and the underlying content store.
Note: This class was formerly the RoutingContentService
but the
'routing' functionality has been pushed into the store
implementations.
Constructor Summary | |
---|---|
ContentServiceImpl()
|
Method Summary | |
---|---|
java.util.List |
getActiveTransformers(java.lang.String sourceMimetype,
java.lang.String targetMimetype,
TransformationOptions options)
Fetch all the transformers that are capable of transforming the content in the given source mimetype to the given target mimetype with the provided transformation options. |
ContentTransformer |
getImageTransformer()
Fetch the transformer that is capable of transforming image content. |
org.alfresco.service.cmr.repository.ContentReader |
getRawReader(java.lang.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(java.lang.String sourceMimetype,
java.lang.String targetMimetype)
Fetch the transformer that is capable of transforming the content in the given source mimetype to the given target mimetype. |
ContentTransformer |
getTransformer(java.lang.String sourceMimetype,
java.lang.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. |
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)
Returns whether a transformer exists that can read the content from the reader and write the content back out to the 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,
java.util.Map before,
java.util.Map after)
Update properties policy behaviour |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
|
void |
setAvmService(AVMService service)
|
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(ContentStore store)
|
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,
java.util.Map options)
Deprecated. |
void |
transform(org.alfresco.service.cmr.repository.ContentReader reader,
org.alfresco.service.cmr.repository.ContentWriter writer,
TransformationOptions options)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContentServiceImpl()
Method Detail |
---|
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(ContentStore store)
public void setPolicyComponent(PolicyComponent policyComponent)
public void setAvmService(AVMService service)
public void setImageMagickContentTransformer(ContentTransformer imageMagickContentTransformer)
public void setIgnoreEmptyContent(boolean ignoreEmptyContent)
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 init()
public void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map before, java.util.Map 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(java.lang.String contentUrl)
null is never returned, but the reader should always be checked for
existence
.
getRawReader
in interface ContentService
contentUrl
- a content store URL
public 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 content
FileContentReader.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, java.util.Map 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 transformation
NoTransformerException
- if no transformer exists for the
given source and target mimetypes of the reader and writer
ContentIOException
- 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 transformation
NoTransformerException
- if no transformer exists for the
given source and target mimetypes of the reader and writer
ContentIOException
- if the transformation failsContentTransformerRegistry
,
ContentTransformer
public ContentTransformer getTransformer(java.lang.String sourceMimetype, java.lang.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
ContentTransformerRegistry
,
ContentTransformer
public ContentTransformer getTransformer(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
ContentService
getTransformer
in interface ContentService
sourceMimetype
- the source mimetypetargetMimetype
- the target mimetypeoptions
- the transformation options
ContentService.getTransformer(java.lang.String, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions)
public java.util.List getActiveTransformers(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
ContentService
getActiveTransformers
in interface ContentService
sourceMimetype
- the source mimetypetargetMimetype
- the target mimetypeoptions
- the transformation options
ContentAccessor.getMimetype()
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)
ContentService
Since no transformation options are specified, only the source and target mimetypes will be considered when making this decision.
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 mimetype
ContentTransformerRegistry
,
ContentTransformer
public boolean isTransformable(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)
ContentService
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 options
ContentService.isTransformable(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter, org.alfresco.service.cmr.repository.TransformationOptions)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |