X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fcommands%2FInitCommand.java;h=ab2e5a1bbd423a63513a9f8c40c24ca254fde3f1;hb=86f289cd42ba95846c80d22129ed565e4e9d6dde;hp=f1f31ef9f54c67d6e990e897fc5c9c8ff6213f5a;hpb=ccb28ae8d5d46d29c40bd8b1637522c212b80636;p=mkjsf-moved-to-github.git 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 f1f31ef..ab2e5a1 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java @@ -1,31 +1,94 @@ package com.indexdata.mkjsf.pazpar2.commands; -import com.indexdata.mkjsf.pazpar2.state.StateManager; +import org.apache.log4j.Logger; -public class InitCommand extends Pazpar2Command { +import com.indexdata.mkjsf.pazpar2.commands.sp.InitCommandSp; +import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand; - private static final long serialVersionUID = -4915976465898889987L; +/** + * Represents a Pazpar2 init command, can be accessed by pzreq.init + * + * @author Niels Erik + * + */ +public class InitCommand extends Pazpar2Command implements ServiceProxyCommand { - public InitCommand(StateManager stateMgr) { - super("init",stateMgr); + private static final long serialVersionUID = -4915976465898889987L; + private static Logger logger = Logger.getLogger(InitCommand.class); + private InitCommandSp spCommand = null; + + public InitCommand() { + super("init"); } + /** + * Sets the clear parameter. See Pazpar2 documentation for details. + * + * @param clear + */ public void setClear(String clear) { - setParameter(new CommandParameter("clear","=",clear)); + setParameterInState(new CommandParameter("clear","=",clear)); + } + + /** + * Returns the clear parameter value. + */ + public String getClear() { + return getParameterValue("clear"); } + /** + * Sets the service parameter. See Pazpar2 documentation for details. + * @param serviceId + */ public void setService(String serviceId) { - setParameter(new CommandParameter("service","=",serviceId)); + setParameterInState(new CommandParameter("service","=",serviceId)); + } + + /** + * Returns the service parameter value. + */ + public String getService() { + return getParameterValue("service"); } + /** + * Disabled, not supported for init + */ @Override public void setSession (String sessionId) { throw new UnsupportedOperationException("Cannot set session id on init command"); } - + + /** + * Disabled, not supported for init + */ @Override public String getSession () { throw new UnsupportedOperationException("Cannot set or get session id on init command"); + } + + public InitCommand copy () { + logger.info("Copying init command"); + InitCommand newCommand = new InitCommand(); + for (String parameterName : parameters.keySet()) { + newCommand.setParameterInState(parameters.get(parameterName).copy()); + } + newCommand.spCommand = this.spCommand; + return newCommand; + } + + public ServiceProxyCommand getSp() { + if (spCommand==null) { + spCommand = new InitCommandSp(this); + } + return spCommand; } + @Override + public boolean spOnly() { + return false; + } + + }