Adds option to post sp init doc, see xml, change sp url
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / Pz2Bean.java
index dff3142..7f3ae52 100644 (file)
@@ -5,12 +5,13 @@ import java.util.List;
 \r
 import javax.annotation.PostConstruct;\r
 import javax.enterprise.context.SessionScoped;\r
+import javax.enterprise.inject.Alternative;\r
 import javax.inject.Inject;\r
 import javax.inject.Named;\r
 \r
 import org.apache.log4j.Logger;\r
 \r
-import com.indexdata.pz2utils4jsf.config.Pz2Configurator;\r
+import com.indexdata.pz2utils4jsf.config.ConfigurationReader;\r
 import com.indexdata.pz2utils4jsf.controls.ResultsPager;\r
 import com.indexdata.pz2utils4jsf.errors.ErrorInterface;\r
 import com.indexdata.pz2utils4jsf.pazpar2.data.ByTarget;\r
@@ -21,30 +22,32 @@ import com.indexdata.pz2utils4jsf.pazpar2.data.TermListsResponse;
 import com.indexdata.pz2utils4jsf.pazpar2.data.TermResponse;\r
 import com.indexdata.pz2utils4jsf.utils.Utils;\r
 \r
-@Named("pz2") @SessionScoped\r
+@Named("pz2") @SessionScoped @Alternative\r
 public class Pz2Bean implements Pz2Interface, Serializable {\r
 \r
   private static final long serialVersionUID = 3440277287081557861L;\r
   private static Logger logger = Logger.getLogger(Pz2Bean.class);\r
   \r
-  Pz2Session pz2;  \r
-  @Inject Pz2Configurator configurator;\r
-  @Inject SearchClient    searchClient;\r
+  @Inject ConfigurationReader configurator;\r
+  protected Pz2Session pz2;  \r
+  protected SearchClient searchClient;  \r
     \r
   public Pz2Bean () {\r
     logger.info("Instantiating pz2 bean [" + Utils.objectId(this) + "]");\r
   }\r
   \r
   @PostConstruct\r
-  public void initiatePz2Session() {\r
+  public void instantiatePz2SessionObject() {\r
     logger.debug(Utils.objectId(this) + " will instantiate a Pz2Session next.");\r
     pz2 = new Pz2Session();\r
+    searchClient = new Pz2Client();\r
     logger.info("Using [" + Utils.objectId(searchClient) + "] configured by [" \r
                           + Utils.objectId(configurator) + "] on session [" \r
-                          + Utils.objectId(pz2) + "]" );\r
-    pz2.init(searchClient,configurator);\r
+                          + Utils.objectId(pz2) + "]" );    \r
+    pz2.configureClient(searchClient,configurator);\r
   }\r
   \r
+  \r
   /* (non-Javadoc)\r
    * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#doSearch(java.lang.String)\r
    */\r