From 86f289cd42ba95846c80d22129ed565e4e9d6dde Mon Sep 17 00:00:00 2001
From: "Niels Erik G. Nielsen" Some of the other know parameters in this format could be: Some of the other known parameters in this format could be:pz2client.PAZPAR2_URL = http://localhost:8004/
*
- *
* service.TYPE = SP
@@ -89,7 +89,7 @@
* and inject that class in beans.xml instead of any of the two predefined options. The extended
* class must construct a Configuration object -- which is basically a set of key-value pairs --
* and then set the desired values and hand it off to the Configurable (currently Pz2Service, Pz2Client,
- * ServiceProxyClient
Finally it's possible to set the URL runtime even from the UI pages.
* diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java index 01444ef..ef22114 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java @@ -5,6 +5,15 @@ import java.io.UnsupportedEncodingException; import com.indexdata.masterkey.pazpar2.client.Pazpar2HttpResponse; +/** + * Contains one HTTP response to a command executed against a Pazpar2 service in such a + * way as to give the response parser a common interface to responses, whether + * they are from Pazpar2, from the Service Proxy, or are error messages created + * by the JSF application during processing. + * + * @author Niels Erik + * + */ public class ClientCommandResponse implements HttpResponseWrapper { private int statusCode; @@ -13,18 +22,38 @@ public class ClientCommandResponse implements HttpResponseWrapper { private String contentString = null; private byte[] bytesForParsing = null; + /** + * Used for storing Pazpar2 based response + * + * @param pz2response + * @param content + */ public ClientCommandResponse(Pazpar2HttpResponse pz2response, ByteArrayOutputStream content) { this.content = content.toByteArray(); this.statusCode = pz2response.getStatusCode(); this.contentType = pz2response.getContentType(); } + /** + * Used for storing error response + * + * @param statusCode + * @param content + * @param contentType + */ public ClientCommandResponse(int statusCode, String content, String contentType) { this.statusCode = statusCode; this.contentString = content; this.contentType = contentType; } + /** + * Used for storing Service Proxy based response + * + * @param statusCode + * @param content + * @param contentType + */ public ClientCommandResponse(int statusCode, byte[] content, String contentType) { this.statusCode = statusCode; this.content = content; @@ -41,6 +70,9 @@ public class ClientCommandResponse implements HttpResponseWrapper { return contentType; } + /** + * Gets the response as a String - unless the response is marked as binary + */ @Override public String getResponseString() { if (content == null) { @@ -62,6 +94,13 @@ public class ClientCommandResponse implements HttpResponseWrapper { return content; } + /** + * Overrides the original response with a modified response. Used for + * one instance of a response that is not named by the command that + * created it - such as the parser expects. + * + * @param parseString + */ public void setResponseToParse(String parseString) { try { this.bytesForParsing = parseString.getBytes("UTF-8"); @@ -70,6 +109,10 @@ public class ClientCommandResponse implements HttpResponseWrapper { } } + /** + * Used by the parser to get the response for further processing. + * @return + */ public byte[] getResponseToParse() { if (bytesForParsing != null) { return bytesForParsing; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java b/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java index 7ebdf9f..678e4a6 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java @@ -5,6 +5,13 @@ import org.apache.log4j.Logger; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; import com.indexdata.mkjsf.pazpar2.data.Responses; +/** + * Helper class for running multiple concurrent Pazpar2 commands. Basically + * used for updating display data (show,stat,bytarget,termlist) together. + * + * @author Niels Erik + * + */ public class CommandThread extends Thread { private static Logger logger = Logger.getLogger(CommandThread.class); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java index 6dfe77f..3417a47 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java @@ -27,6 +27,20 @@ import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; import com.indexdata.mkjsf.pazpar2.data.CommandError; import com.indexdata.mkjsf.utils.Utils; +/** + * Search client handling straight Pazpar2 requests. + * + *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. + * + * @author Niels Erik + * + */ public class Pz2Client implements SearchClient { private static final long serialVersionUID = 5414266730169982028L; @@ -88,6 +102,13 @@ public class Pz2Client implements SearchClient { client.setSearchCommand(clientCommand); } + /** + * Runs the give Pazpar2 command and returns a response wrapper with either the received response or + * with some form of error message. + * + * It is intended that this method never throws an exception. All events are supposed to be captured and + * returned in some form of response. + */ @Override public HttpResponseWrapper executeCommand(Pazpar2Command command) { ClientCommandResponse commandResponse = null; @@ -132,7 +153,7 @@ public class Pz2Client implements SearchClient { commandResponse = new ClientCommandResponse(0,CommandError.createErrorXml(command.getCommandName(), "", "ServiceError", e.getMessage(),""),"text/xml"); } long end = System.currentTimeMillis(); - logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." ); + logger.info("Executed " + command.getCommandName() + " in " + (end-start) + " ms." ); return commandResponse; } @@ -144,11 +165,17 @@ public class Pz2Client implements SearchClient { return clone; } + /** + * Returns default configuration parameters for the client. + */ @Override public Mapbytarget
command
+ * Represents a Pazpar2 bytarget
command, can be accessed by pzreq.bytarget
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java
index e98a5cf..ab2e5a1 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java
@@ -6,7 +6,7 @@ import com.indexdata.mkjsf.pazpar2.commands.sp.InitCommandSp;
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;
/**
- * Represents a Pazpar2 init
command.
+ * Represents a Pazpar2 init
command, can be accessed by pzreq.init
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java
index 6d3d024..a695746 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java
@@ -3,7 +3,7 @@ package com.indexdata.mkjsf.pazpar2.commands;
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;
/**
- * Represents a Pazpar2 ping
command.
+ * Represents a Pazpar2 ping
command, , can be accessed by pzreq.init
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java
index d453b75..8cc039d 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java
@@ -12,7 +12,7 @@ import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
import com.indexdata.mkjsf.pazpar2.data.ResponseParser;
/**
- * Represents a Pazpar2 record
command.
+ * Represents a Pazpar2 record
command, can be accessed by pzreq.record
*
* @author Niels Erik
*
@@ -27,6 +27,14 @@ public class RecordCommand extends Pazpar2Command implements ServiceProxyCommand
super("record");
}
+ /**
+ * Special handling of record responses since they come in three distinctly different ways
+ * search
command.
+ * Represents a Pazpar2 search
command, can be accessed by pzreq.search
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java
index e2b8d29..ebef90f 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java
@@ -3,7 +3,7 @@ package com.indexdata.mkjsf.pazpar2.commands;
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;
/**
- * Represents a Pazpar2 settings
command.
+ * Represents a Pazpar2 settings
command, can be accessed by pzreq.settings
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java
index a24172a..04a87d8 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java
@@ -4,7 +4,7 @@ import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;
/**
- * Represents a Pazpar2 show
command.
+ * Represents a Pazpar2 show
command, can be accessed by pzreq.show
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java
index b415ec4..5229060 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java
@@ -3,7 +3,7 @@ package com.indexdata.mkjsf.pazpar2.commands;
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;
/**
- * Represents a Pazpar2 stat
command.
+ * Represents a Pazpar2 stat
command, can be accessed by pzreq.state
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java
index adb84a3..6f3c662 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java
@@ -3,7 +3,7 @@ package com.indexdata.mkjsf.pazpar2.commands;
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;
/**
- * Represents a Pazpar2 termlist
command.
+ * Represents a Pazpar2 termlist
command, can be accessed by pzreq.termlist
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java
index 67780e5..75d46aa 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java
@@ -10,7 +10,7 @@ import com.indexdata.mkjsf.pazpar2.data.ResponseParser;
import com.indexdata.mkjsf.pazpar2.data.sp.SpResponseDataObject;
/**
- * Represents a Service Proxy auth
command.
+ * Represents a Service Proxy auth
command, can be accessed by pzreq.sp.auth
*
* Authenticates a user against a Pazpar2 Service Proxy
* diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java index 756f85c..e94ce26 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java @@ -7,7 +7,7 @@ import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; import com.indexdata.mkjsf.pazpar2.data.sp.CategoriesResponse; /** - * Represents a Service Proxycategories
command.
+ * Represents a Service Proxy categories
command, can be accessed by pzreq.sp.categories
*
* Retrieves target categories available to the current Service Proxy user.
*Target categories can be used to limit a search to resources tagged with the given
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java
index e1b94d8..0b40381 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java
@@ -6,7 +6,8 @@ import com.indexdata.mkjsf.pazpar2.commands.CommandParameter;
import com.indexdata.mkjsf.pazpar2.commands.RecordCommand;
/**
- * Service Proxy extensions to the Papzar2 The most recent responses from each command are accessible to the UI
+ * through the class Responses which is exposed to the UI as Examples:
- * Classes in this package selects a service type and controls and performs
- * the actual execution of commands against the selected service, eventually producing
- * ClientCommandResponses for further processing elsewhere.
+ * Classes in this package are used for defining a service type, setting a service URL
+ * and controlling and executing commands against the selected service,
+ * eventually producing ClientCommandResponses for further processing elsewhere.
* record
command.
+ * Service Proxy extensions to the Papzar2 record
command,
+ * these parameters being accessible by pzreq.record.sp.[parameter]
*
* @author Niels Erik
*
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ByTarget.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ByTarget.java
deleted file mode 100644
index b98bf1a..0000000
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ByTarget.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.indexdata.mkjsf.pazpar2.data;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
-import com.indexdata.mkjsf.pazpar2.data.Target;
-
-public class ByTarget extends ResponseDataObject {
-
- private static final long serialVersionUID = 3960644950805644518L;
-
- public Listbytarget
command, can be accessed by pzresp.byTarget
+ *
+ * @author Niels Erik
+ *
+ */
+public class ByTargetResponse extends ResponseDataObject {
+
+ private static final long serialVersionUID = 3960644950805644518L;
+
+ public Listshow
command, child object of ShowResponse, can be accessed by pzresp.show.hits
+ *
+ * @author Niels Erik
+ *
+ */
public class Hit extends ResponseDataObject {
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java
index 76eda96..370e949 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/InitResponse.java
@@ -1,5 +1,11 @@
package com.indexdata.mkjsf.pazpar2.data;
+/**
+ * Data from the init
command, can be accessed by pzresp.init
+ *
+ * @author Niels Erik
+ *
+ */
public class InitResponse extends ResponseDataObject {
private static final long serialVersionUID = -1479775157276901600L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java
index 19b1dcf..8cbfb90 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Location.java
@@ -2,7 +2,12 @@ package com.indexdata.mkjsf.pazpar2.data;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
-
+/**
+ * Data from the show
command, child object of Hit
+ *
+ * @author Niels Erik
+ *
+ */
public class Location extends ResponseDataObject {
private static final long serialVersionUID = -1386527442857478225L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordOffsetResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordOffsetResponse.java
deleted file mode 100644
index d8920b0..0000000
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordOffsetResponse.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.indexdata.mkjsf.pazpar2.data;
-
-public class RecordOffsetResponse extends ResponseDataObject {
-
- private static final long serialVersionUID = -601620728296476450L;
-
-
-}
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java
index b1de2da..85fdc9a 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/RecordResponse.java
@@ -6,6 +6,12 @@ import java.util.List;
import com.indexdata.mkjsf.pazpar2.data.Location;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Data from the record
command, can be accessed by pzresp.record
+ *
+ * @author Niels Erik
+ *
+ */
public class RecordResponse extends ResponseDataObject {
private static final long serialVersionUID = 6682722004285796002L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java
index 535f859..5e2d639 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ResponseDataObject.java
@@ -9,6 +9,12 @@ import org.apache.log4j.Logger;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Parent class of all response data objects, with generic methods for retrieving data elements
+ *
+ * @author Niels Erik
+ *
+ */
public class ResponseDataObject implements Serializable {
Logger logger = Logger.getLogger(ResponseDataObject.class);
@@ -38,6 +44,12 @@ public class ResponseDataObject implements Serializable {
return attributes.get(name);
}
+ /**
+ * Used by the response XML parser to add child element objects to a parent element object
+ *
+ * @param name of the child element
+ * @param value the child object itself
+ */
public void addElement (String name, ResponseDataObject value) {
if (elements.containsKey(name)) {
elements.get(name).add(value);
@@ -74,6 +86,12 @@ public class ResponseDataObject implements Serializable {
}
}
+ /**
+ * Returns string array with the values of the named element(s)
+ *
+ * @param name of the child object(s) to retrieve value(s) from
+ * @return
+ */
public String[] getValueArray (String name) {
Listsearch
command (a status message), can be accessed by pzresp.search
+ *
+ * @author Niels Erik
+ *
+ */
public class SearchResponse extends ResponseDataObject {
private static final long serialVersionUID = -3320013021497018972L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java
index c845c3a..a8d10c8 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/ShowResponse.java
@@ -6,6 +6,12 @@ import java.util.List;
import com.indexdata.mkjsf.pazpar2.data.Hit;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Data from the show
command, can be accessed by pzresp.show
+ *
+ * @author Niels Erik
+ *
+ */
public class ShowResponse extends ResponseDataObject {
private static final long serialVersionUID = 7103554232106330370L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java
index b5acf0f..4f44f77 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/StatResponse.java
@@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.data;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Data from the stat
command, can be accessed by pzresp.stat
+ *
+ * @author Niels Erik
+ *
+ */
public class StatResponse extends ResponseDataObject {
private static final long serialVersionUID = -6578979787689458761L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java
index 8942662..b82f74b 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/Target.java
@@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.data;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Data from the bytarget
command, child object of ByTargetResponse
+ *
+ * @author Niels Erik
+ *
+ */
public class Target extends ResponseDataObject {
private static final long serialVersionUID = 3343881183545520108L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java
index b4c4fb3..d1755c7 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListResponse.java
@@ -8,7 +8,12 @@ import org.apache.log4j.Logger;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
import com.indexdata.mkjsf.pazpar2.data.TermListResponse;
import com.indexdata.mkjsf.pazpar2.data.TermResponse;
-
+/**
+ * Data from the termlist
command, child object of TermListsResponse
+ *
+ * @author Niels Erik
+ *
+ */
public class TermListResponse extends ResponseDataObject {
private static Logger logger = Logger.getLogger(TermListResponse.class);
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java
index 8558e32..dd0ffa6 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermListsResponse.java
@@ -6,6 +6,12 @@ import java.util.Map;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
import com.indexdata.mkjsf.pazpar2.data.TermListResponse;
+/**
+ * Data from the termlist
command, can be accessed by pzresp.termLists
+ *
+ * @author Niels Erik
+ *
+ */
public class TermListsResponse extends ResponseDataObject {
private static final long serialVersionUID = -1370643625715834978L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java
index 9c3ddb1..3a0c2d8 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermResponse.java
@@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.data;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Data from the termlist
command, child object of TermListResponse
+ *
+ * @author Niels Erik
+ *
+ */
public class TermResponse extends ResponseDataObject {
private static final long serialVersionUID = -8323959763575180678L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermXTargetResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermXTargetResponse.java
index c244516..a7e6f36 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermXTargetResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/TermXTargetResponse.java
@@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.data;
import com.indexdata.mkjsf.pazpar2.data.TermResponse;
+/**
+ * Data from the termlist
command, child object of TermListResponse
+ *
+ * @author Niels Erik
+ *
+ */
public class TermXTargetResponse extends TermResponse {
private static final long serialVersionUID = 5201902652960804977L;
@@ -10,19 +16,19 @@ public class TermXTargetResponse extends TermResponse {
return getOneElement("id").getValue();
}
public int getApproximation () {
- return Integer.parseInt(getOneElement("approximation").getValue());
+ return Integer.parseInt(getOneValue("approximation"));
}
public int getRecords () {
- return Integer.parseInt(getOneElement("records").getValue());
+ return Integer.parseInt(getOneValue("records"));
}
public int getFiltered () {
- return Integer.parseInt(getOneElement("filtered").getValue());
+ return Integer.parseInt(getOneValue("filtered"));
}
public String getState () {
- return getOneElement("state").getValue();
+ return getOneValue("state");
}
public String getDiagnostic () {
- return getOneElement("diagnostic").getValue();
+ return getOneValue("diagnostic");
}
}
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/package-info.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/package-info.java
new file mode 100644
index 0000000..d217761
--- /dev/null
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/package-info.java
@@ -0,0 +1,18 @@
+/**
+ * Pazpar2 responses produced by Pazpar2 commands are parsed by the
+ * ResponseParser found in this package, the output being response data
+ * objects accessible to the UI.
+ *
+ * pzresp
+ *
+ *
+ */
+package com.indexdata.mkjsf.pazpar2.data;
\ No newline at end of file
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/AuthResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/AuthResponse.java
index 334bd15..8b8351c 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/AuthResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/AuthResponse.java
@@ -1,5 +1,11 @@
package com.indexdata.mkjsf.pazpar2.data.sp;
+/**
+ * Data from the pzresp.show.hits
returns a list of hits from the most recent show command
pzresp.show.hits.[0]
returns the first hitpzresp.show.hits.[0].author
returns the author attribute of the first hitpzresp.show.hits.[0].getOneValue("my-hit-field")
returns an arbitrary attribute of the data objectauth
command, can be accessed by pzresp.sp.auth
+ *
+ * @author Niels Erik
+ *
+ */
public class AuthResponse extends SpResponseDataObject {
private static final long serialVersionUID = 8006774126022849936L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/CategoriesResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/CategoriesResponse.java
index 2f7ede9..efd2d5b 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/CategoriesResponse.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/CategoriesResponse.java
@@ -7,6 +7,12 @@ import javax.enterprise.context.SessionScoped;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Data from the categories
command, can be accessed by pzresp.sp.categories
+ *
+ * @author Niels Erik
+ *
+ */
@SessionScoped
public class CategoriesResponse extends SpResponseDataObject {
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/TargetCategory.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/TargetCategory.java
index fd00a23..56f5606 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/TargetCategory.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/sp/TargetCategory.java
@@ -2,6 +2,12 @@ package com.indexdata.mkjsf.pazpar2.data.sp;
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;
+/**
+ * Data from the categories
command, can be accessed by pzresp.sp.categories.targetCategories
+ *
+ * @author Niels Erik
+ *
+ */
public class TargetCategory extends ResponseDataObject {
private static final long serialVersionUID = -3027515807117682584L;
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/package-info.java b/src/main/java/com/indexdata/mkjsf/pazpar2/package-info.java
index 640b810..b8e931a 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/package-info.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/package-info.java
@@ -1,9 +1,9 @@
/**
* Overall control and execution of search logic.
*