* \r
* <code>pz2client.PAZPAR2_URL = http://localhost:8004/</code>\r
* \r
- * <p>Some of the other know parameters in this format could be:</p>\r
+ * <p>Some of the other known parameters in this format could be:</p>\r
* \r
* <pre>\r
* service.TYPE = SP \r
* and inject that class in beans.xml instead of any of the two predefined options. The extended\r
* class must construct a Configuration object -- which is basically a set of key-value pairs -- \r
* and then set the desired values and hand it off to the Configurable (currently Pz2Service, Pz2Client, \r
- * ServiceProxyClient</p> \r
+ * and ServiceProxyClient)</p> \r
* \r
* <p>Finally it's possible to set the URL runtime even from the UI pages.</p> \r
* \r
\r
import com.indexdata.masterkey.pazpar2.client.Pazpar2HttpResponse;\r
\r
+/**\r
+ * Contains one HTTP response to a command executed against a Pazpar2 service in such a \r
+ * way as to give the response parser a common interface to responses, whether \r
+ * they are from Pazpar2, from the Service Proxy, or are error messages created \r
+ * by the JSF application during processing.\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class ClientCommandResponse implements HttpResponseWrapper {\r
\r
private int statusCode;\r
private String contentString = null;\r
private byte[] bytesForParsing = null;\r
\r
+ /**\r
+ * Used for storing Pazpar2 based response\r
+ * \r
+ * @param pz2response\r
+ * @param content\r
+ */\r
public ClientCommandResponse(Pazpar2HttpResponse pz2response, ByteArrayOutputStream content) { \r
this.content = content.toByteArray();\r
this.statusCode = pz2response.getStatusCode();\r
this.contentType = pz2response.getContentType();\r
}\r
\r
+ /**\r
+ * Used for storing error response\r
+ * \r
+ * @param statusCode\r
+ * @param content\r
+ * @param contentType\r
+ */\r
public ClientCommandResponse(int statusCode, String content, String contentType) {\r
this.statusCode = statusCode;\r
this.contentString = content;\r
this.contentType = contentType;\r
}\r
\r
+ /**\r
+ * Used for storing Service Proxy based response\r
+ * \r
+ * @param statusCode\r
+ * @param content\r
+ * @param contentType\r
+ */\r
public ClientCommandResponse(int statusCode, byte[] content, String contentType) {\r
this.statusCode = statusCode;\r
this.content = content;\r
return contentType;\r
}\r
\r
+ /**\r
+ * Gets the response as a String - unless the response is marked as binary\r
+ */\r
@Override\r
public String getResponseString() {\r
if (content == null) {\r
return content;\r
}\r
\r
+ /**\r
+ * Overrides the original response with a modified response. Used for\r
+ * one instance of a response that is not named by the command that \r
+ * created it - such as the parser expects. \r
+ * \r
+ * @param parseString\r
+ */\r
public void setResponseToParse(String parseString) { \r
try {\r
this.bytesForParsing = parseString.getBytes("UTF-8");\r
}\r
}\r
\r
+ /**\r
+ * Used by the parser to get the response for further processing. \r
+ * @return\r
+ */\r
public byte[] getResponseToParse() {\r
if (bytesForParsing != null) {\r
return bytesForParsing;\r
import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;\r
import com.indexdata.mkjsf.pazpar2.data.Responses;\r
\r
+/**\r
+ * Helper class for running multiple concurrent Pazpar2 commands. Basically \r
+ * used for updating display data (show,stat,bytarget,termlist) together.\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class CommandThread extends Thread {\r
\r
private static Logger logger = Logger.getLogger(CommandThread.class);\r
import com.indexdata.mkjsf.pazpar2.data.CommandError;\r
import com.indexdata.mkjsf.utils.Utils;\r
\r
+/**\r
+ * Search client handling straight Pazpar2 requests. \r
+ * \r
+ * <p>Although it is described here as straight Pazpar2, the client itself \r
+ * actually represents a layer between Pazpar2 and the JSF application because it \r
+ * uses the Pazpar2 client from the library masterkey-common.</p>\r
+ * That client, which is the one also used by the Service Proxy, does perform certain \r
+ * types of session handling, bootstraps lost sessions, avoids repeating already \r
+ * executed queries etc, so it is -- in other words -- still a mediated interaction \r
+ * with Pazpar2 that takes place. At least for now.</p> \r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class Pz2Client implements SearchClient {\r
\r
private static final long serialVersionUID = 5414266730169982028L;\r
client.setSearchCommand(clientCommand); \r
}\r
\r
+ /**\r
+ * Runs the give Pazpar2 command and returns a response wrapper with either the received response or \r
+ * with some form of error message. \r
+ * \r
+ * It is intended that this method never throws an exception. All events are supposed to be captured and\r
+ * returned in some form of response. \r
+ */\r
@Override\r
public HttpResponseWrapper executeCommand(Pazpar2Command command) {\r
ClientCommandResponse commandResponse = null;\r
commandResponse = new ClientCommandResponse(0,CommandError.createErrorXml(command.getCommandName(), "", "ServiceError", e.getMessage(),""),"text/xml");\r
}\r
long end = System.currentTimeMillis(); \r
- logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." );\r
+ logger.info("Executed " + command.getCommandName() + " in " + (end-start) + " ms." );\r
return commandResponse;\r
}\r
\r
return clone;\r
}\r
\r
+ /**\r
+ * Returns default configuration parameters for the client.\r
+ */\r
@Override\r
public Map<String, String> getDefaults() {\r
return DEFAULTS;\r
}\r
\r
+ /**\r
+ * Returns the configuration name of the client\r
+ */\r
@Override\r
public String getModuleName() {\r
return MODULENAME;\r
}\r
}\r
\r
+ /**\r
+ * Provides configuration documentation -- mostly for diagnosing problems \r
+ */\r
@Override\r
public List<String> documentConfiguration() {\r
List<String> doc = new ArrayList<String>();\r
return config;\r
}\r
\r
+ /**\r
+ * Returns the currently configured Papzar2 URL.\r
+ */\r
@Override\r
public String getServiceUrl() {\r
return cfg.PAZPAR2_URL; \r
}\r
\r
+ /**\r
+ * Returns true if a Papzar2 URL was defined yet. \r
+ */\r
@Override\r
public boolean hasServiceUrl() {\r
return cfg.PAZPAR2_URL != null && cfg.PAZPAR2_URL.length()>0;\r
}\r
\r
+ /**\r
+ * Sets the Pazpar2 URL to use for requests. \r
+ */\r
@Override \r
public void setServiceUrl (String serviceUrl) { \r
cfg.PAZPAR2_URL = serviceUrl; \r
}\r
\r
+ /**\r
+ * Returns the Pazpar2 Service ID \r
+ */\r
public String getServiceId () {\r
return cfg.PAZPAR2_SERVICE_ID;\r
}\r
\r
+ /**\r
+ * Sets the service ID that Pazpar2 should use when servicing requests\r
+ * @param serviceId\r
+ */\r
public void setServiceId(String serviceId) {\r
cfg.PAZPAR2_SERVICE_ID = serviceId;\r
try {\r
}\r
}\r
\r
+ /**\r
+ * Used by the state manager to notify Pz2Service about state changes\r
+ */\r
@Override\r
public void stateUpdated(String commandName) {\r
logger.debug("State change reported for [" + commandName + "]");\r
return pager;\r
}\r
\r
+ /**\r
+ * Sets the URL of the Service Proxy to use for requests\r
+ * \r
+ * @param url\r
+ */\r
public void setServiceProxyUrl(String url) {\r
searchClient = spClient;\r
setServiceType(SERVICE_TYPE_SP);\r
setServiceUrl(url);\r
}\r
\r
+ /**\r
+ * Returns the Service Proxy URL currently defined for servicing requests\r
+ * \r
+ */\r
public String getServiceProxyUrl () {\r
if (isServiceProxyService()) {\r
return spClient.getServiceUrl();\r
return "";\r
}\r
}\r
- \r
+\r
+ /**\r
+ * Sets the URL of the Pazpar2 to use for requests\r
+ * \r
+ * @param url\r
+ */\r
public void setPazpar2Url(String url) {\r
searchClient = pz2Client;\r
setServiceType(SERVICE_TYPE_PZ2);\r
setServiceUrl(url);\r
}\r
\r
+ /**\r
+ * Returns the Pazpar2 URL currently defined for servicing requests\r
+ * \r
+ */ \r
public String getPazpar2Url() {\r
if (isPazpar2Service()) {\r
return pz2Client.getServiceUrl();\r
}\r
}\r
\r
+ /**\r
+ * Sets the URL to be used by the currently selected search client \r
+ * when running requests. \r
+ * \r
+ * @param url\r
+ */\r
public void setServiceUrl(String url) {\r
if (url!=null && searchClient != null && !url.equals(searchClient.getServiceUrl())) {\r
pzreq.getRecord().removeParametersInState();\r
} \r
}\r
\r
+ /**\r
+ * Gets the currently selected URL used for executing requests. \r
+ * @return\r
+ */\r
public String getServiceUrl() {\r
return (searchClient!=null ? searchClient.getServiceUrl() : "");\r
}\r
import com.indexdata.mkjsf.pazpar2.data.CommandError;\r
import com.indexdata.mkjsf.utils.Utils;\r
\r
+/**\r
+ * Search client handling Service Proxy requests. \r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class ServiceProxyClient implements SearchClient {\r
\r
private static final long serialVersionUID = -4031644009579840277L;\r
return handler.getReasonPhrase();\r
}\r
\r
+ /**\r
+ * Does nothing in Service Proxy context\r
+ */\r
@Override\r
public void setSearchCommand(Pazpar2Command command) {\r
// Do nothing, Service Proxy is handling this \r
return clone;\r
}\r
\r
+ /**\r
+ * Returns default configuration parameters for the client.\r
+ */\r
@Override\r
public Map<String, String> getDefaults() { \r
return new HashMap<String,String>();\r
}\r
\r
+ /**\r
+ * Returns the configuration name of the client\r
+ */\r
@Override\r
public String getModuleName() {\r
return MODULENAME;\r
return commandResponse; \r
}\r
\r
+ /**\r
+ * Sets the URL of the Service Proxy that should service requests. \r
+ */\r
public void setServiceUrl (String url) { \r
serviceUrl = url;\r
}\r
return serviceUrl;\r
}\r
\r
+ /**\r
+ * Returns true if a Service Proxy URL was defined yet.\r
+ */\r
@Override\r
public boolean hasServiceUrl() {\r
return serviceUrl != null && serviceUrl.length()>0;\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
\r
/**\r
- * Represents a Pazpar2 <code>bytarget</code> command\r
+ * Represents a Pazpar2 <code>bytarget</code> command, can be accessed by <code>pzreq.bytarget</code>\r
* \r
* @author Niels Erik\r
*\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
\r
/**\r
- * Represents a Pazpar2 <code>init</code> command.\r
+ * Represents a Pazpar2 <code>init</code> command, can be accessed by <code>pzreq.init</code>\r
* \r
* @author Niels Erik\r
*\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
\r
/**\r
- * Represents a Pazpar2 <code>ping</code> command.\r
+ * Represents a Pazpar2 <code>ping</code> command, , can be accessed by <code>pzreq.init</code>\r
* \r
* @author Niels Erik\r
*\r
import com.indexdata.mkjsf.pazpar2.data.ResponseParser;\r
\r
/**\r
- * Represents a Pazpar2 <code>record</code> command. \r
+ * Represents a Pazpar2 <code>record</code> command, can be accessed by <code>pzreq.record</code>\r
* \r
* @author Niels Erik\r
*\r
super("record");\r
}\r
\r
+ /**\r
+ * Special handling of record responses since they come in three distinctly different ways\r
+ * <ol>\r
+ * <li>As a regular <record> document</li>\r
+ * <li>In arbitrary XML format, in case of an offset request to get the native format</li>\r
+ * <li>In binary (non XML) format</li>\r
+ * </ol> \r
+ */\r
@Override\r
public ResponseDataObject run() {\r
ResponseDataObject responseObject = null;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
/**\r
- * Represents a Pazpar2 <code>search</code> command. \r
+ * Represents a Pazpar2 <code>search</code> command, can be accessed by <code>pzreq.search</code> \r
* \r
* @author Niels Erik\r
*\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
\r
/**\r
- * Represents a Pazpar2 <code>settings</code> command. \r
+ * Represents a Pazpar2 <code>settings</code> command, can be accessed by <code>pzreq.settings</code>\r
* \r
* @author Niels Erik\r
*\r
\r
\r
/**\r
- * Represents a Pazpar2 <code>show</code> command. \r
+ * Represents a Pazpar2 <code>show</code> command, can be accessed by <code>pzreq.show</code> \r
* \r
* @author Niels Erik\r
*\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
\r
/**\r
- * Represents a Pazpar2 <code>stat</code> command. \r
+ * Represents a Pazpar2 <code>stat</code> command, can be accessed by <code>pzreq.state</code>\r
* \r
* @author Niels Erik\r
*\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
\r
/**\r
- * Represents a Pazpar2 <code>termlist</code> command. \r
+ * Represents a Pazpar2 <code>termlist</code> command, can be accessed by <code>pzreq.termlist</code> \r
* \r
* @author Niels Erik\r
*\r
import com.indexdata.mkjsf.pazpar2.data.sp.SpResponseDataObject;\r
\r
/**\r
- * Represents a Service Proxy <code>auth</code> command. \r
+ * Represents a Service Proxy <code>auth</code> command, can be accessed by <code>pzreq.sp.auth</code> \r
* \r
* <p>Authenticates a user against a Pazpar2 Service Proxy</p>\r
* \r
import com.indexdata.mkjsf.pazpar2.data.sp.CategoriesResponse;\r
\r
/**\r
- * Represents a Service Proxy <code>categories</code> command.\r
+ * Represents a Service Proxy <code>categories</code> command, can be accessed by <code>pzreq.sp.categories</code>\r
* \r
* <p>Retrieves target categories available to the current Service Proxy user.</p> \r
* <p>Target categories can be used to limit a search to resources tagged with the given \r
import com.indexdata.mkjsf.pazpar2.commands.RecordCommand;\r
\r
/**\r
- * Service Proxy extensions to the Papzar2 <code>record</code> command. \r
+ * Service Proxy extensions to the Papzar2 <code>record</code> command, \r
+ * these parameters being accessible by <code>pzreq.record.sp.[parameter]</code>\r
* \r
* @author Niels Erik\r
*\r
+++ /dev/null
-package com.indexdata.mkjsf.pazpar2.data;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
-import com.indexdata.mkjsf.pazpar2.data.Target;\r
-\r
-public class ByTarget extends ResponseDataObject {\r
-\r
- private static final long serialVersionUID = 3960644950805644518L;\r
- \r
- public List<Target> getTargets() {\r
- List<Target> targets = new ArrayList<Target>();\r
- if (getElements("target") != null) {\r
- for (ResponseDataObject element : getElements("target")) {\r
- targets.add((Target)element);\r
- }\r
- }\r
- return targets;\r
- }\r
-}\r
--- /dev/null
+package com.indexdata.mkjsf.pazpar2.data;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
+import com.indexdata.mkjsf.pazpar2.data.Target;\r
+\r
+/**\r
+ * Data from the <code>bytarget</code> command, can be accessed by <code>pzresp.byTarget</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
+public class ByTargetResponse extends ResponseDataObject {\r
+\r
+ private static final long serialVersionUID = 3960644950805644518L;\r
+ \r
+ public List<Target> getTargets() {\r
+ List<Target> targets = new ArrayList<Target>();\r
+ if (getElements("target") != null) {\r
+ for (ResponseDataObject element : getElements("target")) {\r
+ targets.add((Target)element);\r
+ }\r
+ }\r
+ return targets;\r
+ }\r
+}\r
import com.indexdata.mkjsf.pazpar2.data.Location;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>show</code> command, child object of ShowResponse, can be accessed by <code>pzresp.show.hits</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class Hit extends ResponseDataObject {\r
\r
\r
package com.indexdata.mkjsf.pazpar2.data;\r
\r
+/**\r
+ * Data from the <code>init</code> command, can be accessed by <code>pzresp.init</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class InitResponse extends ResponseDataObject {\r
\r
private static final long serialVersionUID = -1479775157276901600L;\r
\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
-\r
+/**\r
+ * Data from the <code>show</code> command, child object of Hit\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class Location extends ResponseDataObject {\r
\r
private static final long serialVersionUID = -1386527442857478225L;\r
+++ /dev/null
-package com.indexdata.mkjsf.pazpar2.data;\r
-\r
-public class RecordOffsetResponse extends ResponseDataObject {\r
-\r
- private static final long serialVersionUID = -601620728296476450L;\r
-\r
- \r
-}\r
import com.indexdata.mkjsf.pazpar2.data.Location;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>record</code> command, can be accessed by <code>pzresp.record</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class RecordResponse extends ResponseDataObject {\r
\r
private static final long serialVersionUID = 6682722004285796002L;\r
\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Parent class of all response data objects, with generic methods for retrieving data elements\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class ResponseDataObject implements Serializable {\r
\r
Logger logger = Logger.getLogger(ResponseDataObject.class);\r
return attributes.get(name);\r
}\r
\r
+ /**\r
+ * Used by the response XML parser to add child element objects to a parent element object\r
+ * \r
+ * @param name of the child element\r
+ * @param value the child object itself\r
+ */\r
public void addElement (String name, ResponseDataObject value) { \r
if (elements.containsKey(name)) {\r
elements.get(name).add(value);\r
}\r
}\r
\r
+ /**\r
+ * Returns string array with the values of the named element(s)\r
+ * \r
+ * @param name of the child object(s) to retrieve value(s) from\r
+ * @return\r
+ */\r
public String[] getValueArray (String name) {\r
List<ResponseDataObject> elements = getElements(name);\r
String[] valueArray = {};\r
import com.indexdata.mkjsf.pazpar2.data.sp.CategoriesResponse;\r
import com.indexdata.mkjsf.pazpar2.data.sp.TargetCategory;\r
\r
+/**\r
+ * Parses the XML stored in ClientCommandResponses and builds ResponseDataObjects from it.\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class ResponseParser extends DefaultHandler {\r
\r
private XMLReader xmlReader = null;\r
} else if (localName.equals("record")) {\r
currentElement = new RecordResponse(); \r
} else if (localName.equals("bytarget")) {\r
- currentElement = new ByTarget(); \r
+ currentElement = new ByTargetResponse(); \r
} else if (localName.equals("target")) {\r
currentElement = new Target();\r
} else if (localName.equals("stat")) {\r
import com.indexdata.mkjsf.pazpar2.data.sp.SpResponses;\r
import com.indexdata.mkjsf.utils.Utils;\r
\r
+/**\r
+ * Provides references to all current data objects and has general methods for clearing certain response data.\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
@SessionScoped @Named\r
public class Responses implements Serializable {\r
\r
return error; \r
}\r
\r
+ /**\r
+ * Empties all data objects populated after a search (including the search response itself)\r
+ * \r
+ */\r
public void resetSearchAndBeyond() {\r
logger.debug("Resetting show,stat,termlist,bytarget,record,search response objects.");\r
dataObjects.put("show", new ShowResponse());\r
dataObjects.put("stat", new StatResponse());\r
dataObjects.put("termlist", new TermListsResponse());\r
- dataObjects.put("bytarget", new ByTarget());\r
+ dataObjects.put("bytarget", new ByTargetResponse());\r
dataObjects.put("record", new RecordResponse());\r
dataObjects.put("search", new SearchResponse());\r
getSp().resetSearchAndBeyond(false);\r
}\r
\r
+ /**\r
+ * Empties all data objects populated after a service was initialized, including the init response itself\r
+ * but excluding a possible auth response\r
+ */\r
public void resetInitAndBeyond () {\r
dataObjects.put("init", new InitResponse()); \r
resetSearchAndBeyond();\r
return (getTermLists().getTermList(facet).getTerms());\r
}\r
\r
- public ByTarget getByTarget() {\r
- return ((ByTarget) dataObjects.get("bytarget"));\r
+ public ByTargetResponse getByTarget() {\r
+ return ((ByTargetResponse) dataObjects.get("bytarget"));\r
}\r
\r
public ResponseDataObject getResponseObject (String name) {\r
package com.indexdata.mkjsf.pazpar2.data;\r
\r
+/**\r
+ * Data from the <code>search</code> command (a status message), can be accessed by <code>pzresp.search</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class SearchResponse extends ResponseDataObject {\r
\r
private static final long serialVersionUID = -3320013021497018972L;\r
import com.indexdata.mkjsf.pazpar2.data.Hit;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>show</code> command, can be accessed by <code>pzresp.show</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class ShowResponse extends ResponseDataObject {\r
\r
private static final long serialVersionUID = 7103554232106330370L;\r
\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>stat</code> command, can be accessed by <code>pzresp.stat</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class StatResponse extends ResponseDataObject {\r
\r
private static final long serialVersionUID = -6578979787689458761L;\r
\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>bytarget</code> command, child object of ByTargetResponse\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class Target extends ResponseDataObject {\r
\r
private static final long serialVersionUID = 3343881183545520108L;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
import com.indexdata.mkjsf.pazpar2.data.TermListResponse;\r
import com.indexdata.mkjsf.pazpar2.data.TermResponse;\r
-\r
+/**\r
+ * Data from the <code>termlist</code> command, child object of TermListsResponse\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class TermListResponse extends ResponseDataObject {\r
\r
private static Logger logger = Logger.getLogger(TermListResponse.class);\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
import com.indexdata.mkjsf.pazpar2.data.TermListResponse;\r
\r
+/**\r
+ * Data from the <code>termlist</code> command, can be accessed by <code>pzresp.termLists</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class TermListsResponse extends ResponseDataObject {\r
\r
private static final long serialVersionUID = -1370643625715834978L;\r
\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>termlist</code> command, child object of TermListResponse\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class TermResponse extends ResponseDataObject {\r
\r
private static final long serialVersionUID = -8323959763575180678L;\r
\r
import com.indexdata.mkjsf.pazpar2.data.TermResponse;\r
\r
+/**\r
+ * Data from the <code>termlist</code> command, child object of TermListResponse\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class TermXTargetResponse extends TermResponse {\r
\r
private static final long serialVersionUID = 5201902652960804977L;\r
return getOneElement("id").getValue();\r
}\r
public int getApproximation () {\r
- return Integer.parseInt(getOneElement("approximation").getValue());\r
+ return Integer.parseInt(getOneValue("approximation"));\r
}\r
public int getRecords () {\r
- return Integer.parseInt(getOneElement("records").getValue());\r
+ return Integer.parseInt(getOneValue("records"));\r
}\r
public int getFiltered () {\r
- return Integer.parseInt(getOneElement("filtered").getValue());\r
+ return Integer.parseInt(getOneValue("filtered"));\r
}\r
public String getState () {\r
- return getOneElement("state").getValue();\r
+ return getOneValue("state");\r
}\r
public String getDiagnostic () {\r
- return getOneElement("diagnostic").getValue();\r
+ return getOneValue("diagnostic");\r
}\r
\r
}\r
--- /dev/null
+/**\r
+ * Pazpar2 responses produced by Pazpar2 commands are parsed by the\r
+ * ResponseParser found in this package, the output being response data\r
+ * objects accessible to the UI. \r
+ * \r
+ * <p>The most recent responses from each command are accessible to the UI\r
+ * through the class Responses which is exposed to the UI as <code>pzresp</code></p>\r
+ * \r
+ * <p>Examples:</p>\r
+ * <ul>\r
+ * <li><code>pzresp.show.hits<code> returns a list of hits from the most recent show command</li>\r
+ * <li><code>pzresp.show.hits.[0]</code> returns the first hit</li>\r
+ * <li><code>pzresp.show.hits.[0].author</code> returns the author attribute of the first hit</li>\r
+ * <li><code>pzresp.show.hits.[0].getOneValue("my-hit-field")</code> returns an arbitrary attribute of the data object</li>\r
+ * </ul> \r
+ * \r
+ */\r
+package com.indexdata.mkjsf.pazpar2.data;
\ No newline at end of file
package com.indexdata.mkjsf.pazpar2.data.sp;\r
\r
+/**\r
+ * Data from the <code>auth</code> command, can be accessed by <code>pzresp.sp.auth</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class AuthResponse extends SpResponseDataObject {\r
\r
private static final long serialVersionUID = 8006774126022849936L;\r
\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>categories</code> command, can be accessed by <code>pzresp.sp.categories</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
@SessionScoped\r
public class CategoriesResponse extends SpResponseDataObject {\r
\r
\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
\r
+/**\r
+ * Data from the <code>categories</code> command, can be accessed by <code>pzresp.sp.categories.targetCategories</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class TargetCategory extends ResponseDataObject {\r
\r
private static final long serialVersionUID = -3027515807117682584L;\r
/**\r
* Overall control and execution of search logic. \r
* <p>\r
- * Classes in this package selects a service type and controls and performs \r
- * the actual execution of commands against the selected service, eventually producing \r
- * ClientCommandResponses for further processing elsewhere. \r
+ * Classes in this package are used for defining a service type, setting a service URL\r
+ * and controlling and executing commands against the selected service, \r
+ * eventually producing ClientCommandResponses for further processing elsewhere. \r
* </p> \r
*/\r
package com.indexdata.mkjsf.pazpar2;
\ No newline at end of file