org.jafer.zclient
Class SRWSession

java.lang.Object
  extended by org.jafer.zclient.SRWSession
All Implemented Interfaces:
Session

public class SRWSession
extends java.lang.Object
implements Session

This class represents a session that manages a connection against an srw server


Field Summary
private  gov.loc.www.zing.srw.interfaces.SRWPort binding
          Stores a reference to the SRWPort that binds this session against a connection to the server - Currently these are SRU Binding or SRWBinding depending on the connection type supported by the server.
protected static java.util.logging.Logger logger
          Stores a reference to the logger
private  java.lang.String query
          Stores a reference to the last query that was executed so that present gets the records for that query
private static java.lang.String RECORD_PACKING_STRING
          Stores a reference to record packing ID for string records
private static java.lang.String RECORD_PACKING_XML
          Stores a reference to record packing ID for xml records
 
Constructor Summary
SRWSession(gov.loc.www.zing.srw.interfaces.SRWPort binding)
          Create the SRW session supplying the SRW or SRU binding to use
 
Method Summary
 void close()
          This method closes the current connection and any underlying binding classes
 java.lang.String getGroup()
          Returns the group for this session.
 int getId()
          Return the session Identifier
 java.lang.String getName()
          Return the name allocatted to this session
 java.lang.String getPassword()
          Return the password for the user connecting via this session
 java.lang.String getUsername()
          Return the username for the user connecting via this session
 void init(java.lang.String group, java.lang.String username, java.lang.String password)
          Initalise the session
 java.util.Vector present(int nRecord, int nRecords, int[] recordOID, java.lang.String eSpec, java.lang.String resultSetName)
          Obtain the requested records via the sessions connection to the server and return them to the caller
 java.util.Vector scan(java.lang.String[] databases, int nTerms, int step, int position, org.w3c.dom.Node term)
          Performs a scan on the sessions connection to the sever to retrieve a list of related terms
 java.util.Vector scan(java.lang.String[] databases, int nTerms, int step, int position, java.lang.Object termObject)
          Performs a scan on the sessions connection to the sever to retrieve a list of related terms
 SearchResult[] search(java.lang.Object queryObject, java.lang.String[] databases, java.lang.String resultSetName)
          Performs a search on the sessions connection to the sever to work out how many results would be returned for the search query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECORD_PACKING_STRING

private static final java.lang.String RECORD_PACKING_STRING
Stores a reference to record packing ID for string records

See Also:
Constant Field Values

RECORD_PACKING_XML

private static final java.lang.String RECORD_PACKING_XML
Stores a reference to record packing ID for xml records

See Also:
Constant Field Values

logger

protected static java.util.logging.Logger logger
Stores a reference to the logger


binding

private gov.loc.www.zing.srw.interfaces.SRWPort binding
Stores a reference to the SRWPort that binds this session against a connection to the server - Currently these are SRU Binding or SRWBinding depending on the connection type supported by the server. This is detected during creation of the session in the SRWClient


query

private java.lang.String query
Stores a reference to the last query that was executed so that present gets the records for that query

Constructor Detail

SRWSession

public SRWSession(gov.loc.www.zing.srw.interfaces.SRWPort binding)
Create the SRW session supplying the SRW or SRU binding to use

Parameters:
binding - The binding that connectes this session to the server
Method Detail

close

public void close()
Description copied from interface: Session
This method closes the current connection and any underlying binding classes

Specified by:
close in interface Session

getGroup

public java.lang.String getGroup()
Description copied from interface: Session
Returns the group for this session. TODO NEED MORE DETAIL HERE

Specified by:
getGroup in interface Session
Returns:
The string representation of the group for this session.

getId

public int getId()
Description copied from interface: Session
Return the session Identifier

Specified by:
getId in interface Session
Returns:
The session identifier

getName

public java.lang.String getName()
Description copied from interface: Session
Return the name allocatted to this session

Specified by:
getName in interface Session
Returns:
The name of this session

getPassword

public java.lang.String getPassword()
Description copied from interface: Session
Return the password for the user connecting via this session

Specified by:
getPassword in interface Session
Returns:
The users password for the connection

getUsername

public java.lang.String getUsername()
Description copied from interface: Session
Return the username for the user connecting via this session

Specified by:
getUsername in interface Session
Returns:
The users username for the connection

init

public void init(java.lang.String group,
                 java.lang.String username,
                 java.lang.String password)
          throws ConnectionException
Description copied from interface: Session
Initalise the session

Specified by:
init in interface Session
Parameters:
group - The group name for this session
username - The username of the user connecting via this session
password - The password of the user connecting via this session
Throws:
ConnectionException

search

public SearchResult[] search(java.lang.Object queryObject,
                             java.lang.String[] databases,
                             java.lang.String resultSetName)
                      throws JaferException,
                             ConnectionException
Description copied from interface: Session
Performs a search on the sessions connection to the sever to work out how many results would be returned for the search query

Specified by:
search in interface Session
Parameters:
queryObject - The query object to search against. Normally RPNNode or a simple Node that represents a JaferQuery
databases - The list of databases to be searched
resultSetName - The name to be given to the result set
Returns:
An array of search result objects that identify the number of results for each database searched
Throws:
JaferException
ConnectionException

present

public java.util.Vector present(int nRecord,
                                int nRecords,
                                int[] recordOID,
                                java.lang.String eSpec,
                                java.lang.String resultSetName)
                         throws PresentException,
                                ConnectionException
Description copied from interface: Session
Obtain the requested records via the sessions connection to the server and return them to the caller

Specified by:
present in interface Session
Parameters:
nRecord - The index of the record that the retrieve should start at
nRecords - The maximum number of records that should be returned
recordOID - The record object identifier
eSpec - The element spec attribute of the ZClient
resultSetName - The result set name
Returns:
A Vector of DataObject returned from the server
Throws:
PresentException
ConnectionException

scan

public java.util.Vector scan(java.lang.String[] databases,
                             int nTerms,
                             int step,
                             int position,
                             org.w3c.dom.Node term)
                      throws JaferException,
                             ConnectionException
Description copied from interface: Session
Performs a scan on the sessions connection to the sever to retrieve a list of related terms

Specified by:
scan in interface Session
Parameters:
databases - An array of database names that are being scanned
nTerms - The maximum number of terms to return
step - ?????????????????????????????????????????????????????????
position - ?????????????????????????????????????????????????????
term - ?????????????????????????????????????????????????????????
Returns:
A vector of DataObjects representing the terms found
Throws:
JaferException
ConnectionException

scan

public java.util.Vector scan(java.lang.String[] databases,
                             int nTerms,
                             int step,
                             int position,
                             java.lang.Object termObject)
                      throws JaferException,
                             ConnectionException
Description copied from interface: Session
Performs a scan on the sessions connection to the sever to retrieve a list of related terms

Specified by:
scan in interface Session
Parameters:
databases - An array of database names that are being scanned
nTerms - The maximum number of terms to return
step - ?????????????????????????????????????????????????????????
position - ?????????????????????????????????????????????????????
termObject - ???????????????????????????????????????????????????
Returns:
A vector of DataObjects representing the terms found
Throws:
JaferException
ConnectionException