public class Pz2Client extends java.lang.Object implements SearchClient
Although it is described here as straight Pazpar2, the client itself actually represents a layer between Pazpar2 and the JSF application because it uses the Pazpar2 client from the library masterkey-common.
That client, which is the one also used by the Service Proxy, does perform certain types of session handling, bootstraps lost sessions, avoids repeating already executed queries etc, so it is -- in other words -- still a mediated interaction with Pazpar2 that takes place. At least for now.When configuring the client using the Mk2Config scheme, this is the prefix to use in the .properties file. When using web.xml context parameters for configuration the configuration name has no effect.
Pz2Client will acknowledge following configuration parameters:
Modifier and Type | Field and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
DEFAULTS
PAZPAR2_URL=none, PROXY_MODE=1, SERIALIZE_REQUESTS=false, STREAMBUFF_SIZE=4096, PARSE_RESPONSES=true
|
static java.lang.String |
MODULENAME |
Constructor and Description |
---|
Pz2Client() |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate() |
Pz2Client |
cloneMe() |
void |
configure(ConfigurationReader configReader)
Configures the Configurable using the configuration obtained by the
provided configuration reader
|
java.util.List<java.lang.String> |
documentConfiguration()
Provides configuration documentation -- mostly for diagnosing problems
|
HttpResponseWrapper |
executeCommand(Pazpar2Command command)
Runs the give Pazpar2 command and returns a response wrapper with either the received response or
with some form of error message.
|
Configuration |
getConfiguration()
Returns the current client configuration - mainly for error resolution.
|
java.util.Map<java.lang.String,java.lang.String> |
getDefaults()
Returns default configuration parameters for the client.
|
java.lang.String |
getModuleName()
Returns the configuration name of the client
|
java.lang.String |
getServiceId()
Returns the Pazpar2 Service ID
|
java.lang.String |
getServiceUrl()
Returns the currently configured Papzar2 URL.
|
boolean |
hasServiceUrl()
Returns true if a Papzar2 URL was defined yet.
|
boolean |
isAuthenticated() |
boolean |
isAuthenticatingClient()
Basically says if this client accesses a Service Proxy, which (usually)
requires some form of authentication, or Pazpar2, which don't.
|
void |
setSearchCommand(Pazpar2Command command)
Search commands are saved for management purposes, like bootstrapping
expired sessions and write log statements.
|
void |
setServiceId(java.lang.String serviceId)
Sets the service ID that Pazpar2 should use when servicing requests
|
void |
setServiceUrl(java.lang.String serviceUrl)
Sets the Pazpar2 URL to use for requests.
|
public static final java.lang.String MODULENAME
public static java.util.Map<java.lang.String,java.lang.String> DEFAULTS
public void configure(ConfigurationReader configReader) throws ConfigurationException
Configurable
configure
in interface Configurable
configReader
- used for reading the configurationConfigurationException
public boolean isAuthenticatingClient()
SearchClient
isAuthenticatingClient
in interface SearchClient
public boolean isAuthenticated()
public boolean authenticate()
public void setSearchCommand(Pazpar2Command command)
SearchClient
setSearchCommand
in interface SearchClient
public HttpResponseWrapper executeCommand(Pazpar2Command command)
executeCommand
in interface SearchClient
public Pz2Client cloneMe()
cloneMe
in interface SearchClient
public java.util.Map<java.lang.String,java.lang.String> getDefaults()
getDefaults
in interface Configurable
public java.lang.String getModuleName()
getModuleName
in interface Configurable
public java.util.List<java.lang.String> documentConfiguration()
documentConfiguration
in interface Configurable
public Configuration getConfiguration()
SearchClient
getConfiguration
in interface SearchClient
public java.lang.String getServiceUrl()
getServiceUrl
in interface SearchClient
public boolean hasServiceUrl()
hasServiceUrl
in interface SearchClient
public void setServiceUrl(java.lang.String serviceUrl)
setServiceUrl
in interface SearchClient
public java.lang.String getServiceId()
public void setServiceId(java.lang.String serviceId)
serviceId
-