com.indexdata.masterkey.pazpar2.client
Interface Pazpar2Client

All Known Implementing Classes:
AbstractPazpar2Client, Pazpar2ClientGeneric, Pazpar2ClientTorus

public interface Pazpar2Client

Pazpar2 proxy API. The proxy class is always instantiated per request. No backend HTTP connection reuse occurs.

Author:
jakub

Method Summary
 Pazpar2Client cloneMe()
          Creates a Pazpar2 client clone with the same Pazpar2 configuration and target settings as the original.
 Pazpar2HttpResponse executeCommand(ClientCommand command, OutputStream os)
          Forwards any Pazpar2 command and stores the results in the OutputStream
 Document getHit(String recid)
          Finds a 'hit' element by record ID from the latest 'show' results
 Document getResults(String command)
          Returns the results of the latest command of the kind processed by this proxy client
 ClientCommand getSearchCommand()
          Returns the most recent search command registered with this client
 int getSearchCount()
          Returns the number of searches so far on this pazpar2 client object
 String getSessionId()
          Returns sessionId for currently used pazpar2 session.
 Pazpar2Settings getSettings()
           
 long getTimeStamp(String command, int searchNumber)
           
 void init()
          Obtain new pazpar2 session valid for unspecified time period.
 Document recordRequest(String recid)
          Makes a non-managed/transient pazpar2 record request.
 Document recordRequest(String recid, int offset)
          Makes a non-managed/transient pazpar2 record offset request.
 Document searchRequest(String queryString)
          Makes a non-managed pazpar2 search request on a cloned pazpar2 client This is for 'embedded' pazpar2 requests by other plug-ins than Relay and independently of the main pazpar2 session.
 void setSearchCommand(ClientCommand command)
          Stores the latest search command issued through this proxy client
 Document showRequest()
          Makes a non-managed/transient pazpar2 show request.
 

Method Detail

init

void init()
          throws Pazpar2ErrorException,
                 Pazpar2IOException
Obtain new pazpar2 session valid for unspecified time period.

Throws:
Pazpar2ErrorException - on pazpar2 application-level errors
com.indexdata.masterkey.pazpar2.exceptions.Pazpar2IOException
com.indexdata.masterkey.pazpar2.exceptions.Pazpar2MalformedOutputException
Pazpar2IOException

getSessionId

String getSessionId()
Returns sessionId for currently used pazpar2 session.

Returns:
pazpar2 session id

getSettings

Pazpar2Settings getSettings()
Returns:
The Pazpar2 target settings for the current session

setSearchCommand

void setSearchCommand(ClientCommand command)
Stores the latest search command issued through this proxy client

Parameters:
command -

getSearchCommand

ClientCommand getSearchCommand()
Returns the most recent search command registered with this client

Returns:

getSearchCount

int getSearchCount()
Returns the number of searches so far on this pazpar2 client object


executeCommand

Pazpar2HttpResponse executeCommand(ClientCommand command,
                                   OutputStream os)
                                   throws IOException,
                                          Pazpar2ErrorException
Forwards any Pazpar2 command and stores the results in the OutputStream

Parameters:
command -
os -
Returns:
HTTP status of pazpar2 request
Throws:
IOException
Pazpar2ErrorException

getResults

Document getResults(String command)
Returns the results of the latest command of the kind processed by this proxy client

Parameters:
command -
Returns:

getTimeStamp

long getTimeStamp(String command,
                  int searchNumber)

getHit

Document getHit(String recid)
Finds a 'hit' element by record ID from the latest 'show' results

Parameters:
recid -
Returns:
hit formatted as a record

cloneMe

Pazpar2Client cloneMe()
                      throws ProxyErrorException,
                             Pazpar2ErrorException,
                             Pazpar2IOException
Creates a Pazpar2 client clone with the same Pazpar2 configuration and target settings as the original. The client will be initialized but no search state is copied over from the original. The cloned client can be used by plug-ins to make pazpar2 requests independently of RelayPlugins master pazpar2 session.

Returns:
Uninitialized clone of this client
Throws:
ProxyErrorException
Pazpar2ErrorException
Pazpar2IOException

searchRequest

Document searchRequest(String queryString)
                       throws Pazpar2ErrorException,
                              Pazpar2IOException
Makes a non-managed pazpar2 search request on a cloned pazpar2 client This is for 'embedded' pazpar2 requests by other plug-ins than Relay and independently of the main pazpar2 session. It will not update the state of the pazpar2 client object. The method should only be invoked on a cloned pazpar2 client object, using it on a main pazpar2 session would compromise the state of the session.

Parameters:
queryString -
Returns:
pazpar2's response as a Document
Throws:
StandardServiceException - on Pazpar2 errors or parsing errors.
UnsupportedOperationException - if invoked on a client object that was not cloned.
Pazpar2ErrorException
Pazpar2IOException

recordRequest

Document recordRequest(String recid,
                       int offset)
                       throws Pazpar2ErrorException,
                              Pazpar2IOException
Makes a non-managed/transient pazpar2 record offset request. This is for 'embedded' pazpar2 requests by other plug-ins than Relay and independently of the main pazpar2 session. It will not update the state of the pazpar2 client object.

Parameters:
queryString -
Returns:
pazpar2's response as a Document
Throws:
StandardServiceException - on Pazpar2 errors or parsing errors.
Pazpar2ErrorException
Pazpar2IOException

recordRequest

Document recordRequest(String recid)
                       throws Pazpar2ErrorException,
                              Pazpar2IOException
Makes a non-managed/transient pazpar2 record request. This is for 'embedded' pazpar2 requests by other plug-ins than Relay and independently of the main pazpar2 session. It will not update the state of the pazpar2 client object.

Parameters:
queryString -
Returns:
pazpar2's response as a Document
Throws:
StandardServiceException - on Pazpar2 errors or parsing errors.
Pazpar2ErrorException
Pazpar2IOException

showRequest

Document showRequest()
                     throws Pazpar2ErrorException,
                            Pazpar2IOException
Makes a non-managed/transient pazpar2 show request. This is for 'embedded' pazpar2 requests by other plug-ins than Relay and independently of the main pazpar2 session. It will not update the state of the pazpar2 client object.

Parameters:
queryString -
Returns:
pazpar2's response as a Document
Throws:
StandardServiceException - on Pazpar2 errors or parsing errors.
Pazpar2ErrorException
Pazpar2IOException


Copyright © 2012. All Rights Reserved.