Open SiteSearch 4.1.1
Final

ORG.oclc.db
Class DbNewton

java.lang.Object
  |
  +--ORG.oclc.db.Db
        |
        +--ORG.oclc.db.DbNewton

public class DbNewton
extends Db

DbNewton searches a local Newton database.

See Also:
DbNewtonUserData

Field Summary
 ORG.oclc.Newton.db.NewtonDatabase newtonDb
          The NewtonDatabase object.
 
Fields inherited from class ORG.oclc.db.Db
CLOSED, dbNames, dbVersion, dumpConfigInfo, globals, modeNames, OPEN, opsClient, parents, sortMap, UPDATE, users, WAITINGTOCLOSE
 
Method Summary
 void accessAllowed(Object dbUserData)
           
 void accessControl(Object accessControlResponse, Object dbUserData)
          Process the information from an AccessControl response to set user specific authorization information.
 TermInfo[] browse(String query, int preferredPosition, int numTerms, DataDir Z39attributes, DataDir resultSetAttributes, int stepSize, Object userData)
          Perform a browse.
protected  Key[] buildSortKeys(String hitlist, String[] keys, int[] order, Object dedupCriteria, Object userData)
          Return sort keys for the records in the hitlist.
 void close()
          close this Db.
 void closewhenidle()
           
 void connect(Object userInformation, Object dbUserData)
          Create a connection to this Db for a user.
 void deleteHitlist(String hitlist, Object userData)
          Delete the specified hitlist.
 void disconnect(Object userData)
          Destroy a connection to this Db for a user.
 ExtSvcData extsvc(ExtSvcData esData, ExtSvcHandler esHandler, Object dbUserData)
          Processes an Extended Services Request for the input task package and returns a response task package DataDir object.
 void finalize()
          close the DbNewton before letting it garbage collect.
 TermComponentPostings[] getComponentResults(String hitlist, Object userData)
          Get the component postings for the specified hitlist.
 DbResults[] getDbResults(String hitlist, Object userData)
          Get the restrictor summaries for the specified hitlist.
 String getStats()
           
protected  boolean init(IniFile inifile, String which)
          Initialize this DbNewton object.
 Object initDbUserData(String sessionId, Object access, Log log, Object userDbMap)
          Creates a database User data object for searching the database - Each database has it's own unique DbUserData object.
 boolean OK()
          Check if the Db is open and ready for requests.
 int postings(String hitlist, Object userData)
          Get postings for a specified hitlist.
 DbPresentData[] present(String hitlist, int startPoint, int numRecs, String elementSetName, String syntax, Object userData)
          Get the specified records from the specified hitlist.
 boolean rolldatabase(IniFile inifile, String iniSection)
           
 int rolldatabaseusers()
           
 int search(String query, String hitlist, boolean replaceFlag, DataDir Z39attributesPlusTerm, boolean doRestrictorSummary, Object additionalSearchInfo, Object userData)
          Perform a search.
 void sort(String hitlist, String sortedList, String[] keys, int[] order, boolean fUseSortAttributes, boolean sortAccrossDbs, Object dupCriteria, Object userData)
          Sort the hitlist according to the keys.
protected  boolean supportsScan()
          Does this Db support scan requests?
protected  boolean supportsSort()
          Does this Db support sort requests?
 TermInfo toTermInfo(ORG.oclc.Newton.db.Term term)
          Convert a Term to a TermInfo.
protected  void unsort(String hitlist, Object userData)
          Unsort the hitlist.
 
Methods inherited from class ORG.oclc.db.Db
browse, dbnames, deleteHitlist, filterName, getDb, getDbNames, getDbs, getGlobals, getName, getOpenedFilesCount, getOutstandingCount, hasUsers, numUsers, openDb, openDbs, present, search, setOps, setSearchMode, SetupDatabase, SetupDatabase, sort, sort, updateOpenedFiles
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newtonDb

public ORG.oclc.Newton.db.NewtonDatabase newtonDb
The NewtonDatabase object.
Method Detail

init

protected boolean init(IniFile inifile,
                       String which)
                throws Exception
Initialize this DbNewton object.
Parameters:
inifile - for parameters
which - section name for inifile for this Db
Returns:
true if successful
Throws:
Exception - if the Db could not be initialized
Overrides:
init in class Db

close

public void close()
close this Db.
Overrides:
close in class Db

OK

public boolean OK()
Check if the Db is open and ready for requests.
Returns:
true
Overrides:
OK in class Db

present

public DbPresentData[] present(String hitlist,
                               int startPoint,
                               int numRecs,
                               String elementSetName,
                               String syntax,
                               Object userData)
                        throws IOException,
                               Diagnostic1
Get the specified records from the specified hitlist.
Parameters:
hitlist - result set name
startPoint - starts at 1
numRecs - to retrieve
elementSetName - view of record to retrieve
syntax - in which to return record
dbUserData - user data containing hitlists
Returns:
array of BerString records
Throws:
IOException - the database has problems
Diagnostic1 - if the request is not logically correct
Overrides:
present in class Db

postings

public int postings(String hitlist,
                    Object userData)
             throws Diagnostic1
Get postings for a specified hitlist.
Parameters:
hitlist - result set name
dbUserData - user data object containing hitlists
Returns:
postings
Throws:
Diagnostic1 - if the hitlist cannot be located
Overrides:
postings in class Db

search

public int search(String query,
                  String hitlist,
                  boolean replaceFlag,
                  DataDir Z39attributesPlusTerm,
                  boolean doRestrictorSummary,
                  Object additionalSearchInfo,
                  Object userData)
           throws IOException,
                  Diagnostic1
Perform a search.
Parameters:
query - type 0 query or null if this is not type 0
hitlist - result set name to create
replaceFlag - can this hitlist overwrite a previous one?
Z39attributesPlusTerm - non-type 0 query
doRestrictorSummary - flag to return a summary of records
dbUserData - user data containing hitlists
Returns:
postings count of search
Throws:
IOException - the database has problems
Diagnostic1 - if the request is not logically correct
Overrides:
search in class Db

deleteHitlist

public void deleteHitlist(String hitlist,
                          Object userData)
Delete the specified hitlist.
Parameters:
hitlist - the one to delete
dbUserData - user data containing hitlists
Overrides:
deleteHitlist in class Db

browse

public TermInfo[] browse(String query,
                         int preferredPosition,
                         int numTerms,
                         DataDir Z39attributes,
                         DataDir resultSetAttributes,
                         int stepSize,
                         Object userData)
                  throws Exception,
                         Diagnostic1
Perform a browse.
Parameters:
query - term??
preferredPosition - of the query term in the returned list
numTerms - to return
Z39attributesPlusTerm - term plus starting point attributes
resultSetAttributes - result set attributes if they are different from the starting point attributes
stepSize - number of terms between terms
dbUserData - user data containing hitlists
Returns:
array of TermInfo terms
Throws:
Exception - this was probably an I/O error or a coding error
Diagnostic1 - if the request is not logically correct
Overrides:
browse in class Db

getDbResults

public DbResults[] getDbResults(String hitlist,
                                Object userData)
Get the restrictor summaries for the specified hitlist.
Parameters:
hitlist - result set name
dbUserData - user data containing hitlists
Returns:
array of DbResults[] for this hitlist
Overrides:
getDbResults in class Db

getComponentResults

public TermComponentPostings[] getComponentResults(String hitlist,
                                                   Object userData)
Get the component postings for the specified hitlist.
Parameters:
hitlist - result set name
dbUserData - user data containing hitlists
Returns:
null - component postings not available
Overrides:
getComponentResults in class Db

getStats

public String getStats()
Returns:
String containing DbNewton status, number of users, database stats, and transaction counts.
Overrides:
getStats in class Db

supportsSort

protected boolean supportsSort()
Does this Db support sort requests?
Returns:
true
Overrides:
supportsSort in class Db

supportsScan

protected boolean supportsScan()
Does this Db support scan requests?
Returns:
true
Overrides:
supportsScan in class Db

finalize

public void finalize()
close the DbNewton before letting it garbage collect.
Overrides:
finalize in class Object

accessAllowed

public void accessAllowed(Object dbUserData)
                   throws AccessControl,
                          Diagnostic1
Overrides:
accessAllowed in class Db

initDbUserData

public Object initDbUserData(String sessionId,
                             Object access,
                             Log log,
                             Object userDbMap)
Creates a database User data object for searching the database - Each database has it's own unique DbUserData object.
Parameters:
sessionId - assigned by something else
access - the object containing access info to connect to an access server
log - the Log object for the user for tracing
Returns:
userDbMap Object containing all the user's database information objects.
Overrides:
initDbUserData in class Db

accessControl

public void accessControl(Object accessControlResponse,
                          Object dbUserData)
Process the information from an AccessControl response to set user specific authorization information.
Parameters:
accessControlResponse - object containing the access control response
dbUserData - user data containing hitlists
Overrides:
accessControl in class Db

connect

public void connect(Object userInformation,
                    Object dbUserData)
             throws Diagnostic1
Create a connection to this Db for a user.
Parameters:
sessionId - assigned by something else
access - the access info object
userInformation - the Z3950 userinformation data
o - ignored
log - user logging object
Returns:
user data for this user for this Db. Will be sent back in on subsequent requests for this user.
Overrides:
connect in class Db

disconnect

public void disconnect(Object userData)
Destroy a connection to this Db for a user.
Parameters:
dbUserData - created by connect
Overrides:
disconnect in class Db

toTermInfo

public TermInfo toTermInfo(ORG.oclc.Newton.db.Term term)
Convert a Term to a TermInfo.
Parameters:
Term - the term to convert
Returns:
TermInfo the converted term

sort

public void sort(String hitlist,
                 String sortedList,
                 String[] keys,
                 int[] order,
                 boolean fUseSortAttributes,
                 boolean sortAccrossDbs,
                 Object dupCriteria,
                 Object userData)
          throws Diagnostic1,
                 Exception
Sort the hitlist according to the keys.
Parameters:
hitlist - result set name
sortedList - result set name for sorted results
keys - sort key parameters
order - ascending or descending
fUseSortAttributes - ignored
sortAccrossDbs - flag for Dbmerge indicating whether to sort accross databases to create one merged sorted set.
dupCriteria - the dedup criteria to use for a dedup sort. for each record.
userData - user data containing hitlists
Throws:
Exception - this was probably an I/O error or a coding error
Diagnostic1 - if the request is not logically correct
Overrides:
sort in class Db

unsort

protected void unsort(String hitlist,
                      Object userData)
Unsort the hitlist. Go back to the original results.
Parameters:
hitlist - result set name userData user data containing hitlists
Overrides:
unsort in class Db

buildSortKeys

protected Key[] buildSortKeys(String hitlist,
                              String[] keys,
                              int[] order,
                              Object dedupCriteria,
                              Object userData)
                       throws Exception,
                              Diagnostic1
Return sort keys for the records in the hitlist.
Parameters:
hitlist - result set name
keys - sort key parameters
order - ascending or descending
dedupCriteria - the object defining duplicate criteria
userData - user data containing hitlists
Returns:
array of Keys
Throws:
Exception - this was probably an I/O error or a coding error
Diagnostic1 - if the request is not logically correct
Overrides:
buildSortKeys in class Db

extsvc

public ExtSvcData extsvc(ExtSvcData esData,
                         ExtSvcHandler esHandler,
                         Object dbUserData)
                  throws Exception,
                         Diagnostic1,
                         AccessControl
Processes an Extended Services Request for the input task package and returns a response task package DataDir object.
Parameters:
function - the ES function value
packageType - the ES package type
esTask - the ES task package
userId - the userId associated with the ES request
description - the description of the ES request
packageName - the name of the ES package
waitAction - the ES wait action value
userData - the user context information
Throws:
Diagnostic1 - if the request is not logically correct or supported
Exception - if the processing of the command throws and exception
Overrides:
extsvc in class Db

closewhenidle

public void closewhenidle()
Overrides:
closewhenidle in class Db

rolldatabase

public boolean rolldatabase(IniFile inifile,
                            String iniSection)
Overrides:
rolldatabase in class Db

rolldatabaseusers

public int rolldatabaseusers()
Overrides:
rolldatabaseusers in class Db

Open SiteSearch 4.1.1
Final