org.crosswire.jsword.book.sword.state
Class RawBackendState

java.lang.Object
  extended by org.crosswire.jsword.book.sword.state.AbstractOpenFileState
      extended by org.crosswire.jsword.book.sword.state.RawBackendState
All Implemented Interfaces:
Closeable, OpenFileState
Direct Known Subclasses:
RawFileBackendState

public class RawBackendState
extends AbstractOpenFileState

Stores the random access files required for processing the passage request The caller is required to close to correctly free resources and avoid File pointer leaks

Author:
DM Smith
See Also:
The GNU Lesser General Public License for details.

Field Summary
private  SwordBookMetaData bookMetaData
           
private static org.slf4j.Logger log
          The log stream
protected  File ntIdxFile
           
protected  RandomAccessFile ntIdxRaf
           
protected  File ntTextFile
           
protected  RandomAccessFile ntTextRaf
           
protected  File otIdxFile
           
protected  RandomAccessFile otIdxRaf
           
protected  File otTextFile
           
protected  RandomAccessFile otTextRaf
           
 
Constructor Summary
RawBackendState(SwordBookMetaData bookMetaData)
          This is default package access for forcing the use of the OpenFileStateManager to manage the creation.
 
Method Summary
 SwordBookMetaData getBookMetaData()
           
 File getIdxFile(Testament testament)
          Get the index file for the given testament.
 RandomAccessFile getIdxRaf(Testament testament)
          Get the index file for the given testament.
 RandomAccessFile getNtTextRaf()
           
 RandomAccessFile getOtTextRaf()
           
 File getTextFile(Testament testament)
          Get the text file for the given testament.
 RandomAccessFile getTextRaf(Testament testament)
          Get the text file for the given testament.
 boolean isWritable()
           
 void releaseResources()
           
 
Methods inherited from class org.crosswire.jsword.book.sword.state.AbstractOpenFileState
close, getLastAccess, setLastAccess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

otIdxRaf

protected RandomAccessFile otIdxRaf

ntIdxRaf

protected RandomAccessFile ntIdxRaf

otTextRaf

protected RandomAccessFile otTextRaf

ntTextRaf

protected RandomAccessFile ntTextRaf

ntIdxFile

protected File ntIdxFile

ntTextFile

protected File ntTextFile

otIdxFile

protected File otIdxFile

otTextFile

protected File otTextFile

bookMetaData

private SwordBookMetaData bookMetaData

log

private static final org.slf4j.Logger log
The log stream

Constructor Detail

RawBackendState

RawBackendState(SwordBookMetaData bookMetaData)
          throws BookException
This is default package access for forcing the use of the OpenFileStateManager to manage the creation. Not doing so may result in new instances of OpenFileState being created for no reason, and as a result, if they are released to the OpenFileStateManager by mistake this would result in leakage.

Parameters:
bookMetaData - the appropriate metadata for the book
Throws:
BookException
Method Detail

isWritable

public boolean isWritable()

releaseResources

public void releaseResources()

getIdxRaf

public RandomAccessFile getIdxRaf(Testament testament)
Get the index file for the given testament.

Parameters:
testament - the testament for the file
Returns:
the requested file for the testament

getTextRaf

public RandomAccessFile getTextRaf(Testament testament)
Get the text file for the given testament.

Parameters:
testament - the testament for the file
Returns:
the requested file for the testament

getOtTextRaf

public RandomAccessFile getOtTextRaf()
Returns:
the otTextRaf

getNtTextRaf

public RandomAccessFile getNtTextRaf()
Returns:
the ntTextRaf

getTextFile

public File getTextFile(Testament testament)
Get the text file for the given testament.

Parameters:
testament - the testament for the file
Returns:
the requested file for the testament

getIdxFile

public File getIdxFile(Testament testament)
Get the index file for the given testament.

Parameters:
testament - the testament for the file
Returns:
the requested file for the testament

getBookMetaData

public SwordBookMetaData getBookMetaData()
Returns:
the bookMetaData

Copyright ยจ 2003-2015