org.alfresco.repo.content
Class AbstractContentReaderLimitTest.DummyAbstractContentReader

java.lang.Object
  extended by org.alfresco.repo.content.AbstractContentAccessor
      extended by org.alfresco.repo.content.AbstractContentReader
          extended by org.alfresco.repo.content.AbstractContentReaderLimitTest.DummyAbstractContentReader
All Implemented Interfaces:
org.alfresco.service.cmr.repository.ContentAccessor, org.alfresco.service.cmr.repository.ContentReader
Enclosing class:
AbstractContentReaderLimitTest

public static class AbstractContentReaderLimitTest.DummyAbstractContentReader
extends AbstractContentReader

A dummy AbstractContentReader that returns a given number of bytes (all 'a') very slowly. There is a configurable delay returning each byte. Used to test timeouts and read limits.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.alfresco.repo.content.AbstractContentAccessor
AbstractContentAccessor.CallbackFileChannel, AbstractContentAccessor.ChannelCloseCallbackAdvise
 
Constructor Summary
AbstractContentReaderLimitTest.DummyAbstractContentReader(long size, long msPerByte)
           
 
Method Summary
protected  org.alfresco.service.cmr.repository.ContentReader createReader()
          A factory method for subclasses to implement that will ensure the proper implementation of the ContentReader.getReader() method.
 boolean exists()
           
protected  java.nio.channels.ReadableByteChannel getDirectReadableChannel()
          Provides low-level access to read content from the repository.
 long getLastModified()
           
 long getSize()
           
 
Methods inherited from class org.alfresco.repo.content.AbstractContentReader
addListener, compareContentReaders, getContent, getContent, getContentInputStream, getContentString, getContentString, getFileChannel, getLimits, getReadableChannel, getReader, getTransformerDebug, getUseBufferedInputStream, isChannelOpen, isClosed, setLimits, setTransformerDebug, setUseBufferedInputStream
 
Methods inherited from class org.alfresco.repo.content.AbstractContentAccessor
channelOpened, finalize, getCallbackFileChannel, getContentData, getContentUrl, getEncoding, getLocale, getMimetype, setContentUrl, setEncoding, setLocale, setMimetype, 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
getContentData, getContentUrl, getEncoding, getLocale, getMimetype, setEncoding, setLocale, setMimetype
 

Constructor Detail

AbstractContentReaderLimitTest.DummyAbstractContentReader

public AbstractContentReaderLimitTest.DummyAbstractContentReader(long size,
                                                                 long msPerByte)
Parameters:
size - of the dummy data
msPerByte - milliseconds between byte reads
Method Detail

createReader

protected org.alfresco.service.cmr.repository.ContentReader createReader()
                                                                  throws org.alfresco.service.cmr.repository.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 an instance of the this class
Throws:
org.alfresco.service.cmr.repository.ContentIOException

getDirectReadableChannel

protected java.nio.channels.ReadableByteChannel getDirectReadableChannel()
                                                                  throws org.alfresco.service.cmr.repository.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:
org.alfresco.service.cmr.repository.ContentIOException - if the channel could not be opened or the underlying content has disappeared

exists

public boolean exists()

getLastModified

public long getLastModified()

getSize

public long getSize()


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