org.crosswire.jsword.bridge
Class DwrBridge

java.lang.Object
  extended by org.crosswire.jsword.bridge.DwrBridge

public class DwrBridge
extends Object

The DWR DwrBridge adapts JSword to DWR. This is based upon APIExamples.

Author:
DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details.
The copyright to this program is held by it's authors.

Constructor Summary
DwrBridge()
           
 
Method Summary
private  BookData getBookData(String bookInitials, String reference, int start, int count)
          Get BookData representing one or more Book entries, but capped to a maximum number of entries.
 int getCardinality(String bookInitials, String reference)
          Determine the size of this reference.
 String[][] getInstalledBooks(String filter)
          Get a listing of all the available books.
private  SAXEventProvider getOSISProvider(String bookInitials, String reference, int start, int count)
          Obtain a SAX event provider for the OSIS document representation of one or more book entries.
 String getOSISString(String bookInitials, String reference, int start, int count)
          Obtain the OSIS representation from a book for a reference, pruning a reference to a limited number of keys.
 String[] getSwordPath()
          For the sake of diagnostics, return the locations that JSword will look for books.
private  boolean isIndexed(Book book)
          Determine whether the book can be searched, that is, whether the book is indexed.
 boolean isIndexed(String bookInitials)
          Determine whether the named book can be searched, that is, whether the book is indexed.
 String[] match(String bookInitials, String searchRequest, int maxMatchCount)
          Get close matches for a target in a book whose keys have a meaningful sort.
 String search(String bookInitials, String searchRequest)
          Get a reference list for a search result against a book.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DwrBridge

public DwrBridge()
Method Detail

getInstalledBooks

public String[][] getInstalledBooks(String filter)
Get a listing of all the available books.

Parameters:
filter - The custom filter specification string
Returns:
a list of (initial, name) string pairs
See Also:
BookInstaller.getInstalledBook(String)

isIndexed

public boolean isIndexed(String bookInitials)
Determine whether the named book can be searched, that is, whether the book is indexed.

Parameters:
bookInitials - the named book to check.
Returns:
true if searching can be performed

getCardinality

public int getCardinality(String bookInitials,
                          String reference)
                   throws NoSuchKeyException
Determine the size of this reference.

Parameters:
bookInitials - the book to which the reference applies.
reference - the actual reference
Returns:
the number of entries for this reference.
Throws:
NoSuchKeyException

getOSISString

public String getOSISString(String bookInitials,
                            String reference,
                            int start,
                            int count)
                     throws BookException,
                            NoSuchKeyException
Obtain the OSIS representation from a book for a reference, pruning a reference to a limited number of keys.

Parameters:
bookInitials - the book to use
reference - a reference, appropriate for the book, for one or more keys
Throws:
BookException
NoSuchKeyException

search

public String search(String bookInitials,
                     String searchRequest)
              throws BookException
Get a reference list for a search result against a book.

Parameters:
bookInitials -
searchRequest -
Returns:
The reference for the matching.
Throws:
BookException

match

public String[] match(String bookInitials,
                      String searchRequest,
                      int maxMatchCount)
Get close matches for a target in a book whose keys have a meaningful sort. This is not true of keys that are numeric or contain numbers. (unless the numbers are 0 filled.)


getSwordPath

public String[] getSwordPath()
For the sake of diagnostics, return the locations that JSword will look for books.

Returns:
the SWORD path

isIndexed

private boolean isIndexed(Book book)
Determine whether the book can be searched, that is, whether the book is indexed.

Parameters:
book - the book to check.
Returns:
true if searching can be performed

getBookData

private BookData getBookData(String bookInitials,
                             String reference,
                             int start,
                             int count)
                      throws NoSuchKeyException
Get BookData representing one or more Book entries, but capped to a maximum number of entries.

Parameters:
bookInitials - the book to use
reference - a reference, appropriate for the book, of one or more entries
start - the starting point where 0 is the first.
count - the maximum number of entries to use
Throws:
NoSuchKeyException

getOSISProvider

private SAXEventProvider getOSISProvider(String bookInitials,
                                         String reference,
                                         int start,
                                         int count)
                                  throws BookException,
                                         NoSuchKeyException
Obtain a SAX event provider for the OSIS document representation of one or more book entries.

Parameters:
bookInitials - the book to use
reference - a reference, appropriate for the book, of one or more entries
Throws:
BookException
NoSuchKeyException

Copyright ยจ 2003-2007