Simplifies state handling further
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / sp / ServiceProxyClient.java
index 5b2e518..8c2c2e2 100644 (file)
@@ -39,7 +39,6 @@ import com.indexdata.pz2utils4jsf.errors.ConfigurationException;
 import com.indexdata.pz2utils4jsf.pazpar2.CommandResponse;\r
 import com.indexdata.pz2utils4jsf.pazpar2.SearchClient;\r
 import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter;\r
-import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly;\r
 import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command;\r
 import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.AuthenticationEntity;\r
 import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.ServiceProxyUser;\r
@@ -95,9 +94,9 @@ public class ServiceProxyClient implements SearchClient {
       logger.info("Authenticating [" + user.getProperty("name") + "]");\r
       this.user = (ServiceProxyUser) user;\r
       Pazpar2Command auth = new Pazpar2Command("auth",null);\r
-      auth.setParameters(new CommandParameter("action","=","login"), \r
-                         new CommandParameter("username","=",user.getProperty("name")), \r
-                         new CommandParameter("password","=",user.getProperty("password")));\r
+      auth.setParametersInState(new CommandParameter("action","=","login"), \r
+                                new CommandParameter("username","=",user.getProperty("name")), \r
+                                new CommandParameter("password","=",user.getProperty("password")));\r
       byte[] response = send(auth);\r
       String responseStr = new String(response,"UTF-8");\r
       logger.info(responseStr);      \r
@@ -155,7 +154,7 @@ public class ServiceProxyClient implements SearchClient {
    * @throws ClientProtocolException\r
    * @throws IOException\r
    */\r
-  private byte[] send(CommandReadOnly command) throws ClientProtocolException, IOException {\r
+  private byte[] send(Pazpar2Command command) throws ClientProtocolException, IOException {\r
     String url = serviceUrl + "?" + command.getEncodedQueryString(); \r
     logger.info("Sending request "+url);    \r
     HttpGet httpget = new HttpGet(url);     \r
@@ -192,12 +191,12 @@ public class ServiceProxyClient implements SearchClient {
   }\r
 \r
   @Override\r
-  public void setSearchCommand(CommandReadOnly command) {\r
+  public void setSearchCommand(Pazpar2Command command) {\r
     // Do nothing, Service Proxy is handling this    \r
   }\r
 \r
   @Override\r
-  public CommandResponse executeCommand(CommandReadOnly command,\r
+  public CommandResponse executeCommand(Pazpar2Command command,\r
       ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException {\r
     byte[] response = send(command);\r
     baos.write(response);\r