From f8e3b4201cef8e9ce03109b17ce8047a98b43e39 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Thu, 9 May 2013 09:10:54 -0400 Subject: [PATCH] Changes response object naming .. to better distinguish between the simple http response wrapper and the SAX parsed response data objects --- .../com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java | 2 +- .../java/com/indexdata/mkjsf/pazpar2/CommandResponse.java | 9 --------- src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java | 4 ++-- .../java/com/indexdata/mkjsf/pazpar2/HttpResponseWrapper.java | 9 +++++++++ src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java | 2 +- src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java | 2 +- src/main/java/com/indexdata/mkjsf/pazpar2/SearchClient.java | 2 +- .../java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java | 2 +- src/main/java/com/indexdata/mkjsf/utils/FileUpload.java | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/CommandResponse.java create mode 100644 src/main/java/com/indexdata/mkjsf/pazpar2/HttpResponseWrapper.java diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java index 0375ca1..6e0d9e3 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/ClientCommandResponse.java @@ -5,7 +5,7 @@ import java.io.UnsupportedEncodingException; import com.indexdata.masterkey.pazpar2.client.Pazpar2HttpResponse; -public class ClientCommandResponse implements CommandResponse { +public class ClientCommandResponse implements HttpResponseWrapper { private int statusCode; private String contentType; 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 index 573015f..0000000 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandResponse.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.indexdata.mkjsf.pazpar2; - -public interface CommandResponse { - public int getStatusCode(); - public String getContentType(); - public String getResponseString(); - public byte[] getBytes(); - public boolean isBinary(); -} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java b/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java index e3169b9..1225116 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/CommandThread.java @@ -9,7 +9,7 @@ public class CommandThread extends Thread { private static Logger logger = Logger.getLogger(CommandThread.class); Pazpar2Command command; SearchClient client; - CommandResponse commandResponse = null; + HttpResponseWrapper commandResponse = null; public CommandThread (Pazpar2Command command, SearchClient client) { this.command = command; @@ -41,7 +41,7 @@ public class CommandThread extends Thread { * * @return Pazpar2 response as an XML string, possibly a generated error XML */ - public CommandResponse getCommandResponse () { + public HttpResponseWrapper getCommandResponse () { return commandResponse; } 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 index 0000000..c91aab9 --- /dev/null +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/HttpResponseWrapper.java @@ -0,0 +1,9 @@ +package com.indexdata.mkjsf.pazpar2; + +public interface HttpResponseWrapper { + public int getStatusCode(); + public String getContentType(); + public String getResponseString(); + public byte[] getBytes(); + public boolean isBinary(); +} diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java index 03bd096..1ca0709 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java @@ -162,7 +162,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria } for (CommandThread thread : threadList) { String commandName = thread.getCommand().getCommandName(); - CommandResponse response = thread.getCommandResponse(); + HttpResponseWrapper response = thread.getCommandResponse(); responseLogger.debug("Response was: " + response.getResponseString()); Pazpar2ResponseData responseObject = Pazpar2ResponseParser.getParser().getDataObject(response.getResponseString()); if (Pazpar2ResponseParser.docTypes.contains(responseObject.getType())) { diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java index 2bfb52b..cbdcf6b 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java @@ -89,7 +89,7 @@ public class Pz2Client implements SearchClient { } @Override - public CommandResponse executeCommand(Pazpar2Command command) { + public HttpResponseWrapper executeCommand(Pazpar2Command command) { ClientCommandResponse commandResponse = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); ClientCommand clientCommand = new ClientCommand(command.getCommandName(), command.getEncodedQueryString()); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/SearchClient.java b/src/main/java/com/indexdata/mkjsf/pazpar2/SearchClient.java index 745a6b6..e50d498 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/SearchClient.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/SearchClient.java @@ -9,7 +9,7 @@ import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; public interface SearchClient extends Configurable, Serializable { public void setSearchCommand(Pazpar2Command command); - public CommandResponse executeCommand(Pazpar2Command command); + public HttpResponseWrapper executeCommand(Pazpar2Command command); // Use cloneMe() method if injecting the client with CDI. // The client is used for asynchronously sending off requests diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java index a43432e..1f68715 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java @@ -205,7 +205,7 @@ public class ServiceProxyClient implements SearchClient { } @Override - public CommandResponse executeCommand(Pazpar2Command command) { + public HttpResponseWrapper executeCommand(Pazpar2Command command) { return send(command); } diff --git a/src/main/java/com/indexdata/mkjsf/utils/FileUpload.java b/src/main/java/com/indexdata/mkjsf/utils/FileUpload.java index 493102e..71598f2 100644 --- a/src/main/java/com/indexdata/mkjsf/utils/FileUpload.java +++ b/src/main/java/com/indexdata/mkjsf/utils/FileUpload.java @@ -10,12 +10,12 @@ import org.apache.commons.io.FilenameUtils; import org.apache.log4j.Logger; import org.apache.myfaces.custom.fileupload.UploadedFile; -import com.indexdata.mkjsf.pazpar2.CommandResponse; +import com.indexdata.mkjsf.pazpar2.HttpResponseWrapper; public abstract class FileUpload implements Serializable { protected UploadedFile uploadedFile; - protected CommandResponse response; + protected HttpResponseWrapper response; private static Logger logger = Logger.getLogger(FileUpload.class); private static final long serialVersionUID = 748784638056392862L; -- 1.7.10.4