Moves single-target-filter class to commands package
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / sp / ServiceProxySession.java
index 2a58af0..7e79006 100644 (file)
@@ -3,13 +3,16 @@ package com.indexdata.pz2utils4jsf.pazpar2.sp;
 import java.io.IOException;\r
 import java.io.UnsupportedEncodingException;\r
 \r
+import javax.enterprise.context.SessionScoped;\r
+\r
 import org.apache.log4j.Logger;\r
 \r
-import com.indexdata.pz2utils4jsf.pazpar2.CommandParameter;\r
 import com.indexdata.pz2utils4jsf.pazpar2.Pz2Session;\r
+import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter;\r
 import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.ServiceProxyUser;\r
 import com.indexdata.pz2utils4jsf.utils.Utils;\r
 \r
+@ForServiceProxy @SessionScoped\r
 public class ServiceProxySession extends Pz2Session implements ServiceProxyInterface {\r
 \r
   private ServiceProxyUser user; \r
@@ -19,7 +22,7 @@ public class ServiceProxySession extends Pz2Session implements ServiceProxyInter
   private String initDocResponse = "";  \r
     \r
   public ServiceProxySession() {\r
-    logger.info("Instantiating pz2 session object [" + Utils.objectId(this) + "]");\r
+    logger.info("Instantiating SP pz2 session object [" + Utils.objectId(this) + "]");\r
   }\r
   \r
   public void setUser(ServiceProxyUser user) {\r
@@ -56,6 +59,15 @@ public class ServiceProxySession extends Pz2Session implements ServiceProxyInter
     initDocResponse = new String(response,"UTF-8");\r
     return initDocResponse;\r
   }\r
+  \r
+  @Override\r
+  public String postInit(byte[] initDoc) throws UnsupportedEncodingException, IOException {    \r
+    this.resetDataObjects();\r
+    byte[] response = client().postInitDoc(initDoc);\r
+    initDocResponse = new String(response,"UTF-8");\r
+    return initDocResponse;\r
+  }\r
+\r
 \r
   @Override\r
   public void setServiceProxyUrl(String url) {\r