Open SiteSearch 4.1.1
Final

ORG.oclc.db
Class DbRemoteZ

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

public class DbRemoteZ
extends Db

DbRemoteZ searches/retrieves/scans a remote Z39.50 database.

See Also:
DbRemoteZUserData

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)
          Checks to see if the user has access to the database and throws the appropriate exception if not.
 void accessControl(Object accessControlResponse, Object dbUserData)
          Process the information from an AccessControl response to set user specific authorization information.
 DbAttributes attributes()
          Retrieve the DbAttributes object.
 TermInfo[] browse(String query, int preferredPosition, int numTerms, DataDir Z39attributesPlusTerm, 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()
          Free up any resources.
 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 userData)
          Processes an Extended Services Request for the input task package and returns a response task package DataDir object.
 TermComponentPostings[] getComponentResults(String hitlist, Object userData)
          Get the componentResults for the specified hitlist.
 DbResults[] getDbResults(String hitlist, Object userData)
          Get the restrictor summaries for the specified hitlist.
 String getStats()
           
 String[] getZTargetInitMsgs(Object userData)
          Retrieves a String containing the init msg from the remote Z-target.
 int getZTargetInitStatus(Object userData)
          Retrieves an integer containing the init status value to the remote Z-target.
protected  boolean init(IniFile inifile, String which)
           
 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()
           
 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.
 int search(String query, String hitlist, boolean replaceFlag, DataDir Z39attributesPlusTerm, boolean doRestrictorSummary, Object additionalSearchInfo, Object userData)
          Send search to remote site.
 void sort(String hitlist, String sortHitlist, String[] keys, int[] order, boolean fUseSortAttributes, boolean sortAccrossDbs, Object dupCriteria, Object userData)
          If a local sort has been specified, do it; otherwise, send the sort request to the remote server.
protected  boolean supportsScan()
           
protected  boolean supportsSort()
           
 String toString()
           
protected  void unsort(String hitlist, Object userData)
          Unsort the hitlist.
 
Methods inherited from class ORG.oclc.db.Db
browse, closewhenidle, dbnames, deleteHitlist, filterName, getDb, getDbNames, getDbs, getGlobals, getName, getOpenedFilesCount, getOutstandingCount, hasUsers, numUsers, openDb, openDbs, present, rolldatabase, rolldatabaseusers, search, setOps, setSearchMode, SetupDatabase, SetupDatabase, sort, sort, updateOpenedFiles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

toString

public String toString()
Overrides:
toString in class Object

init

protected boolean init(IniFile inifile,
                       String which)
                throws Exception
Parameters:
inifile - for parameters
which - the section name to read from
Returns:
true if successful
Overrides:
init in class Db

close

public void close()
Free up any resources. ?? Should this close the Connection object?
Overrides:
close in class Db

OK

public boolean OK()
Returns:
true
Overrides:
OK in class Db

attributes

public DbAttributes attributes()
Retrieve the DbAttributes object.
Returns:
DbAttributes

present

public DbPresentData[] present(String hitlist,
                               int startPoint,
                               int numRecs,
                               String elementSetName,
                               String syntax,
                               Object userData)
                        throws Diagnostic1,
                               Exception
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:
Exception - the URL was malformed or the connection to the site coult not be made
Overrides:
present in class Db

postings

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

search

public int search(String query,
                  String hitlist,
                  boolean replaceFlag,
                  DataDir Z39attributesPlusTerm,
                  boolean doRestrictorSummary,
                  Object additionalSearchInfo,
                  Object userData)
           throws Exception,
                  Diagnostic1,
                  AccessControl
Send search to remote site.
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:
Exception - this was probably an I/O error or a coding error
Diagnostic1 - if the request is not logically correct
Overrides:
search in class Db

sort

public void sort(String hitlist,
                 String sortHitlist,
                 String[] keys,
                 int[] order,
                 boolean fUseSortAttributes,
                 boolean sortAccrossDbs,
                 Object dupCriteria,
                 Object userData)
          throws Exception,
                 Diagnostic1
If a local sort has been specified, do it; otherwise, send the sort request to the remote server.
Parameters:
hitlist - result set name
sortedList - result set name for sorted results
keys - sort key parameters
order - ascending or descending
fUseSortAttributes - flag to sort by use attributes
sortAccrossDbs - flag to indicate whether in a cross-db search, the sort results are merged into 1 list.
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. Used to do a local sort.
Parameters:
hitlist - result set name
keys - sort key parameters
order - ascending or descending
dedupCriteria - object containing the 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

deleteHitlist

public void deleteHitlist(String hitlist,
                          Object userData)
                   throws Exception,
                          Diagnostic1
Delete the specified hitlist.
Parameters:
hitlist - the one to delete
dbUserData - 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:
deleteHitlist in class Db

browse

public TermInfo[] browse(String query,
                         int preferredPosition,
                         int numTerms,
                         DataDir Z39attributesPlusTerm,
                         DataDir resultSetAttributes,
                         int stepSize,
                         Object userData)
                  throws Exception,
                         Diagnostic1,
                         AccessControl
Perform a browse.
Parameters:
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
PartialResults - for a DbMerge created on the fly, one (or more) of the parts had an error
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 componentResults for the specified hitlist.
Parameters:
hitlist - result set name
dbUserData - user data containing hitlists
Returns:
array of componentResults[] for this hitlist
Overrides:
getComponentResults in class Db

getStats

public String getStats()
Returns:
"\nUsers="
Overrides:
getStats in class Db

supportsScan

protected boolean supportsScan()
Returns:
supportsScan
Overrides:
supportsScan in class Db

supportsSort

protected boolean supportsSort()
Returns:
supportsSort
Overrides:
supportsSort 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
userDbMap - Object containing all the user's database information objects.
Returns:
Object containing user data for this user for this Db. Will be sent back in on subsequent requests for this user.
Overrides:
initDbUserData in class Db

accessAllowed

public void accessAllowed(Object dbUserData)
                   throws Diagnostic1,
                          AccessControl
Checks to see if the user has access to the database and throws the appropriate exception if not.
Parameters:
userData - user context data for the database
Throws:
AccessControl - exception thrown when an autho/password is required for the db and one is not supplied in the configuration
Diagnostic1 - when the user is not authorized to access the database.
Overrides:
accessAllowed in class Db

connect

public void connect(Object userInformation,
                    Object dbUserData)
             throws Diagnostic1
Create a connection to this Db for a user. Re-use an existing session to this server if possible. Do an Init, if needed.
Parameters:
userInformation - the User Information from the Z39.50 init.
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. Remove the user from the list of connections to this server.
Parameters:
dbUserData - created by connect
Overrides:
disconnect in class Db

extsvc

public ExtSvcData extsvc(ExtSvcData esData,
                         ExtSvcHandler esHandler,
                         Object userData)
                  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

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

getZTargetInitMsgs

public String[] getZTargetInitMsgs(Object userData)
Retrieves a String containing the init msg from the remote Z-target.
Returns:
String

getZTargetInitStatus

public int getZTargetInitStatus(Object userData)
Retrieves an integer containing the init status value to the remote Z-target.
Returns:
int

Open SiteSearch 4.1.1
Final