Class 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.
    Author:
    Derek Hulley
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractContentAccessor​(java.lang.String contentUrl)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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<org.alfresco.service.cmr.repository.ContentStreamListener> 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<org.alfresco.service.cmr.repository.ContentStreamListener> 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