From: Niels Erik G. Nielsen Date: Mon, 15 Apr 2013 13:22:09 +0000 (-0400) Subject: Simplifies state handling further X-Git-Tag: v0.0.7~158 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=b029cdbe3b8431eeaacdbd299a284892b1b9cd27;p=mkjsf-moved-to-github.git Simplifies state handling further Postpones cloning of a command to the time when it's actually modified, then pushes it to the state handler transparently. Obviates the need to checkout a command for modification vs. getting it read-only. Recently introduced CommandReadOnly interface is consequently dropped again. --- diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/CommandThread.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/CommandThread.java index 72a4337..323ef78 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/CommandThread.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/CommandThread.java @@ -6,18 +6,18 @@ import java.io.IOException; import org.apache.log4j.Logger; import com.indexdata.masterkey.pazpar2.client.exceptions.Pazpar2ErrorException; -import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly; +import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command; import com.indexdata.pz2utils4jsf.pazpar2.data.CommandError; public class CommandThread extends Thread { private static Logger logger = Logger.getLogger(CommandThread.class); - CommandReadOnly command; + Pazpar2Command command; SearchClient client; private ByteArrayOutputStream baos = new ByteArrayOutputStream(); private StringBuilder response = new StringBuilder(""); - public CommandThread (CommandReadOnly command, SearchClient client) { + public CommandThread (Pazpar2Command command, SearchClient client) { this.command = command; this.client = client; } @@ -72,7 +72,7 @@ public class CommandThread extends Thread { return response.toString(); } - public CommandReadOnly getCommand() { + public Pazpar2Command getCommand() { return command; } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java index 97f0880..3d7d79c 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Bean.java @@ -97,9 +97,9 @@ public class Pz2Bean implements Pz2Interface, StateListener, Serializable { pzresp.reset(); // resets some record and show command parameters without // changing state or creating state change feedback - pzreq.getRecordInState().removeParametersSilently(); - pzreq.getShowInState().setParameterSilently(new CommandParameter("start","=",0)); - logger.debug(Utils.objectId(this) + " is searching using "+pzreq.getCommandReadOnly("search").getUrlEncodedParameterValue("query")); + pzreq.getRecord().removeParametersInState(); + pzreq.getShow().setParameterInState(new CommandParameter("start","=",0)); + logger.debug(Utils.objectId(this) + " is searching using "+pzreq.getCommand("search").getUrlEncodedParameterValue("query")); doCommand("search"); } @@ -128,7 +128,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Serializable { List threadList = new ArrayList(); StringTokenizer tokens = new StringTokenizer(commands,","); while (tokens.hasMoreElements()) { - threadList.add(new CommandThread(pzreq.getCommandReadOnly(tokens.nextToken()),searchClient)); + threadList.add(new CommandThread(pzreq.getCommand(tokens.nextToken()),searchClient)); } for (CommandThread thread : threadList) { thread.start(); @@ -171,7 +171,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Serializable { public boolean commandsAreValid(String commands) { if (commands.equals("record")) { - if (!pzreq.getCommandReadOnly("record").hasParameterSet("id")) { + if (!pzreq.getCommand("record").hasParameterSet("id")) { logger.error("Attempt to send record command without the id parameter"); return false; } @@ -192,7 +192,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Serializable { @Override public boolean hasRecord (String recId) { - return pzreq.getCommandReadOnly("record").hasParameters() && pzresp.getRecord().getRecId().equals(recId); + return pzreq.getCommand("record").hasParameters() && pzresp.getRecord().getRecId().equals(recId); } public String getCurrentStateKey () { @@ -224,7 +224,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Serializable { protected boolean hasQuery() { - return pzreq.getCommandReadOnly("search").hasParameterSet("query"); + return pzreq.getCommand("search").hasParameterSet("query"); } @@ -252,7 +252,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Serializable { if (stateMgr.hasPendingStateChange("record") && ! commands.equals("record")) { logger.debug("Found pending record ID change. Doing record before updating " + commands); stateMgr.hasPendingStateChange("record",false); - if (pzreq.getCommandReadOnly("record").hasParameterSet("id")) { + if (pzreq.getCommand("record").hasParameterSet("id")) { update("record"); } else { pzresp.put("record", new RecordResponse()); @@ -261,7 +261,7 @@ public class Pz2Bean implements Pz2Interface, StateListener, Serializable { } protected String doCommand(String commandName) { - logger.debug(pzreq.getCommandReadOnly(commandName).getEncodedQueryString() + ": Results for "+ pzreq.getCommandReadOnly("search").getEncodedQueryString()); + logger.debug(pzreq.getCommand(commandName).getEncodedQueryString() + ": Results for "+ pzreq.getCommand("search").getEncodedQueryString()); return update(commandName); } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java index 39adf03..a00f2d5 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2Client.java @@ -23,7 +23,7 @@ import com.indexdata.masterkey.pazpar2.client.exceptions.ProxyErrorException; import com.indexdata.pz2utils4jsf.config.Configuration; import com.indexdata.pz2utils4jsf.config.ConfigurationReader; import com.indexdata.pz2utils4jsf.errors.ConfigurationException; -import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly; +import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command; import com.indexdata.pz2utils4jsf.utils.Utils; public class Pz2Client implements SearchClient { @@ -81,13 +81,13 @@ public class Pz2Client implements SearchClient { } @Override - public void setSearchCommand(CommandReadOnly command) { + public void setSearchCommand(Pazpar2Command command) { ClientCommand clientCommand = new ClientCommand(command.getName(), command.getEncodedQueryString()); client.setSearchCommand(clientCommand); } @Override - public CommandResponse executeCommand(CommandReadOnly command, ByteArrayOutputStream baos) + public CommandResponse executeCommand(Pazpar2Command command, ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException { ClientCommand clientCommand = new ClientCommand(command.getName(), command.getEncodedQueryString()); Pazpar2HttpResponse pz2HttpResponse = client.executeCommand(clientCommand, baos); diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java index 3eb0bba..36e472b 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/Pz2ProxyBean.java @@ -51,8 +51,8 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface { public String login(String navigateTo) { logger.info("doing login"); ((ServiceProxyClient)searchClient).authenticate(user); - pzreq.getRecordInState().removeParametersSilently(); - pzreq.getSearchInState().removeParametersSilently(); + pzreq.getRecord().removeParametersInState(); + pzreq.getSearch().removeParametersInState(); pzresp.reset(); return navigateTo; } @@ -61,8 +61,8 @@ public class Pz2ProxyBean extends Pz2Bean implements ServiceProxyInterface { public void setServiceProxyUrl(String url) { logger.info("Setting Service Proxy url: " + url); serviceProxyUrl = url; - pzreq.getRecordInState().removeParametersSilently(); - pzreq.getSearchInState().removeParametersSilently(); + pzreq.getRecord().removeParametersInState(); + pzreq.getSearch().removeParametersInState(); pzresp.reset(); } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java index acce660..c7d0cf9 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/SearchClient.java @@ -7,12 +7,12 @@ import java.io.Serializable; import com.indexdata.masterkey.pazpar2.client.exceptions.Pazpar2ErrorException; import com.indexdata.pz2utils4jsf.config.Configurable; import com.indexdata.pz2utils4jsf.config.Configuration; -import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly; +import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command; public interface SearchClient extends Configurable, Serializable { - public void setSearchCommand(CommandReadOnly command); - public CommandResponse executeCommand(CommandReadOnly command, ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException; + public void setSearchCommand(Pazpar2Command command); + public CommandResponse executeCommand(Pazpar2Command command, ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException; public SearchClient cloneMe(); public boolean isAuthenticatingClient(); public Configuration getConfiguration(); diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/CommandReadOnly.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/CommandReadOnly.java deleted file mode 100644 index 68f334b..0000000 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/CommandReadOnly.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.indexdata.pz2utils4jsf.pazpar2.commands; - -/** - * Interface to Pazpar2Command to be used when the given command - * should not change. Meant to avoid redundant cloning of commands - * for potential state changes. - * - * @author Niels Erik - * - */ -public interface CommandReadOnly { - - public String getName(); - public String getValueWithExpressions(); - public String getEncodedQueryString(); - public boolean hasParameters(); - public boolean hasParameterSet(String parameterName); - public String getParameterValue(String parameterName); - public String getUrlEncodedParameterValue(String parameterName); - -} diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Command.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Command.java index 97be62d..b4f67e9 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Command.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Command.java @@ -8,7 +8,7 @@ import org.apache.log4j.Logger; import com.indexdata.pz2utils4jsf.pazpar2.state.StateManager; -public class Pazpar2Command implements CommandReadOnly, Serializable { +public class Pazpar2Command implements Serializable { private static Logger logger = Logger.getLogger(Pazpar2Command.class); private static final long serialVersionUID = -6825491856480675917L; @@ -30,7 +30,7 @@ public class Pazpar2Command implements CommandReadOnly, Serializable { public Pazpar2Command copy () { Pazpar2Command newCommand = new Pazpar2Command(name,stateMgr); for (String parameterName : parameters.keySet()) { - newCommand.setParameterSilently(parameters.get(parameterName).copy()); + newCommand.setParameterInState(parameters.get(parameterName).copy()); } return newCommand; } @@ -40,21 +40,29 @@ public class Pazpar2Command implements CommandReadOnly, Serializable { } public void setParameter (CommandParameter parameter) { + Pazpar2Command thisCommand = this.copy(); logger.debug(name + " setting parameter " + parameter.getName() + "=" + parameter.getValueWithExpressions() + " to " + this.getName()); - parameters.put(parameter.getName(),parameter); - stateMgr.checkIn(this); + thisCommand.parameters.put(parameter.getName(),parameter); + stateMgr.checkIn(thisCommand); } public void setParameters (CommandParameter... params) { + Pazpar2Command thisCommand = this.copy(); for (CommandParameter param : params) { logger.debug(name + " setting parameter " + param.getName() + "=" + param.getValueWithExpressions() + " to " + this.getName()); - parameters.put(param.getName(),param); + thisCommand.parameters.put(param.getName(),param); } - stateMgr.checkIn(this); + stateMgr.checkIn(thisCommand); } - - public void setParameterSilently (CommandParameter parameter) { + public void setParametersInState (CommandParameter... params) { + for (CommandParameter param : params) { + logger.debug(name + " setting parameter " + param.getName() + "=" + param.getValueWithExpressions() + " to " + this.getName()); + parameters.put(param.getName(),param); + } + } + + public void setParameterInState (CommandParameter parameter) { logger.debug(name + " setting parameter silently " + parameter.getName() + "=" + parameter.getValueWithExpressions() + " to " + this.getName()); parameters.put(parameter.getName(),parameter); } @@ -65,16 +73,18 @@ public class Pazpar2Command implements CommandReadOnly, Serializable { } public void removeParameter (String name) { - parameters.remove(name); - stateMgr.checkIn(this); + Pazpar2Command thisCommand = this.copy(); + thisCommand.parameters.remove(name); + stateMgr.checkIn(thisCommand); } public void removeParameters() { - parameters = new HashMap(); - stateMgr.checkIn(this); + Pazpar2Command thisCommand = this.copy(); + thisCommand.parameters = new HashMap(); + stateMgr.checkIn(thisCommand); } - public void removeParametersSilently() { + public void removeParametersInState() { parameters = new HashMap(); } @@ -119,13 +129,11 @@ public class Pazpar2Command implements CommandReadOnly, Serializable { return parameters.toString(); } - @Override public String getParameterValue(String parameterName) { return getParameter(parameterName).getValueWithExpressions(); } - @Override public String getUrlEncodedParameterValue(String parameterName) { return getParameter(parameterName).getEncodedQueryString(); } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Commands.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Commands.java index bac6787..a0397a9 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Commands.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/Pazpar2Commands.java @@ -40,88 +40,43 @@ public class Pazpar2Commands implements Serializable { } public InitCommand getInit() { - return (InitCommand) (stateMgr.checkOut(INIT)); + return (InitCommand) (stateMgr.getCommand(INIT)); } public PingCommand getPing() { - return (PingCommand) (stateMgr.checkOut(PING)); + return (PingCommand) (stateMgr.getCommand(PING)); } public SettingsCommand getSettings() { - return (SettingsCommand) (stateMgr.checkOut(SETTINGS)); + return (SettingsCommand) (stateMgr.getCommand(SETTINGS)); } public SearchCommand getSearch() { - return (SearchCommand) (stateMgr.checkOut(SEARCH)); + return (SearchCommand) (stateMgr.getCommand(SEARCH)); } - /** - * Gets a mutable SearchCommand from current state (no checkout) - * Can be used for updating Search parameters without spawning new state. - * @return - */ - public SearchCommand getSearchInState() { - return (SearchCommand) (stateMgr.getCurrentState().getCommand(SEARCH)); - } - public StatCommand getStat() { - return (StatCommand) (stateMgr.checkOut(STAT)); + return (StatCommand) (stateMgr.getCommand(STAT)); } public ShowCommand getShow() { - return (ShowCommand) (stateMgr.checkOut(SHOW)); - } - - /** - * Gets a mutable ShowCommand from current state (no checkout) - * Can be used for updating show parameters without spawning new state. - * @return - */ - public ShowCommand getShowInState () { - return (ShowCommand) (stateMgr.getCurrentState().getCommand(SHOW)); + return (ShowCommand) (stateMgr.getCommand(SHOW)); } - - /** - * Gets a detached (copied) record command from the current state - * - * @return - */ + public RecordCommand getRecord() { - return (RecordCommand) (stateMgr.checkOut(RECORD)); + return (RecordCommand) (stateMgr.getCommand(RECORD)); } - /** - * Gets a mutable RecordCommand from current state (no checkout) - * Can be used for updating record parameters without spawning new state. - * @return - */ - public RecordCommand getRecordInState() { - return (RecordCommand)stateMgr.getCurrentState().getCommand(RECORD); - } - - /** - * Gets a detached (copied) termlist command from the current state - * - * @return Mutable termlist command - */ public TermlistCommand getTermlist() { - return (TermlistCommand) (stateMgr.checkOut(TERMLIST)); + return (TermlistCommand) (stateMgr.getCommand(TERMLIST)); } - /** - * - * @return - */ public BytargetCommand getBytarget() { - return (BytargetCommand) (stateMgr.checkOut(BYTARGET)); + return (BytargetCommand) (stateMgr.getCommand(BYTARGET)); } public Pazpar2Command getCommand(String name) { - return stateMgr.checkOut(name); - } - - public CommandReadOnly getCommandReadOnly(String name) { return stateMgr.getCommand(name); } - + } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java index a54433d..5e2c03b 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/RecordCommand.java @@ -22,7 +22,7 @@ public class RecordCommand extends Pazpar2Command { public RecordCommand copy () { RecordCommand newCommand = new RecordCommand(stateMgr); for (String parameterName : parameters.keySet()) { - newCommand.setParameterSilently(parameters.get(parameterName).copy()); + newCommand.setParameterInState(parameters.get(parameterName).copy()); } return newCommand; } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java index 4c6d9c5..9b2cece 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/SearchCommand.java @@ -193,7 +193,7 @@ public class SearchCommand extends Pazpar2Command { public SearchCommand copy () { SearchCommand newCommand = new SearchCommand(stateMgr); for (String parameterName : parameters.keySet()) { - newCommand.setParameterSilently(parameters.get(parameterName).copy()); + newCommand.setParameterInState(parameters.get(parameterName).copy()); } newCommand.singleTargetFilter = this.singleTargetFilter; return newCommand; diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java index b783529..12dad19 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java @@ -8,7 +8,7 @@ public class ShowCommand extends Pazpar2Command { public ShowCommand(StateManager stateMgr) { super("show",stateMgr); - setParameterSilently(new CommandParameter("start","=","0")); + setParameterInState(new CommandParameter("start","=","0")); } /** @@ -86,13 +86,11 @@ public class ShowCommand extends Pazpar2Command { public int getNum () { return getParameter("num") != null ? Integer.parseInt(getParameter("num").value) : 0; } - - public ShowCommand copy () { ShowCommand newCommand = new ShowCommand(stateMgr); for (String parameterName : parameters.keySet()) { - newCommand.setParameterSilently(parameters.get(parameterName).copy()); + newCommand.setParameterInState(parameters.get(parameterName).copy()); } return newCommand; } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java index 5b2e518..8c2c2e2 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java @@ -39,7 +39,6 @@ import com.indexdata.pz2utils4jsf.errors.ConfigurationException; import com.indexdata.pz2utils4jsf.pazpar2.CommandResponse; import com.indexdata.pz2utils4jsf.pazpar2.SearchClient; import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter; -import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly; import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command; import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.AuthenticationEntity; import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.ServiceProxyUser; @@ -95,9 +94,9 @@ public class ServiceProxyClient implements SearchClient { logger.info("Authenticating [" + user.getProperty("name") + "]"); this.user = (ServiceProxyUser) user; Pazpar2Command auth = new Pazpar2Command("auth",null); - auth.setParameters(new CommandParameter("action","=","login"), - new CommandParameter("username","=",user.getProperty("name")), - new CommandParameter("password","=",user.getProperty("password"))); + auth.setParametersInState(new CommandParameter("action","=","login"), + new CommandParameter("username","=",user.getProperty("name")), + new CommandParameter("password","=",user.getProperty("password"))); byte[] response = send(auth); String responseStr = new String(response,"UTF-8"); logger.info(responseStr); @@ -155,7 +154,7 @@ public class ServiceProxyClient implements SearchClient { * @throws ClientProtocolException * @throws IOException */ - private byte[] send(CommandReadOnly command) throws ClientProtocolException, IOException { + private byte[] send(Pazpar2Command command) throws ClientProtocolException, IOException { String url = serviceUrl + "?" + command.getEncodedQueryString(); logger.info("Sending request "+url); HttpGet httpget = new HttpGet(url); @@ -192,12 +191,12 @@ public class ServiceProxyClient implements SearchClient { } @Override - public void setSearchCommand(CommandReadOnly command) { + public void setSearchCommand(Pazpar2Command command) { // Do nothing, Service Proxy is handling this } @Override - public CommandResponse executeCommand(CommandReadOnly command, + public CommandResponse executeCommand(Pazpar2Command command, ByteArrayOutputStream baos) throws Pazpar2ErrorException, IOException { byte[] response = send(command); baos.write(response); diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java index 23d59d1..f1ae6b6 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java @@ -11,7 +11,6 @@ import javax.enterprise.context.SessionScoped; import org.apache.log4j.Logger; -import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly; import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command; import com.indexdata.pz2utils4jsf.utils.Utils; @@ -76,21 +75,8 @@ public class StateManager implements Serializable { logger.debug("Command " + command.getName() + " not found to change the state [" + command.getEncodedQueryString() + "]"); } } - - /** - * Gets a detached copy of a command. For the change manager - * to become aware of any changes to the copy it must be - * checked back in with 'checkIn(Pazpar2Command)' - * - * @param commandName - * @return Copy this state's instance of the given command - */ - public Pazpar2Command checkOut (String commandName) { - logger.debug("Getting " + commandName + " from state manager."); - return getCurrentState().getCommand(commandName).copy(); - } - - public CommandReadOnly getCommand (String commandName) { + + public Pazpar2Command getCommand (String commandName) { return getCurrentState().getCommand(commandName); }