Package org.alfresco.repo.content
Class AbstractContentAccessor
- java.lang.Object
-
- org.alfresco.repo.content.AbstractContentAccessor
-
- All Implemented Interfaces:
ContentAccessor
- Direct Known Subclasses:
AbstractContentReader,AbstractContentWriter
public abstract class AbstractContentAccessor extends Object implements ContentAccessor
Provides basic support for content accessors.- Author:
- Derek Hulley
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractContentAccessor.CallbackFileChannelWraps aFileChannelto provide callbacks to listeners when the channel isclosed.protected classAbstractContentAccessor.ChannelCloseCallbackAdviseAdvise that listens for the completion of specific methods on theByteChannelinterface.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractContentAccessor(String contentUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidchannelOpened()Derived 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.ContentDatagetContentData()StringgetContentUrl()StringgetEncoding()LocalegetLocale()StringgetMimetype()protected voidsetContentUrl(String contentUrl)Allow derived implementations to set the Content URL.voidsetEncoding(String encoding)voidsetLocale(Locale locale)voidsetMimetype(String mimetype)StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.alfresco.service.cmr.repository.ContentAccessor
addListener, getSize, isChannelOpen
-
-
-
-
Constructor Detail
-
AbstractContentAccessor
protected AbstractContentAccessor(String contentUrl)
- Parameters:
contentUrl- the content URL
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
getContentData
public ContentData 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
public String getContentUrl()
- Specified by:
getContentUrlin interfaceContentAccessor
-
setContentUrl
protected void setContentUrl(String contentUrl)
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
public String getMimetype()
- Specified by:
getMimetypein interfaceContentAccessor
-
setMimetype
public void setMimetype(String mimetype)
- Specified by:
setMimetypein interfaceContentAccessor- Parameters:
mimetype- the underlying content's mimetype - null if unknown
-
getEncoding
public String getEncoding()
- Specified by:
getEncodingin interfaceContentAccessor- Returns:
- Returns the content encoding - null if unknown
-
setEncoding
public void setEncoding(String encoding)
- Specified by:
setEncodingin interfaceContentAccessor- Parameters:
encoding- the underlying content's encoding - null if unknown
-
getLocale
public Locale getLocale()
- Specified by:
getLocalein interfaceContentAccessor- Returns:
- Returns the content locale or null if unkown
-
setLocale
public void setLocale(Locale locale)
- 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
-
-