Package org.alfresco.repo.content
Class AbstractContentAccessor
java.lang.Object
org.alfresco.repo.content.AbstractContentAccessor
- All Implemented Interfaces:
ContentAccessor
- Direct Known Subclasses:
AbstractContentReader,AbstractContentWriter
Provides basic support for content accessors.
- Author:
- Derek Hulley
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classWraps aFileChannelto provide callbacks to listeners when the channel isclosed.protected classAdvise that listens for the completion of specific methods on theByteChannelinterface. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidDerived classes can call this method to ensure that necessary trace logging is performed when the IO Channel is opened.protected voidfinalize()protected FileChannelgetCallbackFileChannel(FileChannel directChannel, List<ContentStreamListener> listeners) Generate a callback instance of theFileChannel.protected voidsetContentUrl(String contentUrl) Allow derived implementations to set the Content URL.voidsetEncoding(String encoding) voidvoidsetMimetype(String mimetype) toString()Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.alfresco.service.cmr.repository.ContentAccessor
addListener, getSize, isChannelOpen
-
Constructor Details
-
AbstractContentAccessor
- Parameters:
contentUrl- the content URL
-
-
Method Details
-
finalize
-
toString
-
getContentData
- Specified by:
getContentDatain interfaceContentAccessor
-
channelOpened
protected final void channelOpened()Derived classes can call this method to ensure that necessary trace logging is performed when the IO Channel is opened. -
getContentUrl
- Specified by:
getContentUrlin interfaceContentAccessor
-
setContentUrl
Allow derived implementations to set the Content URL. This allows for implementations where the URL is not known when the accessor is first constructed.- Parameters:
contentUrl- the new content URL
-
getMimetype
- Specified by:
getMimetypein interfaceContentAccessor
-
setMimetype
- Specified by:
setMimetypein interfaceContentAccessor- Parameters:
mimetype- the underlying content's mimetype - null if unknown
-
getEncoding
- Specified by:
getEncodingin interfaceContentAccessor- Returns:
- Returns the content encoding - null if unknown
-
setEncoding
- Specified by:
setEncodingin interfaceContentAccessor- Parameters:
encoding- the underlying content's encoding - null if unknown
-
getLocale
- Specified by:
getLocalein interfaceContentAccessor- Returns:
- Returns the content locale or null if unkown
-
setLocale
- Specified by:
setLocalein interfaceContentAccessor- Parameters:
locale- the content's locale, if known.
-
getCallbackFileChannel
protected FileChannel getCallbackFileChannel(FileChannel directChannel, List<ContentStreamListener> listeners) throws ContentIOException Generate a callback instance of theFileChannel.- Parameters:
directChannel- the delegate that to perform the actual operationslisteners- the listeners to call- Returns:
- Returns a new channel that functions just like the original, except that it issues callbacks to the listeners
- Throws:
ContentIOException
-