Changes response object naming
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Thu, 9 May 2013 13:10:54 +0000 (09:10 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Thu, 9 May 2013 13:10:54 +0000 (09:10 -0400)
.. to better distinguish between the simple http response wrapper
and the SAX parsed response data objects

src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java
src/main/java/com/indexdata/mkjsf/pazpar2/CommandResponse.java [deleted file]
src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java
src/main/java/com/indexdata/mkjsf/pazpar2/HttpResponseWrapper.java [new file with mode: 0644]
src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java
src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java
src/main/java/com/indexdata/mkjsf/pazpar2/SearchClient.java
src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java
src/main/java/com/indexdata/mkjsf/utils/FileUpload.java

index 0375ca1..6e0d9e3 100644 (file)
@@ -5,7 +5,7 @@ import java.io.UnsupportedEncodingException;
 \r
 import com.indexdata.masterkey.pazpar2.client.Pazpar2HttpResponse;\r
 \r
-public class ClientCommandResponse implements CommandResponse {\r
+public class ClientCommandResponse implements HttpResponseWrapper {\r
     \r
   private int statusCode;\r
   private String contentType;\r
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/CommandResponse.java
deleted file mode 100644 (file)
index 573015f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.indexdata.mkjsf.pazpar2;\r
-\r
-public interface CommandResponse {\r
-  public int getStatusCode();\r
-  public String getContentType();\r
-  public String getResponseString();\r
-  public byte[] getBytes();\r
-  public boolean isBinary();\r
-}\r
index e3169b9..1225116 100644 (file)
@@ -9,7 +9,7 @@ public class CommandThread extends Thread {
   private static Logger logger = Logger.getLogger(CommandThread.class);\r
   Pazpar2Command command;\r
   SearchClient client;\r
-  CommandResponse commandResponse = null;      \r
+  HttpResponseWrapper commandResponse = null;      \r
   \r
   public CommandThread (Pazpar2Command command, SearchClient client) {\r
     this.command = command;\r
@@ -41,7 +41,7 @@ public class CommandThread extends Thread {
    * \r
    * @return Pazpar2 response as an XML string, possibly a generated error XML\r
    */\r
-  public CommandResponse getCommandResponse () {\r
+  public HttpResponseWrapper getCommandResponse () {\r
     return commandResponse;\r
   }\r
     \r
diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/HttpResponseWrapper.java b/src/main/java/com/indexdata/mkjsf/pazpar2/HttpResponseWrapper.java
new file mode 100644 (file)
index 0000000..c91aab9
--- /dev/null
@@ -0,0 +1,9 @@
+package com.indexdata.mkjsf.pazpar2;\r
+\r
+public interface HttpResponseWrapper {\r
+  public int getStatusCode();\r
+  public String getContentType();\r
+  public String getResponseString();\r
+  public byte[] getBytes();\r
+  public boolean isBinary();\r
+}\r
index 03bd096..1ca0709 100644 (file)
@@ -162,7 +162,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria
           }\r
           for (CommandThread thread : threadList) {\r
              String commandName = thread.getCommand().getCommandName();\r
-             CommandResponse response = thread.getCommandResponse();\r
+             HttpResponseWrapper response = thread.getCommandResponse();\r
              responseLogger.debug("Response was: " + response.getResponseString());\r
              Pazpar2ResponseData responseObject = Pazpar2ResponseParser.getParser().getDataObject(response.getResponseString());\r
              if (Pazpar2ResponseParser.docTypes.contains(responseObject.getType())) {\r
index 2bfb52b..cbdcf6b 100644 (file)
@@ -89,7 +89,7 @@ public class Pz2Client implements SearchClient {
   }\r
 \r
   @Override\r
-  public CommandResponse executeCommand(Pazpar2Command command) {\r
+  public HttpResponseWrapper executeCommand(Pazpar2Command command) {\r
     ClientCommandResponse commandResponse = null;\r
     ByteArrayOutputStream baos = new ByteArrayOutputStream();\r
     ClientCommand clientCommand = new ClientCommand(command.getCommandName(), command.getEncodedQueryString());\r
index 745a6b6..e50d498 100644 (file)
@@ -9,7 +9,7 @@ import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;
 public interface SearchClient extends Configurable, Serializable {\r
   \r
   public void setSearchCommand(Pazpar2Command command);\r
-  public CommandResponse executeCommand(Pazpar2Command command);\r
+  public HttpResponseWrapper executeCommand(Pazpar2Command command);\r
   \r
   // Use cloneMe() method if injecting the client with CDI.\r
   // The client is used for asynchronously sending off requests\r
index a43432e..1f68715 100644 (file)
@@ -205,7 +205,7 @@ public class ServiceProxyClient implements SearchClient {
   }\r
 \r
   @Override\r
-  public CommandResponse executeCommand(Pazpar2Command command) {\r
+  public HttpResponseWrapper executeCommand(Pazpar2Command command) {\r
     return send(command);\r
   }\r
 \r
index 493102e..71598f2 100644 (file)
@@ -10,12 +10,12 @@ import org.apache.commons.io.FilenameUtils;
 import org.apache.log4j.Logger;\r
 import org.apache.myfaces.custom.fileupload.UploadedFile;\r
 \r
-import com.indexdata.mkjsf.pazpar2.CommandResponse;\r
+import com.indexdata.mkjsf.pazpar2.HttpResponseWrapper;\r
 \r
 public abstract class FileUpload implements Serializable {\r
 \r
   protected UploadedFile uploadedFile;\r
-  protected CommandResponse response;\r
+  protected HttpResponseWrapper response;\r
   private static Logger logger = Logger.getLogger(FileUpload.class);\r
   private static final long serialVersionUID = 748784638056392862L;\r
 \r