public int getStatusCode();\r
public String getContentType();\r
public String getResponseString();\r
+ public byte[] getBinaryResponse();\r
+ public boolean isBinary();\r
}\r
package com.indexdata.mkjsf.pazpar2;\r
\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.IOException;\r
-\r
import org.apache.log4j.Logger;\r
\r
-import com.indexdata.masterkey.pazpar2.client.exceptions.Pazpar2ErrorException;\r
import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;\r
-import com.indexdata.mkjsf.pazpar2.data.CommandError;\r
\r
public class CommandThread extends Thread {\r
\r
private static Logger logger = Logger.getLogger(CommandThread.class);\r
Pazpar2Command command;\r
SearchClient client;\r
- private ByteArrayOutputStream baos = new ByteArrayOutputStream();\r
- private StringBuilder response = new StringBuilder(""); \r
+ CommandResponse commandResponse = null; \r
\r
public CommandThread (Pazpar2Command command, SearchClient client) {\r
this.command = command;\r
*/\r
public void run() {\r
\r
- if (command.getName().equals("search")) {\r
+ if (command.getCommandName().equals("search")) {\r
client.setSearchCommand(command);\r
}\r
- try {\r
- long start = System.currentTimeMillis();\r
- CommandResponse commandResponse = client.executeCommand(command, baos);\r
- if (commandResponse.getStatusCode()==200) {\r
- response.append(commandResponse.getResponseString()); \r
- } else if (commandResponse.getStatusCode()==417) { \r
- logger.error("Pazpar2 status code 417: " + baos.toString("UTF-8"));\r
- response.append(CommandError.insertPazpar2ErrorXml(command.getName(), "Expectation failed (417)", commandResponse.getResponseString())); \r
- } else {\r
- String resp = baos.toString("UTF-8");\r
- logger.error("Pazpar2 status code was " + commandResponse.getStatusCode() + ": " + resp);\r
- throw new Pazpar2ErrorException(resp,commandResponse.getStatusCode(),resp,null);\r
- } \r
- long end = System.currentTimeMillis(); \r
- logger.debug("Executed " + command.getName() + " in " + (end-start) + " ms." );\r
- } catch (IOException e) {\r
- response.append(CommandError.createErrorXml(command.getName(), "io", e.getMessage())); \r
- logger.error(response.toString());\r
- } catch (Pazpar2ErrorException e) {\r
- response.append(CommandError.createErrorXml(command.getName(), "pazpar2error", e.getMessage())); \r
- logger.error(response.toString());\r
- } catch (Exception e) {\r
- response.append(CommandError.createErrorXml(command.getName(), "general", e.getMessage())); \r
- logger.error(response.toString()); \r
- }\r
+ long start = System.currentTimeMillis();\r
+ commandResponse = client.executeCommand(command);\r
+ long end = System.currentTimeMillis();\r
+ logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." );\r
}\r
\r
/**\r
* \r
* @return Pazpar2 response as an XML string, possibly a generated error XML\r
*/\r
- public String getResponse () {\r
- return response.toString();\r
+ public CommandResponse getCommandResponse () {\r
+ return commandResponse;\r
}\r
\r
public Pazpar2Command getCommand() {\r
}\r
}\r
for (CommandThread thread : threadList) {\r
- String commandName = thread.getCommand().getName();\r
- String response = thread.getResponse();\r
- responseLogger.debug("Response was: " + response);\r
- Pazpar2ResponseData responseObject = Pazpar2ResponseParser.getParser().getDataObject(response);\r
+ String commandName = thread.getCommand().getCommandName();\r
+ CommandResponse response = thread.getCommandResponse();\r
+ responseLogger.debug("Response was: " + response.getResponseString());\r
+ Pazpar2ResponseData responseObject = Pazpar2ResponseParser.getParser().getDataObject(response.getResponseString());\r
if (Pazpar2ResponseParser.docTypes.contains(responseObject.getType())) {\r
pzresp.put(commandName, responseObject);\r
} else {\r
} catch (NullPointerException npe) {\r
npe.printStackTrace();\r
return "";\r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ return "";\r
}\r
\r
}\r
import com.indexdata.mkjsf.config.ConfigurationReader;\r
import com.indexdata.mkjsf.errors.ConfigurationException;\r
import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;\r
+import com.indexdata.mkjsf.pazpar2.data.CommandError;\r
import com.indexdata.mkjsf.utils.Utils;\r
\r
public class Pz2Client implements SearchClient {\r
\r
@Override\r
public void setSearchCommand(Pazpar2Command command) {\r
- ClientCommand clientCommand = new ClientCommand(command.getName(), command.getEncodedQueryString());\r
+ ClientCommand clientCommand = new ClientCommand(command.getCommandName(), command.getEncodedQueryString());\r
client.setSearchCommand(clientCommand); \r
}\r
\r
@Override\r
- public CommandResponse executeCommand(Pazpar2Command command, ByteArrayOutputStream baos) \r
- throws Pazpar2ErrorException, IOException {\r
- ClientCommand clientCommand = new ClientCommand(command.getName(), command.getEncodedQueryString());\r
- Pazpar2HttpResponse pz2HttpResponse = client.executeCommand(clientCommand, baos);\r
- return new Pz2CommandResponse(pz2HttpResponse,baos);\r
+ public CommandResponse executeCommand(Pazpar2Command command) {\r
+ Pz2CommandResponse commandResponse = null;\r
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();\r
+ ClientCommand clientCommand = new ClientCommand(command.getCommandName(), command.getEncodedQueryString());\r
+ Pazpar2HttpResponse pz2HttpResponse = null;\r
+ long start = System.currentTimeMillis();\r
+ try {\r
+ pz2HttpResponse = client.executeCommand(clientCommand, baos);\r
+ if (pz2HttpResponse.getStatusCode()==200) {\r
+ commandResponse = new Pz2CommandResponse(pz2HttpResponse,baos);\r
+ } else if (pz2HttpResponse.getStatusCode()==417) {\r
+ logger.error("Pazpar2 status code 417: " + baos.toString("UTF-8"));\r
+ commandResponse = new Pz2CommandResponse(pz2HttpResponse.getStatusCode(),CommandError.insertPazpar2ErrorXml(command.getCommandName(), "Pazpar2: Expectation failed (417)", baos.toString("UTF-8")),"text/xml"); \r
+ } else {\r
+ String resp = baos.toString("UTF-8");\r
+ logger.error("Pazpar2 status code was " + pz2HttpResponse.getStatusCode() + ": " + resp);\r
+ commandResponse = new Pz2CommandResponse(pz2HttpResponse.getStatusCode(),CommandError.insertPazpar2ErrorXml(command.getCommandName(), "Pazpar2 error occurred", baos.toString("UTF-8")),"text/xml");\r
+ throw new Pazpar2ErrorException(resp,pz2HttpResponse.getStatusCode(),resp,null);\r
+ } \r
+ } catch (IOException e) {\r
+ logger.error(e.getMessage());\r
+ e.printStackTrace();\r
+ commandResponse = new Pz2CommandResponse(-1,CommandError.createErrorXml(command.getCommandName(), "io", e.getMessage()),"text/xml"); \r
+ } catch (Pazpar2ErrorException e) {\r
+ logger.error(e.getMessage());\r
+ e.printStackTrace();\r
+ logger.error("Creating error XML");\r
+ commandResponse = new Pz2CommandResponse(-1,CommandError.createErrorXml(command.getCommandName(), "io", e.getMessage()),"text/xml");\r
+ }\r
+ long end = System.currentTimeMillis(); \r
+ logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." );\r
+ return commandResponse;\r
}\r
\r
public Pz2Client cloneMe() {\r
public class Pz2CommandResponse implements CommandResponse {\r
\r
private Pazpar2HttpResponse pz2httpResponse = null;\r
- private ByteArrayOutputStream content = null;\r
+ private int statusCode;\r
+ private String contentType;\r
+ private byte[] content = null;\r
+ private String contentString = null;\r
\r
public Pz2CommandResponse(Pazpar2HttpResponse pz2response, ByteArrayOutputStream content) {\r
pz2httpResponse = pz2response;\r
- this.content = content;\r
+ this.content = content.toByteArray();\r
+ this.statusCode = pz2httpResponse.getStatusCode();\r
+ this.contentType = pz2httpResponse.getContentType();\r
+ }\r
+ \r
+ public Pz2CommandResponse(Pazpar2HttpResponse pz2response, String content) {\r
+ pz2httpResponse = pz2response;\r
+ this.contentString = content;\r
+ }\r
+ \r
+ public Pz2CommandResponse(int statusCode, String content, String contentType) {\r
+ this.statusCode = statusCode;\r
+ this.contentString = content;\r
+ this.contentType = contentType;\r
}\r
\r
@Override\r
public int getStatusCode() { \r
- return pz2httpResponse.getStatusCode();\r
+ return statusCode;\r
}\r
\r
@Override\r
public String getContentType() {\r
- return pz2httpResponse.getContentType();\r
+ return contentType;\r
}\r
\r
@Override\r
public String getResponseString() {\r
- try {\r
- return content.toString("UTF-8");\r
- } catch (UnsupportedEncodingException e) { \r
- e.printStackTrace();\r
- return null;\r
+ if (content == null) {\r
+ return contentString;\r
+ } else {\r
+ try {\r
+ return new String(content,"UTF-8");\r
+ } catch (UnsupportedEncodingException e) { \r
+ e.printStackTrace();\r
+ return "<error>unsupported encoding</error>";\r
+ }\r
}\r
}\r
\r
+ @Override\r
+ public byte[] getBinaryResponse() {\r
+ return content;\r
+ }\r
+\r
+ @Override\r
+ public boolean isBinary() { \r
+ return !contentType.contains("xml");\r
+ }\r
\r
}\r
package com.indexdata.mkjsf.pazpar2;\r
\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.IOException;\r
import java.io.Serializable;\r
\r
-import com.indexdata.masterkey.pazpar2.client.exceptions.Pazpar2ErrorException;\r
import com.indexdata.mkjsf.config.Configurable;\r
import com.indexdata.mkjsf.config.Configuration;\r
import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;\r
public interface SearchClient extends Configurable, Serializable {\r
\r
public void setSearchCommand(Pazpar2Command command);\r
- public CommandResponse executeCommand(Pazpar2Command command, ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException;\r
+ public CommandResponse executeCommand(Pazpar2Command command);\r
\r
// Use cloneMe() method if injecting the client with CDI.\r
// The client is used for asynchronously sending off requests\r
\r
public abstract Pazpar2Command copy ();\r
\r
- public String getName() {\r
+ public String getCommandName() {\r
return name;\r
}\r
\r
if (stateMgr != null) {\r
stateMgr.checkIn(command);\r
} else {\r
- logger.info("Command '" + command.getName() + "' not affecting state (history) as no state manager was defined for this command.");\r
+ logger.info("Command '" + command.getCommandName() + "' not affecting state (history) as no state manager was defined for this command.");\r
}\r
}\r
\r
errorXml.append("<" + commandName + ">"+nl);\r
errorXml.append(" <applicationerror>"+nl);\r
errorXml.append(" <commandname>" + commandName + "</commandname>"+nl);\r
- errorXml.append(" <exception>" + XmlUtils.escape(exceptionName) + "</exception>"+nl); \r
- errorXml.append(" <errormessage>" + XmlUtils.escape(errorMessage) + "</errormessage>"+nl); \r
+ errorXml.append(" <exception>" + (exceptionName != null ? XmlUtils.escape(exceptionName) : "") + "</exception>"+nl); \r
+ errorXml.append(" <errormessage>" + (errorMessage != null ? XmlUtils.escape(errorMessage) : "") + "</errormessage>"+nl); \r
errorXml.append(" </applicationerror>"+nl);\r
errorXml.append("</" + commandName + ">"+nl);\r
return errorXml.toString(); \r
import static com.indexdata.mkjsf.utils.Utils.nl;\r
\r
import java.io.BufferedReader;\r
-import java.io.ByteArrayOutputStream;\r
import java.io.File;\r
import java.io.FileReader;\r
import java.io.IOException;\r
import java.util.Map;\r
import java.util.StringTokenizer;\r
\r
+import org.apache.http.Header;\r
import org.apache.http.HttpEntity;\r
import org.apache.http.HttpResponse;\r
import org.apache.http.StatusLine;\r
import org.apache.http.util.EntityUtils;\r
import org.apache.log4j.Logger;\r
\r
-import com.indexdata.masterkey.pazpar2.client.exceptions.Pazpar2ErrorException;\r
import com.indexdata.mkjsf.config.Configuration;\r
import com.indexdata.mkjsf.config.ConfigurationReader;\r
import com.indexdata.mkjsf.errors.ConfigurationException;\r
import com.indexdata.mkjsf.pazpar2.commands.CommandParameter;\r
import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;\r
import com.indexdata.mkjsf.pazpar2.commands.sp.AuthCommand;\r
+import com.indexdata.mkjsf.pazpar2.data.CommandError;\r
import com.indexdata.mkjsf.pazpar2.sp.auth.ServiceProxyUser;\r
import com.indexdata.mkjsf.utils.Utils;\r
\r
ipAuth = new AuthCommand(null);\r
ipAuth.setParameterInState(new CommandParameter("action","=","ipauth"));\r
} catch (ConfigurationException c) {\r
+ // TODO: \r
c.printStackTrace();\r
} \r
}\r
}\r
\r
public boolean authenticate (ServiceProxyUser user) {\r
- try { \r
- logger.info("Authenticating [" + user.getProperty("name") + "]"); \r
- Pazpar2Command auth = new AuthCommand(null);\r
- auth.setParametersInState(new CommandParameter("action","=","login"), \r
- new CommandParameter("username","=",user.getProperty("name")), \r
- new CommandParameter("password","=",user.getProperty("password"))); \r
- byte[] response = send(auth);\r
- String responseStr = new String(response,"UTF-8");\r
- logger.info(responseStr); \r
- if (responseStr.contains("FAIL")) {\r
- user.credentialsAuthenticationSucceeded(false);\r
- return false;\r
- } else {\r
- user.credentialsAuthenticationSucceeded(true);\r
- return true;\r
- } \r
- } catch (ClientProtocolException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- return false;\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
+ logger.info("Authenticating [" + user.getProperty("name") + "]"); \r
+ Pazpar2Command auth = new AuthCommand(null);\r
+ auth.setParametersInState(new CommandParameter("action","=","login"), \r
+ new CommandParameter("username","=",user.getProperty("name")), \r
+ new CommandParameter("password","=",user.getProperty("password"))); \r
+ ServiceProxyCommandResponse commandResponse = send(auth);\r
+ String responseStr = commandResponse.getResponseString();\r
+ logger.info(responseStr); \r
+ if (responseStr.contains("FAIL")) {\r
+ user.credentialsAuthenticationSucceeded(false);\r
return false;\r
- } \r
+ } else {\r
+ user.credentialsAuthenticationSucceeded(true);\r
+ return true;\r
+ } \r
}\r
\r
public boolean checkAuthentication (ServiceProxyUser user) { \r
- try {\r
- byte[] response = send(checkAuth);\r
- logger.info(new String(response,"UTF-8"));\r
- String responseStr = new String(response,"UTF-8"); \r
- if (responseStr.contains("FAIL")) { \r
- user.authenticationCheckFailed();\r
- return false;\r
- } else { \r
- return true;\r
- } \r
- } catch (ClientProtocolException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- return false;\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
+ ServiceProxyCommandResponse commandResponse = send(checkAuth); \r
+ String responseStr = commandResponse.getResponseString(); \r
+ logger.info(responseStr);\r
+ if (responseStr.contains("FAIL")) { \r
+ user.authenticationCheckFailed();\r
return false;\r
- } \r
+ } else { \r
+ return true;\r
+ } \r
}\r
\r
public boolean ipAuthenticate (ServiceProxyUser user) {\r
- try {\r
- byte[] response = send(ipAuth);\r
- logger.info(new String(response,"UTF-8"));\r
- String responseStr = new String(response,"UTF-8"); \r
- if (responseStr.contains("FAIL")) {\r
- user.ipAuthenticationSucceeded(false); \r
- return false;\r
- } else {\r
- user.ipAuthenticationSucceeded(true);\r
- return true;\r
- } \r
- } catch (ClientProtocolException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- return false;\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
+ ServiceProxyCommandResponse commandResponse = send(ipAuth); \r
+ String responseStr = commandResponse.getResponseString();\r
+ logger.info(responseStr);\r
+ if (responseStr.contains("FAIL")) {\r
+ user.ipAuthenticationSucceeded(false); \r
return false;\r
- } \r
- \r
+ } else {\r
+ user.ipAuthenticationSucceeded(true);\r
+ return true;\r
+ } \r
}\r
\r
public boolean isAuthenticatingClient () {\r
* @throws ClientProtocolException\r
* @throws IOException\r
*/\r
- private byte[] send(Pazpar2Command command) throws ClientProtocolException, IOException {\r
+ private ServiceProxyCommandResponse send(Pazpar2Command command) {\r
+ ServiceProxyCommandResponse commandResponse = null;\r
String url = selectedServiceUrl + "?" + command.getEncodedQueryString(); \r
logger.info("Sending request "+url); \r
HttpGet httpget = new HttpGet(url); \r
- byte[] response = client.execute(httpget, handler); \r
- return response;\r
+ byte[] response = null;\r
+ try {\r
+ response = client.execute(httpget, handler);\r
+ if (handler.getStatusCode()==200) {\r
+ commandResponse = new ServiceProxyCommandResponse(handler.getStatusCode(),response,handler.getContentType());\r
+ } else {\r
+ logger.error("Service Proxy status code: " + handler.getStatusCode());\r
+ commandResponse = new ServiceProxyCommandResponse(handler.getStatusCode(),CommandError.insertPazpar2ErrorXml(command.getCommandName(), "Service Proxy error occurred", new String(response,"UTF-8")),"text/xml"); \r
+ } \r
+ } catch (Exception e) {\r
+ e.printStackTrace();\r
+ commandResponse = new ServiceProxyCommandResponse(-1,CommandError.createErrorXml(command.getCommandName(), e.getClass().getSimpleName(), (e.getMessage()!= null ? e.getMessage() : "") + (e.getCause()!=null ? e.getCause().getMessage() : "")),"text/xml");\r
+ }\r
+ return commandResponse; \r
}\r
\r
public class ProxyPz2ResponseHandler implements ResponseHandler<byte[]> {\r
private StatusLine statusLine = null;\r
+ private Header contentType = null;\r
public byte[] handleResponse(HttpResponse response) throws ClientProtocolException, IOException {\r
byte[] resp = null;\r
HttpEntity entity = response.getEntity(); \r
statusLine = response.getStatusLine();\r
if (entity != null) { \r
resp = EntityUtils.toByteArray(entity); \r
- } \r
- EntityUtils.consume(entity);\r
+ contentType = response.getEntity().getContentType(); \r
+ } \r
+ EntityUtils.consume(entity); \r
return resp;\r
}\r
public int getStatusCode() {\r
public String getReasonPhrase() {\r
return statusLine.getReasonPhrase();\r
}\r
+ public String getContentType () {\r
+ return (contentType != null ? contentType.getValue() : "Content-Type not known"); \r
+ }\r
}\r
\r
public int getStatusCode () {\r
}\r
\r
@Override\r
- public CommandResponse executeCommand(Pazpar2Command command,\r
- ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException {\r
- byte[] response = send(command);\r
- baos.write(response);\r
- return new ServiceProxyClientCommandResponse(getStatusCode(), new String(response,"UTF-8")); \r
+ public CommandResponse executeCommand(Pazpar2Command command) {\r
+ return send(command);\r
}\r
\r
public ServiceProxyClient cloneMe() {\r
+++ /dev/null
-package com.indexdata.mkjsf.pazpar2.sp;\r
-\r
-import com.indexdata.mkjsf.pazpar2.CommandResponse;\r
-\r
-public class ServiceProxyClientCommandResponse implements CommandResponse {\r
-\r
- private int statusCode = 0;\r
- private String content = null;\r
- \r
- public ServiceProxyClientCommandResponse(int statusCode, String content) {\r
- this.statusCode = statusCode;\r
- this.content = content;\r
- }\r
-\r
- @Override\r
- public int getStatusCode() {\r
- return statusCode;\r
- }\r
-\r
- @Override\r
- public String getContentType() {\r
- return "text/xml;charset=UTF-8"; \r
- }\r
-\r
- @Override\r
- public String getResponseString() {\r
- return content;\r
- }\r
-\r
-}\r
--- /dev/null
+package com.indexdata.mkjsf.pazpar2.sp;\r
+\r
+import java.io.UnsupportedEncodingException;\r
+\r
+import com.indexdata.mkjsf.pazpar2.CommandResponse;\r
+\r
+public class ServiceProxyCommandResponse implements CommandResponse {\r
+\r
+ private int statusCode = 0;\r
+ private byte[] content = null;\r
+ private String responseString = null;\r
+ private String contentType = "";\r
+ \r
+ public ServiceProxyCommandResponse(int statusCode, byte[] content, String contentType) {\r
+ this.statusCode = statusCode;\r
+ this.content = content;\r
+ this.contentType = contentType;\r
+ }\r
+ \r
+ public ServiceProxyCommandResponse(int statusCode, String contentString, String contentType) {\r
+ this.statusCode = statusCode;\r
+ this.contentType = contentType;\r
+ this.responseString = contentString;\r
+ }\r
+ \r
+ @Override\r
+ public int getStatusCode() {\r
+ return statusCode;\r
+ }\r
+\r
+ @Override\r
+ public String getContentType() {\r
+ return contentType; \r
+ }\r
+\r
+ @Override\r
+ public String getResponseString() {\r
+ if (content == null) {\r
+ return responseString;\r
+ } else {\r
+ try {\r
+ return new String(content,"UTF-8");\r
+ } catch (UnsupportedEncodingException e) { \r
+ e.printStackTrace();\r
+ return "<applicationerror><error>unsupported encoding</error></applicationerror>";\r
+ }\r
+ }\r
+ }\r
+\r
+ @Override\r
+ public byte[] getBinaryResponse() { \r
+ return content;\r
+ }\r
+\r
+ @Override\r
+ public boolean isBinary() {\r
+ // TODO Auto-generated method stub\r
+ return false;\r
+ }\r
+\r
+}\r
for (String commandName : previousState.commands.keySet()) {\r
this.commands.put(commandName, previousState.commands.get(commandName).copy());\r
}\r
- this.commands.put(newCommand.getName(),newCommand);\r
+ this.commands.put(newCommand.getCommandName(),newCommand);\r
this.key = getKey(); \r
}\r
\r
StringBuilder querystatebuilder = new StringBuilder("");\r
for (Pazpar2Command command : commands.values()) {\r
if (command.hasParameters()) {\r
- querystatebuilder.append("||"+command.getName()+"::");\r
+ querystatebuilder.append("||"+command.getCommandName()+"::");\r
querystatebuilder.append(command.getValueWithExpressions());\r
} \r
} \r
- key = "#"+querystatebuilder.toString().hashCode();\r
+ key = "#"+querystatebuilder.toString();\r
return key;\r
} else { \r
return key;\r
public boolean stateMutating (Pazpar2Command command) {\r
if (command == null) {\r
return true;\r
- } else if (commands.get(command.getName()) == null) {\r
+ } else if (commands.get(command.getCommandName()) == null) {\r
return true;\r
- } else if ((command.equals(commands.get(command.getName())))) {\r
+ } else if ((command.equals(commands.get(command.getCommandName())))) {\r
return false; \r
} else {\r
return true;\r
*/\r
public void checkIn(Pazpar2Command command) {\r
if (getCurrentState().stateMutating(command)) {\r
- logger.debug("State changed by: " + command.getName());\r
+ logger.debug("State changed by: " + command.getCommandName());\r
Pazpar2State state = new Pazpar2State(getCurrentState(),command);\r
states.put(state.getKey(), state);\r
currentKey = state.getKey();\r
- hasPendingStateChange(command.getName(),new Boolean(true)); \r
+ hasPendingStateChange(command.getCommandName(),new Boolean(true)); \r
logger.debug("Updating " + listeners.size() + " listener(s) with state change from " + command);\r
- updateListeners(command.getName()); \r
+ updateListeners(command.getCommandName()); \r
} else {\r
- logger.debug("Command " + command.getName() + " not found to change the state [" + command.getEncodedQueryString() + "]");\r
+ logger.debug("Command " + command.getCommandName() + " not found to change the state [" + command.getEncodedQueryString() + "]");\r
}\r
}\r
\r
} else {\r
logger.debug("State key change. Was: [" + currentKey + "]. Will be ["+key+"]");\r
if (states.get(key)==null) {\r
- logger.error("The back-end received an unknow state key."); \r
+ logger.error("The back-end received an unknow state key: ["+ key +"]."); \r
} else {\r
if (states.get(key).getCommand("search").equals(states.get(currentKey).getCommand("search"))) {\r
logger.debug("No search change detected");\r