X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fcommands%2FInitCommand.java;h=e98a5cfae5884fb0cdf5ad884cd857a97e9b691e;hb=969f879c807d127cbf47c5656771fcf5adc27a02;hp=3166168ba6708cb7386193cb998f206e10ac9d20;hpb=d739ecb22a85d8f982add6d429e069edf7e0dde2;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 3166168..e98a5cf 100644
--- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java
+++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/InitCommand.java
@@ -1,52 +1,88 @@
package com.indexdata.mkjsf.pazpar2.commands;
+import org.apache.log4j.Logger;
+
+import com.indexdata.mkjsf.pazpar2.commands.sp.InitCommandSp;
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;
-import com.indexdata.mkjsf.pazpar2.state.StateManager;
+/**
+ * Represents a Pazpar2 init
command.
+ *
+ * @author Niels Erik
+ *
+ */
public class InitCommand extends Pazpar2Command implements ServiceProxyCommand {
private static final long serialVersionUID = -4915976465898889987L;
-
- public InitCommand(StateManager stateMgr) {
- super("init",stateMgr);
+ 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) {
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) {
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 () {
- InitCommand newCommand = new InitCommand(stateMgr);
+ 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() {
- return this;
+ if (spCommand==null) {
+ spCommand = new InitCommandSp(this);
+ }
+ return spCommand;
}
@Override