From 6f43cc03e1135e838f3c08e59fc00cce8ee6f53b Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Wed, 13 Mar 2013 21:27:38 -0400 Subject: [PATCH] Sanitary --- .../com/indexdata/pz2utils4jsf/config/Pz2Config.java | 11 +---------- .../pz2utils4jsf/config/Pz2ConfigureByMk2Config.java | 3 +-- .../com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java | 15 ++++++++++----- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2Config.java b/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2Config.java index 128525b..c6af028 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2Config.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2Config.java @@ -29,8 +29,7 @@ public class Pz2Config implements ModuleConfigurationGetter, Serializable { setDefaults(); } - public Pz2Config (Map parameters) { - //logger.debug(Utils.objectId(this) + " being constructed with parameter map argument"); + public Pz2Config (Map parameters) { setDefaults(); for (String key : parameters.keySet()) { properties.put(key, parameters.get(key)); @@ -65,14 +64,6 @@ public class Pz2Config implements ModuleConfigurationGetter, Serializable { properties.put(key, value); } - public void setPazpar2Url (String value) { - properties.put("PAZPAR2_URL", value); - } - - public void setPazpar2ServiceId (String value) { - properties.put("PAZPAR2_SERVICE_ID",value); - } - @Override public String get(String key, String defaultValue) { if (properties.containsKey(key)) { diff --git a/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2ConfigureByMk2Config.java b/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2ConfigureByMk2Config.java index 95f69fe..e6418fc 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2ConfigureByMk2Config.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/config/Pz2ConfigureByMk2Config.java @@ -60,10 +60,9 @@ public class Pz2ConfigureByMk2Config implements Pz2Configurator { } } - public List document() { List doc = new ArrayList(); - doc.add(":"+nl+"Attempted to configure service using the file " + configFilePathAndName); + doc.add(nl+"Attempted to configure service using the file " + configFilePathAndName); doc.add(nl+"-- Configured to access Pazpar2 at: " +pz2config.get("PAZPAR2_URL")); if (pz2config.get("PAZPAR2_SERVICE_XML") != null) { doc.add(nl+"-- Configured to use the service definition contained in " + pz2config.getConfigFilePath() + "/" + pz2config.get("PAZPAR2_SERVICE_XML")); diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java index 267f1b4..17f8545 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Session.java @@ -1,5 +1,6 @@ package com.indexdata.pz2utils4jsf.pazpar2; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -12,18 +13,20 @@ import javax.inject.Named; import org.apache.log4j.Logger; +import com.indexdata.masterkey.pazpar2.client.ClientCommand; import com.indexdata.masterkey.pazpar2.client.Pazpar2Client; import com.indexdata.masterkey.pazpar2.client.Pazpar2ClientConfiguration; import com.indexdata.masterkey.pazpar2.client.Pazpar2ClientGeneric; +import com.indexdata.masterkey.pazpar2.client.exceptions.Pazpar2ErrorException; import com.indexdata.masterkey.pazpar2.client.exceptions.ProxyErrorException; import com.indexdata.pz2utils4jsf.config.Pz2Configurator; import com.indexdata.pz2utils4jsf.controls.ResultsPager; +import com.indexdata.pz2utils4jsf.errors.ConfigurationError; import com.indexdata.pz2utils4jsf.errors.ConfigurationException; -import com.indexdata.pz2utils4jsf.errors.ErrorInterface; import com.indexdata.pz2utils4jsf.errors.ErrorHelper; -import com.indexdata.pz2utils4jsf.errors.ConfigurationError; -import com.indexdata.pz2utils4jsf.pazpar2.data.CommandError; +import com.indexdata.pz2utils4jsf.errors.ErrorInterface; import com.indexdata.pz2utils4jsf.pazpar2.data.ByTarget; +import com.indexdata.pz2utils4jsf.pazpar2.data.CommandError; import com.indexdata.pz2utils4jsf.pazpar2.data.Pazpar2ResponseData; import com.indexdata.pz2utils4jsf.pazpar2.data.Pazpar2ResponseParser; import com.indexdata.pz2utils4jsf.pazpar2.data.RecordResponse; @@ -71,12 +74,14 @@ public class Pz2Session implements Pz2Interface { } if (cfg != null) { try { - client = new Pazpar2ClientGeneric(cfg); + client = new Pazpar2ClientGeneric(cfg); } catch (ProxyErrorException pe) { logger.error("Could not instantiate Pazpar2 client: " + pe.getMessage()); configurationErrors.add(new ConfigurationError("Pz2Client error","ProxyError","Could not create Pazpar2 client: " +pe.getMessage(),errorHelper)); } - logger.info("Found " + configurationErrors.size() + " configuration errors"); + if (hasConfigurationErrors()) { + logger.info("Found " + configurationErrors.size() + " configuration errors"); + } } resetDataObjects(); } else { -- 1.7.10.4