Package org.alfresco.repo.content
Class AbstractContentAccessor
- java.lang.Object
-
- org.alfresco.repo.content.AbstractContentAccessor
-
- All Implemented Interfaces:
org.alfresco.service.cmr.repository.ContentAccessor
- Direct Known Subclasses:
AbstractContentReader,AbstractContentWriter
public abstract class AbstractContentAccessor extends java.lang.Object implements org.alfresco.service.cmr.repository.ContentAccessorProvides 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(java.lang.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 java.nio.channels.FileChannelgetCallbackFileChannel(java.nio.channels.FileChannel directChannel, java.util.List<org.alfresco.service.cmr.repository.ContentStreamListener> listeners)Generate a callback instance of theFileChannel.org.alfresco.service.cmr.repository.ContentDatagetContentData()java.lang.StringgetContentUrl()java.lang.StringgetEncoding()java.util.LocalegetLocale()java.lang.StringgetMimetype()protected voidsetContentUrl(java.lang.String contentUrl)Allow derived implementations to set the Content URL.voidsetEncoding(java.lang.String encoding)voidsetLocale(java.util.Locale locale)voidsetMimetype(java.lang.String mimetype)java.lang.StringtoString()
-
-
-
Method Detail
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getContentData
public org.alfresco.service.cmr.repository.ContentData getContentData()
- Specified by:
getContentDatain interfaceorg.alfresco.service.cmr.repository.ContentAccessor
-
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 java.lang.String getContentUrl()
- Specified by:
getContentUrlin interfaceorg.alfresco.service.cmr.repository.ContentAccessor
-
setContentUrl
protected void setContentUrl(java.lang.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 java.lang.String getMimetype()
- Specified by:
getMimetypein interfaceorg.alfresco.service.cmr.repository.ContentAccessor
-
setMimetype
public void setMimetype(java.lang.String mimetype)
- Specified by:
setMimetypein interfaceorg.alfresco.service.cmr.repository.ContentAccessor- Parameters:
mimetype- the underlying content's mimetype - null if unknown
-
getEncoding
public java.lang.String getEncoding()
- Specified by:
getEncodingin interfaceorg.alfresco.service.cmr.repository.ContentAccessor- Returns:
- Returns the content encoding - null if unknown
-
setEncoding
public void setEncoding(java.lang.String encoding)
- Specified by:
setEncodingin interfaceorg.alfresco.service.cmr.repository.ContentAccessor- Parameters:
encoding- the underlying content's encoding - null if unknown
-
getLocale
public java.util.Locale getLocale()
- Specified by:
getLocalein interfaceorg.alfresco.service.cmr.repository.ContentAccessor- Returns:
- Returns the content locale or null if unkown
-
setLocale
public void setLocale(java.util.Locale locale)
- Specified by:
setLocalein interfaceorg.alfresco.service.cmr.repository.ContentAccessor- Parameters:
locale- the content's locale, if known.
-
getCallbackFileChannel
protected java.nio.channels.FileChannel getCallbackFileChannel(java.nio.channels.FileChannel directChannel, java.util.List<org.alfresco.service.cmr.repository.ContentStreamListener> listeners) throws org.alfresco.service.cmr.repository.ContentIOExceptionGenerate 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:
org.alfresco.service.cmr.repository.ContentIOException
-
-