\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.ApplicationError;\r
+import com.indexdata.pz2utils4jsf.errors.ErrorInterface;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.ByTarget;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.RecordResponse;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.ShowResponse;\r
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 pz2conf;\r
- \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
public void initiatePz2Session() {\r
logger.debug(Utils.objectId(this) + " will instantiate a Pz2Session next.");\r
pz2 = new Pz2Session();\r
- logger.debug(Utils.objectId(this) + " will forward configuration to the new Pz2Session [" + Utils.objectId(pz2) + "]");\r
- pz2.init(pz2conf);\r
+ searchClient = new StraightPz2Client();\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
}\r
\r
+ \r
/* (non-Javadoc)\r
* @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#doSearch(java.lang.String)\r
*/\r
return pz2.hasErrors();\r
}\r
\r
- public ApplicationError getCommandError() {\r
+ public ErrorInterface getCommandError() {\r
return pz2.getCommandError();\r
}\r
\r
- public List<ApplicationError> getConfigurationErrors () {\r
+ public List<ErrorInterface> getConfigurationErrors () {\r
return pz2.getConfigurationErrors();\r
}\r
\r