org.alfresco.repo.content.http
Class HttpAlfrescoContentReader

java.lang.Object
  extended by org.alfresco.repo.content.AbstractContentAccessor
      extended by org.alfresco.repo.content.AbstractContentReader
          extended by org.alfresco.repo.content.http.HttpAlfrescoContentReader
All Implemented Interfaces:
ContentAccessor, ContentReader

public class HttpAlfrescoContentReader
extends AbstractContentReader

The reader that does the actual communication with the Alfresco HTTP application.

Since:
2.1
See Also:
HttpAlfrescoStore

Nested Class Summary
 
Nested classes/interfaces inherited from class org.alfresco.repo.content.AbstractContentAccessor
AbstractContentAccessor.CallbackFileChannel, AbstractContentAccessor.ChannelCloseCallbackAdvise
 
Constructor Summary
HttpAlfrescoContentReader(TransactionService transactionService, AuthenticationService authenticationService, java.lang.String baseHttpUrl, java.lang.String contentUrl)
           
 
Method Summary
protected  ContentReader createReader()
          A factory method for subclasses to implement that will ensure the proper implementation of the ContentReader.getReader() method.
 boolean exists()
          Check if the underlying content is present.
static java.lang.String generateURL(java.lang.String baseHttpUrl, java.lang.String contentUrl, java.lang.String ticket, boolean infoOnly)
          Helper to generate a URL based on the ContentStore URL and ticket.
protected  java.nio.channels.ReadableByteChannel getDirectReadableChannel()
          Provides low-level access to read content from the repository.
 long getLastModified()
          Gets the time of the last modification of the underlying content.
 long getSize()
          Gets the size of the content that this reader references.
 java.lang.String toString()
           
 
Methods inherited from class org.alfresco.repo.content.AbstractContentReader
addListener, compareContentReaders, getContent, getContent, getContentInputStream, getContentString, getContentString, getFileChannel, getReadableChannel, getReader, isChannelOpen, isClosed
 
Methods inherited from class org.alfresco.repo.content.AbstractContentAccessor
channelOpened, finalize, getCallbackFileChannel, getContentData, getContentUrl, getEncoding, getLocale, getMimetype, setContentUrl, setEncoding, setLocale, setMimetype, setRetryingTransactionHelper
 
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
getContentData, getContentUrl, getEncoding, getLocale, getMimetype, setEncoding, setLocale, setMimetype, setRetryingTransactionHelper
 

Constructor Detail

HttpAlfrescoContentReader

public HttpAlfrescoContentReader(TransactionService transactionService,
                                 AuthenticationService authenticationService,
                                 java.lang.String baseHttpUrl,
                                 java.lang.String contentUrl)
Method Detail

toString

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

exists

public boolean exists()
Description copied from interface: ContentReader
Check if the underlying content is present.

Returns:
Returns true if there is content at the URL refered to by this reader

getLastModified

public long getLastModified()
Description copied from interface: ContentReader
Gets the time of the last modification of the underlying content.

Returns:
Returns the last modification time using the standard long time, or 0L if the content doesn't exist.
See Also:
System.currentTimeMillis()

getSize

public long getSize()
Description copied from interface: ContentAccessor
Gets the size of the content that this reader references.

Returns:
Returns the document byte length, or OL if the content doesn't exist.

createReader

protected ContentReader createReader()
                              throws ContentIOException
Description copied from class: AbstractContentReader
A factory method for subclasses to implement that will ensure the proper implementation of the ContentReader.getReader() method.

Only the instance need be constructed. The required mimetype, encoding, etc will be copied across by this class.

Specified by:
createReader in class AbstractContentReader
Returns:
Returns a reader onto the location referenced by this instance. The instance must always be a new instance.
Throws:
ContentIOException

getDirectReadableChannel

protected java.nio.channels.ReadableByteChannel getDirectReadableChannel()
                                                                  throws ContentIOException
Description copied from class: AbstractContentReader
Provides low-level access to read content from the repository.

This is the only of the content reading methods that needs to be implemented by derived classes. All other content access methods make use of this in their underlying implementations.

Specified by:
getDirectReadableChannel in class AbstractContentReader
Returns:
Returns a channel from which content can be read
Throws:
ContentIOException - if the channel could not be opened or the underlying content has disappeared

generateURL

public static final java.lang.String generateURL(java.lang.String baseHttpUrl,
                                                 java.lang.String contentUrl,
                                                 java.lang.String ticket,
                                                 boolean infoOnly)
Helper to generate a URL based on the ContentStore URL and ticket.

Parameters:
baseHttpUrl - the first part of the URL pointing to the Alfresoc Web Application
contentUrl - the content URL - never null
ticket - the authentication ticket
infoOnly - true to add the info-only flag
Returns:
Returns the URL with which to access the servlet


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