<dependency>\r
<groupId>com.indexdata</groupId>\r
<artifactId>masterkey-common</artifactId>\r
- <version>0.1.9-SNAPSHOT</version>\r
+ <version>0.1.10-SNAPSHOT</version>\r
</dependency>\r
</dependencies>\r
\r
<resources>\r
<resource>\r
<directory>src</directory>\r
- <excludes>\r
- <exclude>**/*.java</exclude>\r
+ <excludes> \r
+ <exclude>main/</exclude>\r
+ <exclude>*.java</exclude>\r
</excludes>\r
</resource>\r
</resources>\r
<artifactId>maven-compiler-plugin</artifactId>\r
<version>2.3.2</version>\r
<configuration>\r
+ <excludes>\r
+ <exclude>src/META-INF/</exclude>\r
+ </excludes>\r
<source>1.7</source>\r
<target>1.7</target>\r
</configuration>\r
auth="Container"\r
type="javax.enterprise.inject.spi.BeanManager"\r
factory="org.jboss.weld.resources.ManagerObjectFactory"/>\r
- <WatchedResource>WEB-INF/web.xml</WatchedResource>\r
- <WatchedResource>META-INF/context.xml</WatchedResource>\r
+ <!-- WatchedResource>WEB-INF/web.xml</WatchedResource>\r
+ <WatchedResource>META-INF/context.xml</WatchedResource -->\r
</Context>
\ No newline at end of file
package com.indexdata.pz2utils4jsf.config;\r
\r
+import java.io.Serializable;\r
import java.util.HashMap;\r
import java.util.Map;\r
\r
+import org.apache.log4j.Logger;\r
+\r
import com.indexdata.masterkey.config.MissingMandatoryParameterException;\r
import com.indexdata.masterkey.config.ModuleConfigurationGetter;\r
\r
-public class Pz2Config implements ModuleConfigurationGetter {\r
+public class Pz2Config implements ModuleConfigurationGetter, Serializable {\r
\r
+ private static final long serialVersionUID = -6801241975338182197L;\r
+ private static Logger logger = Logger.getLogger(Pz2Config.class);\r
Map<String,String> properties = new HashMap<String,String>();\r
\r
public Pz2Config () {\r
setStatics();\r
setPazpar2Url(pazpar2Url);\r
setPazpar2ServiceId(pazpar2ServiceId);\r
+ logger.debug("Creating pazpar2 configuration with "+ get("PAZPAR2_URL") + " and " + get("PAZPAR2_SERVICE_ID"));\r
}\r
\r
private void setStatics () {\r
\r
import org.apache.log4j.Logger;\r
\r
-@Named("pz2configwebxml")\r
-@SessionScoped\r
+@SessionScoped @Named\r
public class Pz2ConfigureByWebXml implements Pz2Configurator {\r
\r
private static final long serialVersionUID = 144390224959311772L;\r
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();\r
ServletContext servletContext = (ServletContext) externalContext.getContext();\r
String pazpar2Url = servletContext.getInitParameter("PAZPAR2_URL");\r
- String pazpar2ServiceId = servletContext.getInitParameter("PAZPAR2_SERVICE_id");\r
+ String pazpar2ServiceId = servletContext.getInitParameter("PAZPAR2_SERVICE_ID");\r
config = new Pz2Config(pazpar2Url,pazpar2ServiceId);\r
}\r
\r
import java.io.Serializable;\r
import java.util.List;\r
\r
+import javax.annotation.PostConstruct;\r
import javax.enterprise.context.SessionScoped;\r
import javax.inject.Inject;\r
import javax.inject.Named;\r
\r
-import com.indexdata.pz2utils4jsf.config.Pz2ConfigureByWebXml;\r
+import org.apache.log4j.Logger;\r
+\r
+import com.indexdata.pz2utils4jsf.config.Pz2Configurator;\r
import com.indexdata.pz2utils4jsf.controls.ResultsPager;\r
-import com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface;\r
-import com.indexdata.pz2utils4jsf.pazpar2.Pz2Session;\r
-import com.indexdata.pz2utils4jsf.pazpar2.TargetFilter;\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
public class Pz2Bean implements Pz2Interface, Serializable {\r
\r
private static final long serialVersionUID = 3440277287081557861L;\r
- Pz2Session pz2;\r
-\r
- @Inject \r
- private Pz2ConfigureByWebXml pz2conf;\r
-\r
+ private static Logger logger = Logger.getLogger(Pz2Bean.class);\r
+ \r
+ Pz2Session pz2; \r
+ @Inject Pz2Configurator pz2conf;\r
+ \r
public Pz2Bean () {\r
- pz2 = new Pz2Session(pz2conf); \r
+ logger.debug("Instantiating pz2 bean"); \r
+ pz2 = new Pz2Session(); \r
+ }\r
+ \r
+ @PostConstruct\r
+ public void initiatePz2Session() {\r
+ pz2.init(pz2conf);\r
}\r
+ \r
/* (non-Javadoc)\r
* @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#doSearch(java.lang.String)\r
*/\r
package com.indexdata.pz2utils4jsf.pazpar2;\r
\r
+import java.io.Serializable;\r
import java.util.List;\r
\r
import com.indexdata.pz2utils4jsf.controls.ResultsPager;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.TermListsResponse;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.TermResponse;\r
\r
-public interface Pz2Interface {\r
+public interface Pz2Interface extends Serializable {\r
\r
/**\r
* Executes a Pazpar2 search using the given query string\r
package com.indexdata.pz2utils4jsf.pazpar2;\r
\r
-import java.io.Serializable;\r
import java.util.ArrayList;\r
import java.util.List;\r
import java.util.Map;\r
import java.util.StringTokenizer;\r
import java.util.concurrent.ConcurrentHashMap;\r
\r
+import javax.enterprise.context.SessionScoped;\r
+import javax.inject.Named;\r
+\r
import org.apache.log4j.Logger;\r
\r
import com.indexdata.masterkey.pazpar2.client.exceptions.ProxyErrorException;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.TermResponse;\r
import com.indexdata.pz2utils4jsf.pazpar2.state.QueryStates;\r
\r
-public class Pz2Session implements Serializable, Pz2Interface {\r
+@Named\r
+@SessionScoped\r
+public class Pz2Session implements Pz2Interface {\r
\r
private static Logger logger = Logger.getLogger(Pz2Session.class);\r
\r
private com.indexdata.masterkey.pazpar2.client.Pazpar2Client client = null; \r
private TargetFilter targetFilter = null; \r
private ResultsPager pager = null; \r
- \r
- public Pz2Session (Pz2Configurator pz2conf) {\r
- logger.debug("Instantiating pz2"); \r
- if (pz2conf == null) {logger.error("conf is null!!!!!!!!!!!!!!!"); }\r
+ \r
+ public Pz2Session () {\r
+ logger.debug("Instantiating pz2 session object"); \r
+ }\r
+ \r
+ public void init(Pz2Configurator pz2conf) {\r
+ if (client==null) {\r
+ logger.debug("Initiating a session holding object ");\r
try {\r
cfg = new com.indexdata.masterkey.pazpar2.client.Pazpar2ClientConfiguration(pz2conf.getConfig());\r
client = new com.indexdata.masterkey.pazpar2.client.Pazpar2ClientGeneric(cfg);\r
resetDataObjects();\r
} catch (ProxyErrorException e) {\r
e.printStackTrace();\r
- } \r
+ } \r
+ } else {\r
+ logger.error("??? attempt to initiate session but already has a client");\r
+ }\r
}\r
-\r
+ \r
public void doSearch(String query) {\r
setCommandParameter("search",new CommandParameter("query","=",query)); \r
doSearch();\r