From d739ecb22a85d8f982add6d429e069edf7e0dde2 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Tue, 21 May 2013 08:49:48 -0400 Subject: [PATCH] Adds check for SP only commands. Also: Adds support for setting Pazpar2 service ID Tweaks log levels --- .../java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java | 88 ++++++++++++-------- .../com/indexdata/mkjsf/pazpar2/Pz2Client.java | 18 +++- .../mkjsf/pazpar2/ServiceProxyExtensions.java | 24 +++--- .../mkjsf/pazpar2/commands/BytargetCommand.java | 5 ++ .../mkjsf/pazpar2/commands/CommandParameter.java | 10 +-- .../mkjsf/pazpar2/commands/InitCommand.java | 13 +++ .../mkjsf/pazpar2/commands/Pazpar2Command.java | 11 +-- .../mkjsf/pazpar2/commands/PingCommand.java | 5 ++ .../mkjsf/pazpar2/commands/RecordCommand.java | 5 ++ .../mkjsf/pazpar2/commands/SearchCommand.java | 5 ++ .../mkjsf/pazpar2/commands/SettingsCommand.java | 5 ++ .../mkjsf/pazpar2/commands/ShowCommand.java | 5 ++ .../mkjsf/pazpar2/commands/StatCommand.java | 5 ++ .../mkjsf/pazpar2/commands/TermlistCommand.java | 5 ++ .../mkjsf/pazpar2/commands/sp/AuthCommand.java | 5 ++ .../pazpar2/commands/sp/CategoriesCommand.java | 5 ++ .../mkjsf/pazpar2/commands/sp/RecordCommandSp.java | 6 ++ .../pazpar2/commands/sp/ServiceProxyCommand.java | 2 + .../mkjsf/pazpar2/state/StateManager.java | 12 +-- 19 files changed, 169 insertions(+), 65 deletions(-) diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java index 4c6d8a0..5b45551 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Bean.java @@ -26,6 +26,7 @@ import com.indexdata.mkjsf.errors.ErrorHelper; import com.indexdata.mkjsf.pazpar2.commands.CommandParameter; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command; import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Commands; +import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand; import com.indexdata.mkjsf.pazpar2.data.RecordResponse; import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject; import com.indexdata.mkjsf.pazpar2.data.ResponseParser; @@ -160,7 +161,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria logger.error("Ignoring show,stat,termlist,bytarget commands due to problem with most recent search."); return ""; } else if (!hasQuery()) { - logger.error("Ignoring show,stat,termlist,bytarget commands because there is not yet a query."); + logger.debug("Ignoring show,stat,termlist,bytarget commands because there is not yet a query."); return ""; } else { return update("show,stat,termlist,bytarget"); @@ -174,7 +175,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria * @return Number of activeclients at the time of the 'show' command */ public String update (String commands) { - logger.info("Request to update: " + commands); + logger.debug("Request to update: " + commands); try { if (commands.equals("search")) { doSearch(); @@ -195,7 +196,6 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria return "0"; } else { logger.debug("Processing request for " + commands); - List threadList = new ArrayList(); StringTokenizer tokens = new StringTokenizer(commands,","); while (tokens.hasMoreElements()) { @@ -311,48 +311,53 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria } /** - * Validates the request then executes the command and parses the response. + * Executes the command and parses the response to create data objects. * If the parsed response is of a known type it will be cached in 'pzresp' * * @param commandName The command to be executed * @return An XML response parsed to form a response data object */ protected ResponseDataObject doCommand(String commandName) { - ResponseDataObject responseObject = null; - logger.info("Request "+commandName + ": "+ pzreq.getCommand("search").toString()); - Pazpar2Command command = pzreq.getCommand(commandName); - long start = System.currentTimeMillis(); - HttpResponseWrapper commandResponse = searchClient.executeCommand(command); - long end = System.currentTimeMillis(); - logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." ); - responseLogger.debug("Response was: " + commandResponse.getResponseString()); - if (commandResponse.getContentType().contains("xml")) { - responseObject = ResponseParser.getParser().getDataObject((ClientCommandResponse)commandResponse); - if (ResponseParser.docTypes.contains(responseObject.getType())) { - logger.debug("Storing " + responseObject.getType() + " in pzresp. "); - pzresp.put(commandName, responseObject); + if (pzreq.getCommand(commandName).spOnly() && isPazpar2Service()) { + logger.warn("Skipping " + commandName + " - SP-only command, un-supported by Pazpar2"); + return new ResponseDataObject(); + } else { + ResponseDataObject responseObject = null; + logger.info("Request "+commandName + ": "+ pzreq.getCommand("search").toString()); + Pazpar2Command command = pzreq.getCommand(commandName); + long start = System.currentTimeMillis(); + HttpResponseWrapper commandResponse = searchClient.executeCommand(command); + long end = System.currentTimeMillis(); + logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." ); + responseLogger.debug("Response was: " + commandResponse.getResponseString()); + if (commandResponse.getContentType().contains("xml")) { + responseObject = ResponseParser.getParser().getDataObject((ClientCommandResponse)commandResponse); + if (ResponseParser.docTypes.contains(responseObject.getType())) { + logger.debug("Storing " + responseObject.getType() + " in pzresp. "); + pzresp.put(commandName, responseObject); + } else { + if (commandName.equals("record")) { + logger.debug("Command was 'record' but response not '' - assuming raw record response."); + ResponseDataObject recordResponse = new RecordResponse(); + recordResponse.setType("record"); + recordResponse.setXml(responseObject.getXml()); + recordResponse.setAttribute("activeclients", "0"); + pzresp.put("record", recordResponse); + } + } + } else if (commandResponse.isBinary()) { + responseObject = new RecordResponse(); + responseObject.setType(commandName); + logger.info("Binary response"); + responseObject.setAttribute("activeclients", "0"); + responseObject.setXml("binary response"); + responseObject.setBinary(commandResponse.getBytes()); + pzresp.put("record", responseObject); } else { - if (commandName.equals("record")) { - logger.debug("Command was 'record' but response not '' - assuming raw record response."); - ResponseDataObject recordResponse = new RecordResponse(); - recordResponse.setType("record"); - recordResponse.setXml(responseObject.getXml()); - recordResponse.setAttribute("activeclients", "0"); - pzresp.put("record", recordResponse); - } + logger.error("Response was not found to be XML or binary. The response was not handled."); } - } else if (commandResponse.isBinary()) { - responseObject = new RecordResponse(); - responseObject.setType(commandName); - logger.info("Binary response"); - responseObject.setAttribute("activeclients", "0"); - responseObject.setXml("binary response"); - responseObject.setBinary(commandResponse.getBytes()); - pzresp.put("record", responseObject); - } else { - logger.error("Response was not found to be XML or binary. The response was not handled."); + return responseObject; } - return responseObject; } @Override @@ -408,6 +413,17 @@ public class Pz2Bean implements Pz2Interface, StateListener, Configurable, Seria return (searchClient!=null ? searchClient.getServiceUrl() : ""); } + public void setServiceId () { + pzreq.getRecord().removeParametersInState(); + pzreq.getSearch().removeParametersInState(); + pzresp.resetSearchResponses(); + pz2Client.setServiceId(pzreq.getInit().getService()); + } + + public String getServiceId () { + return pzreq.getInit().getService(); + } + public boolean getServiceUrlIsDefined() { return (searchClient != null && searchClient.hasServiceUrl()); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java index 388253d..3b33000 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/Pz2Client.java @@ -62,7 +62,7 @@ public class Pz2Client implements SearchClient { } if (cfg != null) { try { - client = new Pazpar2ClientGeneric(cfg); + client = new Pazpar2ClientGeneric(cfg); } catch (ProxyErrorException pe) { logger.error("Could not configure Pazpar2 client: " + pe.getMessage()); throw new ConfigurationException("Could not configure Pz2Client: "+ pe.getMessage(),pe); @@ -204,8 +204,20 @@ public class Pz2Client implements SearchClient { @Override public void setServiceUrl (String serviceUrl) { - cfg.PAZPAR2_URL = serviceUrl; - + cfg.PAZPAR2_URL = serviceUrl; + } + + public String getServiceId () { + return cfg.PAZPAR2_SERVICE_ID; + } + + public void setServiceId(String serviceId) { + cfg.PAZPAR2_SERVICE_ID = serviceId; + try { + client = new Pazpar2ClientGeneric(cfg); + } catch (ProxyErrorException pe) { + logger.error("Could not configure Pazpar2 client: " + pe.getMessage()); + } } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java index de1f42a..8629b38 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyExtensions.java @@ -182,24 +182,28 @@ public class ServiceProxyExtensions implements ServiceProxyInterface, Serializab return initDocUpload.getIncludeDebug(); } - // TODO: Remove when possible + // TODO: Remove when obsolete public InitDocUpload getInitDocUpload () { return initDocUpload; } public CategoriesResponse getCategories () { - ResponseDataObject response = pz2.doCommand("categories"); - if (response.hasApplicationError()) { - logger.debug(response.getXml()); - return new CategoriesResponse(); - } else { - try { - return (CategoriesResponse) response; - } catch (Exception e) { - e.printStackTrace(); + if (pz2.isServiceProxyService()) { + ResponseDataObject response = pz2.doCommand("categories"); + if (response.hasApplicationError()) { logger.debug(response.getXml()); return new CategoriesResponse(); + } else { + try { + return (CategoriesResponse) response; + } catch (Exception e) { + e.printStackTrace(); + logger.debug(response.getXml()); + return new CategoriesResponse(); + } } + } else { + return new CategoriesResponse(); } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/BytargetCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/BytargetCommand.java index 7f39b70..b149808 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/BytargetCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/BytargetCommand.java @@ -22,4 +22,9 @@ public class BytargetCommand extends Pazpar2Command implements ServiceProxyComma public ServiceProxyCommand getSp() { return this; } + + @Override + public boolean spOnly() { + return false; + } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/CommandParameter.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/CommandParameter.java index 2f0aa03..b22962e 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/CommandParameter.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/CommandParameter.java @@ -24,12 +24,12 @@ public class CommandParameter implements Serializable { private static List nologparams = Arrays.asList("password"); public CommandParameter (String name) { - logger.debug("Instantiating command parameter '" + name + "'"); + logger.trace("Instantiating command parameter '" + name + "'"); this.name = name; } public CommandParameter (String name, String operator, String value, Expression... expressions) { - logger.debug("Instantiating command parameter " + name + " with expressions: [" + expressions + "]"); + logger.trace("Instantiating command parameter " + name + " with expressions: [" + expressions + "]"); this.name = name; this.operator = operator; this.value = value; @@ -39,14 +39,14 @@ public class CommandParameter implements Serializable { } public CommandParameter (String name, String operator, String value) { - if (!nologparams.contains(name)) logger.debug("Instantiating command parameter '" + name + "' with String: [" + value + "]"); + if (!nologparams.contains(name)) logger.trace("Instantiating command parameter '" + name + "' with String: [" + value + "]"); this.name = name; this.operator = operator; this.value = value; } public CommandParameter (String name, String operator, int value) { - logger.debug("Instantiating command parameter '" + name + "' with int: [" + value + "]"); + logger.trace("Instantiating command parameter '" + name + "' with int: [" + value + "]"); this.name = name; this.operator = operator; this.value = value+""; @@ -118,7 +118,7 @@ public class CommandParameter implements Serializable { } public CommandParameter copy() { - logger.debug("Copying parameter '"+ name + "' for modification"); + logger.trace("Copying parameter '"+ name + "' for modification"); CommandParameter newParam = new CommandParameter(name); newParam.value = this.value; newParam.operator = this.operator; diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java index 144a1a7..3166168 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java @@ -15,10 +15,18 @@ public class InitCommand extends Pazpar2Command implements ServiceProxyCommand { setParameterInState(new CommandParameter("clear","=",clear)); } + public String getClear() { + return getParameterValue("clear"); + } + public void setService(String serviceId) { setParameterInState(new CommandParameter("service","=",serviceId)); } + public String getService() { + return getParameterValue("service"); + } + @Override public void setSession (String sessionId) { throw new UnsupportedOperationException("Cannot set session id on init command"); @@ -41,5 +49,10 @@ public class InitCommand extends Pazpar2Command implements ServiceProxyCommand { return this; } + @Override + public boolean spOnly() { + return false; + } + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java index 73fd075..a67f829 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java @@ -31,7 +31,7 @@ public abstract class Pazpar2Command implements Serializable { public void setParameter (CommandParameter parameter) { Pazpar2Command copy = this.copy(); - logger.debug(name + " command: setting parameter [" + parameter.getName() + "=" + parameter.getValueWithExpressions() + "]"); + logger.trace(name + " command: setting parameter [" + parameter.getName() + "=" + parameter.getValueWithExpressions() + "]"); copy.parameters.put(parameter.getName(),parameter); checkInState(copy); } @@ -39,7 +39,7 @@ public abstract class Pazpar2Command implements Serializable { public void setParameters (CommandParameter... params) { Pazpar2Command copy = this.copy(); for (CommandParameter param : params) { - logger.debug(name + " command: setting parameter [" + param.getName() + "=" + param.getValueWithExpressions() + "]"); + logger.trace(name + " command: setting parameter [" + param.getName() + "=" + param.getValueWithExpressions() + "]"); copy.parameters.put(param.getName(),param); } checkInState(copy); @@ -47,13 +47,13 @@ public abstract class Pazpar2Command implements Serializable { public void setParametersInState (CommandParameter... params) { for (CommandParameter param : params) { - logger.debug(name + " command: setting parameter [" + param.getName() + "=" + param.getValueWithExpressions() + "] silently"); + logger.trace(name + " command: setting parameter [" + param.getName() + "=" + param.getValueWithExpressions() + "] silently"); parameters.put(param.getName(),param); } } public void setParameterInState (CommandParameter parameter) { - logger.debug(name + " command: setting parameter [" + parameter.getName() + "=" + parameter.getValueWithExpressions() + "] silently"); + logger.trace(name + " command: setting parameter [" + parameter.getName() + "=" + parameter.getValueWithExpressions() + "] silently"); parameters.put(parameter.getName(),parameter); } @@ -149,5 +149,6 @@ public abstract class Pazpar2Command implements Serializable { } public abstract ServiceProxyCommand getSp(); - + + public abstract boolean spOnly(); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java index 5a75e56..b4f4f4a 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java @@ -22,4 +22,9 @@ public class PingCommand extends Pazpar2Command implements ServiceProxyCommand { public ServiceProxyCommand getSp() { return this; } + + @Override + public boolean spOnly() { + return false; + } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java index 93f7782..cec9d67 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java @@ -85,4 +85,9 @@ public class RecordCommand extends Pazpar2Command implements ServiceProxyCommand public RecordCommandSp getSp () { return new RecordCommandSp(this); } + + @Override + public boolean spOnly() { + return false; + } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java index 4dcb108..ce8c50b 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SearchCommand.java @@ -208,4 +208,9 @@ public class SearchCommand extends Pazpar2Command implements ServiceProxyCommand return this; } + @Override + public boolean spOnly() { + return false; + } + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java index 11d624f..328d578 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/SettingsCommand.java @@ -25,4 +25,9 @@ public class SettingsCommand extends Pazpar2Command implements ServiceProxyComma return this; } + @Override + public boolean spOnly() { + return false; + } + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java index 90e3cd0..c37158b 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/ShowCommand.java @@ -110,4 +110,9 @@ public class ShowCommand extends Pazpar2Command implements ServiceProxyCommand { return this; } + @Override + public boolean spOnly() { + return false; + } + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java index 0243315..590808d 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/StatCommand.java @@ -24,5 +24,10 @@ public class StatCommand extends Pazpar2Command implements ServiceProxyCommand { return this; } + @Override + public boolean spOnly() { + return false; + } + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java index bc3e8c2..5db510c 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/TermlistCommand.java @@ -39,6 +39,11 @@ public class TermlistCommand extends Pazpar2Command implements ServiceProxyComma public ServiceProxyCommand getSp() { return this; } + + @Override + public boolean spOnly() { + return false; + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java index 4d72d61..eeddd9c 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/AuthCommand.java @@ -23,4 +23,9 @@ public class AuthCommand extends Pazpar2Command implements ServiceProxyCommand { public ServiceProxyCommand getSp() { return this; } + + @Override + public boolean spOnly() { + return true; + } } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java index 65e1f26..27be628 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/CategoriesCommand.java @@ -22,4 +22,9 @@ public class CategoriesCommand extends Pazpar2Command implements ServiceProxyCom return this; } + @Override + public boolean spOnly() { + return true; + } + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java index 99846b5..0662df1 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/RecordCommandSp.java @@ -30,5 +30,11 @@ public class RecordCommandSp implements Serializable, ServiceProxyCommand { return command.getParameterValue("acefilter"); } + @Override + public boolean spOnly() { + return true; + } + + } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommand.java index 65a06d0..18da6f1 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/sp/ServiceProxyCommand.java @@ -1,5 +1,7 @@ package com.indexdata.mkjsf.pazpar2.commands.sp; public interface ServiceProxyCommand { + + public boolean spOnly(); } diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java b/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java index 04c9c3f..f052c37 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/state/StateManager.java @@ -65,12 +65,12 @@ public class StateManager implements Serializable { */ public void checkIn(Pazpar2Command command) { if (getCurrentState().stateMutating(command)) { - logger.debug("State changed by: " + command.getCommandName()); + logger.info("State changed by: " + command.getCommandName()); Pazpar2State state = new Pazpar2State(getCurrentState(),command); states.put(state.getKey(), state); currentKey = state.getKey(); hasPendingStateChange(command.getCommandName(),new Boolean(true)); - logger.debug("Updating " + listeners.size() + " listener(s) with state change from " + command); + logger.info("Updating " + listeners.size() + " listener(s) with state change from " + command); updateListeners(command.getCommandName()); } else { logger.debug("Command " + command.getCommandName() + " not found to change the state [" + command.getEncodedQueryString() + "]"); @@ -100,18 +100,18 @@ public class StateManager implements Serializable { */ public void setCurrentStateKey(String key) { if (currentKey.equals(key)) { - logger.debug("Ignoring request from UI to set state key, already has that key [" + key + "]"); + logger.info("Ignoring request from UI to set state key, already has that key [" + key + "]"); } else { - logger.debug("Request from UI to change state key from: [" + currentKey + "] to ["+key+"]"); + logger.info("Request from UI to change state key from: [" + currentKey + "] to ["+key+"]"); if (states.get(key)==null) { logger.error("Have no state registered for the key ["+ key +"]."); if (key == null || key.length()==0) { - logger.info("Recived an empty key, retaining currentKey [" + currentKey + "]"); + logger.debug("Recived an empty key, retaining currentKey [" + currentKey + "]"); key = currentKey; } else { if (states.get(currentKey) != null) { if (key.equals("#1")) { - logger.info("Initial key created [" + key + "], but already got a state registered for the current key [" + currentKey + "]. Retaining current key."); + logger.debug("Initial key created [" + key + "], but already got a state registered for the current key [" + currentKey + "]. Retaining current key."); key = currentKey; } else { logger.info("Current search state cached under both new key [" + key + "] and current key [" + currentKey + "]"); -- 1.7.10.4