Service proxy client and configuration schemes
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / Pz2Session.java
index 58b296f..f35523e 100644 (file)
@@ -11,7 +11,7 @@ import javax.inject.Named;
 \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.ConfigurationException;\r
 import com.indexdata.pz2utils4jsf.errors.ErrorHelper;\r
@@ -48,24 +48,26 @@ public class Pz2Session implements Pz2Interface {
     logger.info("Instantiating pz2 session object [" + Utils.objectId(this) + "]");      \r
   }\r
     \r
-  public void init(SearchClient searchClient, Pz2Configurator configurator) {\r
+  public void init(SearchClient searchClient, ConfigurationReader configReader) {\r
     configurationErrors = new ArrayList<ErrorInterface>();\r
-    errorHelper = new ErrorHelper(configurator);    \r
+    errorHelper = new ErrorHelper(configReader);    \r
     logger.debug(Utils.objectId(this) + " will configure search client for the session");\r
     try {\r
-      searchClient.configure(configurator);\r
-      \r
-      // The cloning is a hack: \r
+      searchClient.configure(configReader);            \r
       // At the time of writing this search client is injected using Weld. \r
       // However, the client is used for asynchronously sending off requests\r
-      // to the server AND propagation of context to threads is not supported.\r
-      // Trying so will throw a WELD-001303 error. To avoid that, a context\r
-      // free client is spawned from the context dependent one. \r
+      // to the server AND propagation of context to threads is currently \r
+      // not supported. Trying to do so throws a WELD-001303 error. \r
+      // To avoid that, a context free client is cloned from the context \r
+      // dependent one. \r
+      // If propagation to threads gets supported, the cloning can go. \r
       this.searchClient = searchClient.cloneMe();\r
       \r
     } catch (ConfigurationException e) {\r
+      // TODO: set errors\r
       logger.info("Found " + configurationErrors.size() + " configuration errors");    \r
-    }        \r
+    } \r
+    logger.info(configReader.document());\r
     resetDataObjects();\r
   }\r
     \r