Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.book.sword
Class RawBackend

    java.lang.Object
      org.crosswire.jsword.book.sword.Backend
          org.crosswire.jsword.book.sword.RawBackend

All Implemented Interfaces:
  Activatable

    public class RawBackend

extends Backend

Both Books and Commentaries seem to use the same format so this class abstracts out the similarities.

Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors.

Version:
  $Id: RawBackend.java,v 1.22 2005/03/06 20:21:47 dmsmith Exp $
Author:
  Joe Walker [joe at eireneh dot com]
See Also:
  `Licence`

Field Summary
`private boolean` | `active` Are we active
`private static int` | `ENTRY_SIZE` How many bytes in an index?
`private File[]` | `idxFile` The array of index random access files
`private RandomAccessFile[]` | `idxRaf` The array of index files
`private static Logger` | `log` The log stream
`private File[]` | `txtFile` The array of data random access files
`private RandomAccessFile[]` | `txtRaf` The array of data files

Constructor Summary
`RawBackend(SwordBookMetaData sbmd, File rootPath)` Simple ctor

Method Summary
`void` | `activate(Lock lock)` Called to indicate that the Book should initialize itself, and consume whatever system resources it needs to be able to respond to other queries.
`protected void` | `checkActive()` Helper method so we can quickly activate ourselves on access
`void` | `deactivate(Lock lock)` Called to indicate that the Book should release whatever system resources it can to make way for other uses.
`String` | `getRawText(Key key)` Get the bytes alotted for the given verse
`boolean` | `isSupported()` Returns whether this Backend is implemented.
`Key` | `readIndex()` Initialise a Backend before use.

Methods inherited from class org.crosswire.jsword.book.sword.Backend
`decipher, getBookMetaData, getRootPath`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### active

    private boolean active

  Are we active

### log

    private static final Logger log

  The log stream

### idxRaf

    private RandomAccessFile[] idxRaf

  The array of index files

### txtRaf

    private RandomAccessFile[] txtRaf

  The array of data files

### idxFile

    private File[] idxFile

  The array of index random access files

### txtFile

    private File[] txtFile

  The array of data random access files

### ENTRY_SIZE

    private static final int ENTRY_SIZE

  How many bytes in an index?

  See Also:
    Constant Field Values

Constructor Detail

### RawBackend

    public RawBackend(SwordBookMetaData sbmd,
                      File rootPath)
               throws BookException

  Simple ctor

  Throws:
    `BookException`

Method Detail

### activate

    public final void activate(Lock lock)

  Description copied from interface: `Activatable`
  Called to indicate that the Book should initialize itself, and consume whatever system resources it needs to be able to respond to other queries.

  Parameters:
    `lock` - An attempt to ensure that only the Activator calls this method

### deactivate

    public final void deactivate(Lock lock)

  Description copied from interface: `Activatable`
  Called to indicate that the Book should release whatever system resources it can to make way for other uses.

  Parameters:
    `lock` - An attempt to ensure that only the Activator calls this method

### getRawText

    public String getRawText(Key key)
                      throws BookException

  Description copied from class: `Backend`
  Get the bytes alotted for the given verse

  Specified by:
    `getRawText` in class `Backend`
  Parameters:
    `key` - The key to fetch
  Returns:
    String The data for the verse in question
  Throws:
    `BookException` - If the data can not be read.

### readIndex

    public Key readIndex()

  Description copied from class: `Backend`
  Initialise a Backend before use. This method needs to call addKey() a number of times on SwordDictionary

  Specified by:
    `readIndex` in class `Backend`

### isSupported

    public boolean isSupported()

  Description copied from class: `Backend`
  Returns whether this Backend is implemented.

  Specified by:
    `isSupported` in class `Backend`
  Returns:
    true if this Backend is implemented.

### checkActive

    protected final void checkActive()

  Helper method so we can quickly activate ourselves on access

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ? 2003-2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD