From 82d95ea9cf2bdfe5024352d94ad4ced2024f9216 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Thu, 4 Apr 2013 14:35:33 -0400 Subject: [PATCH] Exposing configuration for use in upper layers --- src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java | 7 ++++++- .../java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java index bc10fab..26e4a4d 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java @@ -37,6 +37,7 @@ public class Pz2Client implements SearchClient { private Pazpar2ClientConfiguration cfg = null; public static final String MODULENAME = "pz2client"; public static Map DEFAULTS = new HashMap(); + Configuration config = null; static { DEFAULTS.put("PROXY_MODE","1"); @@ -51,7 +52,7 @@ public class Pz2Client implements SearchClient { public void configure(ConfigurationReader configReader) throws ConfigurationException { logger.info(Utils.objectId(this) + " is configuring using the provided " + Utils.objectId(configReader)); try { - Configuration config = configReader.getConfiguration(this); + config = configReader.getConfiguration(this); cfg = new Pazpar2ClientConfiguration(new ConfigurationGetter(config)); } catch (ProxyErrorException pe) { logger.error("Could not configure Pazpar2 client: " + pe.getMessage()); @@ -144,5 +145,9 @@ public class Pz2Client implements SearchClient { doc.add(nl+ MODULENAME + " was configured to access Pazpar2 at : " + cfg.PAZPAR2_URL); return new ArrayList(); } + + public Configuration getConfiguration () { + return config; + } } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java index cc45e76..b0d188f 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java @@ -6,6 +6,7 @@ import java.io.Serializable; import com.indexdata.masterkey.pazpar2.client.exceptions.Pazpar2ErrorException; import com.indexdata.pz2utils4jsf.config.Configurable; +import com.indexdata.pz2utils4jsf.config.Configuration; public interface SearchClient extends Configurable, Serializable { @@ -13,4 +14,5 @@ public interface SearchClient extends Configurable, Serializable { public CommandResponse executeCommand(Pazpar2Command command, ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException; public SearchClient cloneMe(); public boolean isAuthenticatingClient(); + public Configuration getConfiguration(); } -- 1.7.10.4