com.raritantechnologies.searchApp.browse
Class Browse

java.lang.Object
  extended bycom.raritantechnologies.searchApp.browse.Browse
All Implemented Interfaces:
IBrowse, IConfigurable
Direct Known Subclasses:
InMemoryBrowse

public class Browse
extends java.lang.Object
implements IBrowse

Basic File system-based Browse list implementation - uses BrowseDirectoryEntry.

XML Configuration Template:
   <Browse class="com.raritantechnologies.searchApp.browse.Browse"
              field="[ name of Browse field ]"
              directory="[ name of Browse Directory ]" />
 

Developed by Raritan Technologies .

Author:
Kepler Gelotte

Field Summary
protected  IBrowseDirectoryEntry bde
           
protected  java.util.ArrayList cachedPages
           
 
Constructor Summary
Browse()
           
 
Method Summary
protected  int addPageToCache(int page, int index)
          Adds a "page" worth of filtered data and returns the actual count of rows added to the cache
static java.lang.String getBrowseDirectory()
          returns the browse directory.
 java.util.ArrayList getCurrentPage(java.lang.String sessionID)
          returns the current page worth of data
 java.util.ArrayList getFirstPage(java.lang.String sessionID, java.lang.String term)
          returns a page worth of data as ArrayList of Browse.Line entries.
 java.util.ArrayList getFirstPage(java.lang.String sessionID, java.lang.String term, java.lang.String missingTemplate)
           
 java.util.ArrayList getNextPage(java.lang.String sessionID)
          returns the next page worth of data relative to the last
 java.util.ArrayList getPrevPage(java.lang.String sessionID)
          returns the previous page worth of data relative to the last
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void initialize(java.lang.String field)
          Use this method to create a browse instance for a single field.
 boolean isFirstPage(java.lang.String sessionID)
          Indicates whether we're on the first page or not
 boolean isLastPage(java.lang.String sessionID)
          Indicates whether we're on the last page or not
static void setBrowseDirectory(java.lang.String dir)
          sets the browse directory.
 void setBrowseHitPosition(int pos)
          sets the page size for rendered results
 void setBrowsePageSize(int size)
          sets the page size for rendered results
 void setExcludes(java.util.List l)
          A list of exclusion comparator(s) to filter the browse lists
 void setIncludes(java.util.List l)
          A list of inclusion comparator(s) to filter the browse lists
 boolean wasTermFound(java.lang.String sessionID)
          indicates whether a match was found from getFirstPage( term )
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bde

protected IBrowseDirectoryEntry bde

cachedPages

protected java.util.ArrayList cachedPages
Constructor Detail

Browse

public Browse()
Method Detail

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IBrowse

initialize

public void initialize(java.lang.String field)
Use this method to create a browse instance for a single field. It will prime the static structures if they are not already in existance

Specified by:
initialize in interface IBrowse

setBrowsePageSize

public void setBrowsePageSize(int size)
sets the page size for rendered results

Specified by:
setBrowsePageSize in interface IBrowse

setBrowseHitPosition

public void setBrowseHitPosition(int pos)
sets the page size for rendered results

Specified by:
setBrowseHitPosition in interface IBrowse

getFirstPage

public java.util.ArrayList getFirstPage(java.lang.String sessionID,
                                        java.lang.String term)
returns a page worth of data as ArrayList of Browse.Line entries.

Specified by:
getFirstPage in interface IBrowse

getFirstPage

public java.util.ArrayList getFirstPage(java.lang.String sessionID,
                                        java.lang.String term,
                                        java.lang.String missingTemplate)
Specified by:
getFirstPage in interface IBrowse

getPrevPage

public java.util.ArrayList getPrevPage(java.lang.String sessionID)
returns the previous page worth of data relative to the last

Specified by:
getPrevPage in interface IBrowse

getNextPage

public java.util.ArrayList getNextPage(java.lang.String sessionID)
returns the next page worth of data relative to the last

Specified by:
getNextPage in interface IBrowse

getCurrentPage

public java.util.ArrayList getCurrentPage(java.lang.String sessionID)
Description copied from interface: IBrowse
returns the current page worth of data

Specified by:
getCurrentPage in interface IBrowse

wasTermFound

public boolean wasTermFound(java.lang.String sessionID)
Description copied from interface: IBrowse
indicates whether a match was found from getFirstPage( term )

Specified by:
wasTermFound in interface IBrowse

addPageToCache

protected int addPageToCache(int page,
                             int index)
Adds a "page" worth of filtered data and returns the actual count of rows added to the cache


setBrowseDirectory

public static void setBrowseDirectory(java.lang.String dir)
sets the browse directory.


getBrowseDirectory

public static java.lang.String getBrowseDirectory()
returns the browse directory.


isFirstPage

public boolean isFirstPage(java.lang.String sessionID)
Indicates whether we're on the first page or not

Specified by:
isFirstPage in interface IBrowse

isLastPage

public boolean isLastPage(java.lang.String sessionID)
Indicates whether we're on the last page or not

Specified by:
isLastPage in interface IBrowse

setExcludes

public void setExcludes(java.util.List l)
A list of exclusion comparator(s) to filter the browse lists

Specified by:
setExcludes in interface IBrowse

setIncludes

public void setIncludes(java.util.List l)
A list of inclusion comparator(s) to filter the browse lists

Specified by:
setIncludes in interface IBrowse