org.jafer.zclient
Class SRUBinding

java.lang.Object
  extended by org.jafer.zclient.SRUBinding
All Implemented Interfaces:
gov.loc.www.zing.srw.interfaces.SRWPort, java.rmi.Remote

public class SRUBinding
extends java.lang.Object
implements gov.loc.www.zing.srw.interfaces.SRWPort

This class binds an SRWSession to a host that only supports SRU


Field Summary
protected static java.util.logging.Logger logger
          Stores a reference to the logger
private static java.lang.String SOAP_END
          Stores a reference to the required end xml of a SOAP envelope
private static java.lang.String SOAP_START
          Stores a reference to the required start xml of a SOAP envelope
private  java.lang.String url
          Stores a reference to url of the binding
 
Constructor Summary
SRUBinding(java.lang.String url)
          Constructor
 
Method Summary
private  java.lang.String constructExtraRequestData(gov.loc.www.zing.srw.ExtraDataType extraData)
          This method extracts the extra data parameters and creates a URL string (?key=value&key2=value2) that can be appended to the URL for a scan/search GET request.
private  java.lang.String constructURLScanRequestParameters(gov.loc.www.zing.srw.ScanRequestType request)
          This method extracts the scan request parameters and creates a URL string (?key=value&key2=value2) that can be appended to the URL for a scan GET request.
private  java.lang.String constructURLSearchRequestParameters(gov.loc.www.zing.srw.SearchRetrieveRequestType request)
          This method extracts the search request parameters and creates a URL string (?key=value&key2=value2) that can be appended to the URL for a search GET request.As all the construction is contained in this method static strings are not defined.

see http://www.loc.gov/standards/sru/sru-spec.html for param details

Note - String parameters must be URL Encoded
private  java.lang.Object deserialiseResponse(java.lang.String xml, java.lang.Class responseClass)
          This method takes an xml response, wraps it in a soap envelope and then uses the axis derserialisation process to return an instance of the specified response class
 gov.loc.www.zing.srw.ScanResponseType scanOperation(gov.loc.www.zing.srw.ScanRequestType request)
          This method performs the scanOperation connecting to the host using SRU.
 gov.loc.www.zing.srw.SearchRetrieveResponseType searchRetrieveOperation(gov.loc.www.zing.srw.SearchRetrieveRequestType request)
          This method performs the searchRetrieveOperation connecting to the host using SRU.
private  java.lang.String sendRequest(java.lang.String requestParameters)
          This method sends a GET request to the specified URL appending the supplied request parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOAP_START

private static java.lang.String SOAP_START
Stores a reference to the required start xml of a SOAP envelope


SOAP_END

private static java.lang.String SOAP_END
Stores a reference to the required end xml of a SOAP envelope


logger

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


url

private java.lang.String url
Stores a reference to url of the binding

Constructor Detail

SRUBinding

public SRUBinding(java.lang.String url)
Constructor

Parameters:
url - The url of the binding
Method Detail

deserialiseResponse

private java.lang.Object deserialiseResponse(java.lang.String xml,
                                             java.lang.Class responseClass)
                                      throws JaferException
This method takes an xml response, wraps it in a soap envelope and then uses the axis derserialisation process to return an instance of the specified response class

Parameters:
xml - The xml to response to process
responseClass - The response class type
Returns:
An instance of the desired response class
Throws:
JaferException

sendRequest

private java.lang.String sendRequest(java.lang.String requestParameters)
                              throws java.io.IOException
This method sends a GET request to the specified URL appending the supplied request parameters. The resulting XML is returned to the caller

Parameters:
requestParameters - The request paramaters string URLEncoded
Returns:
The returned xml from the operation request sent
Throws:
java.io.IOException

constructExtraRequestData

private java.lang.String constructExtraRequestData(gov.loc.www.zing.srw.ExtraDataType extraData)
                                            throws java.io.UnsupportedEncodingException
This method extracts the extra data parameters and creates a URL string (?key=value&key2=value2) that can be appended to the URL for a scan/search GET request. As all the construction is contained in this method static strings are not defined.

see http://www.loc.gov/standards/sru/extra-data.html for param details

Parameters:
extraData - The extra data to be processed
Returns:
The URL parameter string for the extra data
Throws:
java.io.UnsupportedEncodingException

constructURLScanRequestParameters

private java.lang.String constructURLScanRequestParameters(gov.loc.www.zing.srw.ScanRequestType request)
                                                    throws JaferException
This method extracts the scan request parameters and creates a URL string (?key=value&key2=value2) that can be appended to the URL for a scan GET request. As all the construction is contained in this method static strings are not defined.

see http://www.loc.gov/standards/sru/scan/index.html for param details

Note - String parameters must be URL Encoded

Parameters:
request - The ScanRequestType of request parameters
Returns:
The URL parameter string for the scan operation
Throws:
JaferException

constructURLSearchRequestParameters

private java.lang.String constructURLSearchRequestParameters(gov.loc.www.zing.srw.SearchRetrieveRequestType request)
                                                      throws JaferException
This method extracts the search request parameters and creates a URL string (?key=value&key2=value2) that can be appended to the URL for a search GET request.As all the construction is contained in this method static strings are not defined.

see http://www.loc.gov/standards/sru/sru-spec.html for param details

Note - String parameters must be URL Encoded

Parameters:
request - The SearchRetrieveRequestType of request parameters
Returns:
The URL parameter string for the search retrieve operation
Throws:
JaferException

scanOperation

public gov.loc.www.zing.srw.ScanResponseType scanOperation(gov.loc.www.zing.srw.ScanRequestType request)
                                                    throws java.rmi.RemoteException
This method performs the scanOperation connecting to the host using SRU. It takes the scan request and converts it to an SRU url to send to the server. When the response is returned the XML is converted back to the ScanResponseType message object.

Specified by:
scanOperation in interface gov.loc.www.zing.srw.interfaces.SRWPort
Parameters:
body - The ScanRequestType message
Returns:
The ScanResponseType message
Throws:
java.rmi.RemoteException

searchRetrieveOperation

public gov.loc.www.zing.srw.SearchRetrieveResponseType searchRetrieveOperation(gov.loc.www.zing.srw.SearchRetrieveRequestType request)
                                                                        throws java.rmi.RemoteException
This method performs the searchRetrieveOperation connecting to the host using SRU. It takes the searchRetrieve request and converts it to an SRU url to send to the server. When the response is returned the XML is converted back to the SearchRetrieveResponseType message object.

Specified by:
searchRetrieveOperation in interface gov.loc.www.zing.srw.interfaces.SRWPort
Parameters:
body - The SearchRetrieveRequestType message
Returns:
The SearchRetrieveResponseType message
Throws:
java.rmi.RemoteException