From b46c6267958e478e4b03335aea0187bbbebbc450 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Sat, 13 Apr 2013 08:17:14 -0400 Subject: [PATCH] Fixes scope for sp session bean. Fixes log statements. --- .../indexdata/pz2utils4jsf/pazpar2/ForServiceProxy.java | 15 --------------- .../com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java | 5 +---- .../indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java | 8 ++++---- .../pz2utils4jsf/pazpar2/sp/ForServiceProxy.java | 15 +++++++++++++++ .../pz2utils4jsf/pazpar2/sp/ServiceProxySession.java | 7 ++++--- 5 files changed, 24 insertions(+), 26 deletions(-) delete mode 100644 src/main/java/com/indexdata/pz2utils4jsf/pazpar2/ForServiceProxy.java create mode 100644 src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ForServiceProxy.java diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/ForServiceProxy.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/ForServiceProxy.java deleted file mode 100644 index 786bd20..0000000 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/ForServiceProxy.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.indexdata.pz2utils4jsf.pazpar2; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import javax.inject.Qualifier; - -@Qualifier -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE}) -public @interface ForServiceProxy { - -} diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java index 345f049..5838626 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java @@ -37,20 +37,17 @@ public class Pz2Bean implements Pz2Interface, Serializable { public Pz2Bean () { logger.info("Instantiating pz2 bean [" + Utils.objectId(this) + "]"); - logger.debug("in Pz2Bean configurator is " + configurator); } @PostConstruct public void instantiatePz2SessionObject() { logger.debug("in start of Pz2Bean post-construct configurator is " + configurator); - logger.debug(Utils.objectId(this) + " will instantiate a Pz2Session next."); + logger.debug(Utils.objectId(this) + " will instantiate a Pz2Client next."); searchClient = new Pz2Client(); logger.info("Using [" + Utils.objectId(searchClient) + "] configured by [" + Utils.objectId(configurator) + "] on session [" + Utils.objectId(pz2) + "]" ); pz2.configureClient(searchClient,configurator); - logger.debug("in end of Pz2Bean post-construct configurator is " + configurator); - } /* (non-Javadoc) diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java index f5f4e55..ae742f3 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java @@ -13,6 +13,7 @@ import org.apache.log4j.Logger; import com.indexdata.pz2utils4jsf.config.Configuration; import com.indexdata.pz2utils4jsf.config.ConfigurationReader; +import com.indexdata.pz2utils4jsf.pazpar2.sp.ForServiceProxy; import com.indexdata.pz2utils4jsf.pazpar2.sp.ServiceProxyClient; import com.indexdata.pz2utils4jsf.pazpar2.sp.ServiceProxyInterface; import com.indexdata.pz2utils4jsf.pazpar2.sp.ServiceProxySession; @@ -26,16 +27,15 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface { private static Logger logger = Logger.getLogger(Pz2ProxyBean.class); @Inject ConfigurationReader configurator; - @Inject ServiceProxyUser user; - + @Inject ServiceProxyUser user; @Inject @ForServiceProxy ServiceProxySession pz2; public Pz2ProxyBean() { } @PostConstruct - public void instantiatePz2SessionObject() { - logger.debug(Utils.objectId(this) + " will instantiate a Pz2Session object next."); + public void instantiateServiceProxyClient() { + logger.debug(Utils.objectId(this) + " will instantiate a ServiceProxyClient next."); searchClient = new ServiceProxyClient(); logger.info("Using [" + Utils.objectId(searchClient) + "] configured by [" + Utils.objectId(configurator) + "] on session [" diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ForServiceProxy.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ForServiceProxy.java new file mode 100644 index 0000000..28b918c --- /dev/null +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ForServiceProxy.java @@ -0,0 +1,15 @@ +package com.indexdata.pz2utils4jsf.pazpar2.sp; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +@Qualifier +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.TYPE}) +public @interface ForServiceProxy { + +} diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxySession.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxySession.java index 6dc7b6b..7e79006 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxySession.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxySession.java @@ -3,15 +3,16 @@ package com.indexdata.pz2utils4jsf.pazpar2.sp; import java.io.IOException; import java.io.UnsupportedEncodingException; +import javax.enterprise.context.SessionScoped; + import org.apache.log4j.Logger; -import com.indexdata.pz2utils4jsf.pazpar2.ForServiceProxy; import com.indexdata.pz2utils4jsf.pazpar2.Pz2Session; import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter; import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.ServiceProxyUser; import com.indexdata.pz2utils4jsf.utils.Utils; -@ForServiceProxy +@ForServiceProxy @SessionScoped public class ServiceProxySession extends Pz2Session implements ServiceProxyInterface { private ServiceProxyUser user; @@ -21,7 +22,7 @@ public class ServiceProxySession extends Pz2Session implements ServiceProxyInter private String initDocResponse = ""; public ServiceProxySession() { - logger.info("Instantiating pz2 session object [" + Utils.objectId(this) + "]"); + logger.info("Instantiating SP pz2 session object [" + Utils.objectId(this) + "]"); } public void setUser(ServiceProxyUser user) { -- 1.7.10.4