Class ContentServiceImpl
- All Implemented Interfaces:
ContentService,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
RoutingContentService
Note: This class was formerly the RoutingContentService but the
'routing' functionality has been pushed into the store
implementations.
- Since:
- 3.2
- Author:
- Derek Hulley
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDirectAccessUrl(NodeRef nodeRef, Date expiresAt) Gets a presigned URL to directly access a binary content.getRawReader(String contentUrl) Fetch content from the low-level stores using a content URL.Gets a reader for the content associated with the given node property.longGets the remaing available space in the underlying content store.longGets the total space of the underlying content store (not exclusively Alfresco-controlled binaries).Gets a writer to a temporary location.Get a content writer for the given node property, choosing to optionally have the node property updated automatically when the content stream closes.voidinit()Service initialisevoidonUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) Update properties policy behaviourvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetDictionaryService(DictionaryService dictionaryService) voidsetEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner) voidsetIgnoreEmptyContent(boolean ignoreEmptyContent) Deprecated.The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries.voidsetMimetypeService(MimetypeService mimetypeService) voidsetNodeService(NodeService nodeService) voidsetPolicyComponent(PolicyComponent policyComponent) voidvoidsetStore(ContentStore store)
-
Constructor Details
-
ContentServiceImpl
public ContentServiceImpl()
-
-
Method Details
-
setRetryingTransactionHelper
-
setDictionaryService
-
setNodeService
-
setMimetypeService
-
setEagerContentStoreCleaner
-
setStore
-
setPolicyComponent
-
setIgnoreEmptyContent
public void setIgnoreEmptyContent(boolean ignoreEmptyContent) Deprecated.The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. -
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
init
public void init()Service initialise -
onUpdateProperties
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) Update properties policy behaviour- Parameters:
nodeRef- the node referencebefore- the before values of the propertiesafter- the after values of the properties
-
getStoreFreeSpace
public long getStoreFreeSpace()Description copied from interface:ContentServiceGets the remaing available space in the underlying content store.- Specified by:
getStoreFreeSpacein interfaceContentService- Returns:
- Returns the total, possibly approximate, remaining space (in bytes) available to store content or -1 if no size data is available.
-
getStoreTotalSpace
public long getStoreTotalSpace()Description copied from interface:ContentServiceGets the total space of the underlying content store (not exclusively Alfresco-controlled binaries).- Specified by:
getStoreTotalSpacein interfaceContentService- Returns:
- Returns the total, possibly approximate, size (in bytes) of of the store or -1 if no size data is available.
-
getRawReader
Fetch content from the low-level stores using a content URL. None of the metadata associated with the content will be populated. This method should be used only to stream the binary data out when no other metadata is required.null is never returned, but the reader should always be checked for
existence.- Specified by:
getRawReaderin interfaceContentService- Parameters:
contentUrl- a content store URL- Returns:
- Returns a reader for the URL that needs to be checked.
-
getReader
Description copied from interface:ContentServiceGets a reader for the content associated with the given node property.If a content URL is present for the given node then a reader must be returned. The
existsmethod should then be used to detect 'missing' content.- Specified by:
getReaderin interfaceContentService- Parameters:
nodeRef- a reference to a node having a content propertypropertyQName- the name of the property, which must be of type content- Returns:
- Returns a reader for the content associated with the node property, or null if no content has been written for the property
- See Also:
-
getWriter
Description copied from interface:ContentServiceGet a content writer for the given node property, choosing to optionally have the node property updated automatically when the content stream closes.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.- Specified by:
getWriterin interfaceContentService- Parameters:
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.- Returns:
- Returns a writer for the content associated with the node property
-
getTempWriter
Description copied from interface:ContentServiceGets a writer to a temporary location. The longevity of the stored temporary content is determined by the system.- Specified by:
getTempWriterin interfaceContentService- Returns:
- Returns a writer to an anonymous location
-
getDirectAccessUrl
Description copied from interface:ContentServiceGets a presigned URL to directly access a binary content. It is up to the content store if it can fulfil this request with an expiry time (in milliseconds) or not.- Specified by:
getDirectAccessUrlin interfaceContentService- Parameters:
nodeRef- a reference to a node having a content propertyexpiresAt- an optional expiry date, so the direct access url would become invalid when the expiry date is reached- Returns:
- A direct access URL object for a binary content or returns null if not supported
-