org.alfresco.repo.content
Class AbstractContentAccessor

java.lang.Object
  extended by 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.ContentAccessor

Provides basic support for content accessors.


Nested Class Summary
protected  class AbstractContentAccessor.CallbackFileChannel
          Wraps a FileChannel to provide callbacks to listeners when the channel is closed.
protected  class AbstractContentAccessor.ChannelCloseCallbackAdvise
          Advise that listens for the completion of specific methods on the ByteChannel interface.
 
Constructor Summary
protected AbstractContentAccessor(java.lang.String contentUrl)
           
 
Method Summary
protected  void channelOpened()
          Derived classes can call this method to ensure that necessary trace logging is performed when the IO Channel is opened.
protected  void finalize()
           
protected  java.nio.channels.FileChannel getCallbackFileChannel(java.nio.channels.FileChannel directChannel, java.util.List listeners)
          Generate a callback instance of the FileChannel.
 org.alfresco.service.cmr.repository.ContentData getContentData()
           
 java.lang.String getContentUrl()
           
 java.lang.String getEncoding()
           
 java.util.Locale getLocale()
           
 java.lang.String getMimetype()
           
protected  void setContentUrl(java.lang.String contentUrl)
          Allow derived implementations to set the Content URL.
 void setEncoding(java.lang.String encoding)
           
 void setLocale(java.util.Locale locale)
           
 void setMimetype(java.lang.String mimetype)
           
 java.lang.String toString()
           
 
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(java.lang.String contentUrl)
Parameters:
contentUrl - the content URL
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getContentData

public org.alfresco.service.cmr.repository.ContentData getContentData()
Specified by:
getContentData in interface org.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:
getContentUrl in interface org.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:
getMimetype in interface org.alfresco.service.cmr.repository.ContentAccessor

setMimetype

public void setMimetype(java.lang.String mimetype)
Specified by:
setMimetype in interface org.alfresco.service.cmr.repository.ContentAccessor
Parameters:
mimetype - the underlying content's mimetype - null if unknown

getEncoding

public java.lang.String getEncoding()
Specified by:
getEncoding in interface org.alfresco.service.cmr.repository.ContentAccessor
Returns:
Returns the content encoding - null if unknown

setEncoding

public void setEncoding(java.lang.String encoding)
Specified by:
setEncoding in interface org.alfresco.service.cmr.repository.ContentAccessor
Parameters:
encoding - the underlying content's encoding - null if unknown

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface org.alfresco.service.cmr.repository.ContentAccessor
Returns:
Returns the content locale or null if unkown

setLocale

public void setLocale(java.util.Locale locale)
Specified by:
setLocale in interface org.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 listeners)
                                                        throws org.alfresco.service.cmr.repository.ContentIOException
Generate a callback instance of the FileChannel.

Parameters:
directChannel - the delegate that to perform the actual operations
listeners - 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


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.