package com.indexdata.mkjsf.pazpar2.commands;\r
\r
+import org.apache.log4j.Logger;\r
+\r
+import com.indexdata.mkjsf.pazpar2.commands.sp.InitCommandSp;\r
import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
\r
+/**\r
+ * Represents a Pazpar2 <code>init</code> command, can be accessed by <code>pzreq.init</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
public class InitCommand extends Pazpar2Command implements ServiceProxyCommand {\r
\r
private static final long serialVersionUID = -4915976465898889987L;\r
+ private static Logger logger = Logger.getLogger(InitCommand.class);\r
+ private InitCommandSp spCommand = null;\r
\r
public InitCommand() {\r
super("init");\r
}\r
\r
+ /**\r
+ * Sets the <code>clear</code> parameter. See Pazpar2 documentation for details.\r
+ * \r
+ * @param clear\r
+ */\r
public void setClear(String clear) { \r
setParameterInState(new CommandParameter("clear","=",clear));\r
}\r
- \r
+\r
+ /**\r
+ * Returns the <code>clear</code> parameter value.\r
+ */\r
public String getClear() {\r
return getParameterValue("clear");\r
}\r
\r
+ /**\r
+ * Sets the <code>service</code> parameter. See Pazpar2 documentation for details.\r
+ * @param serviceId\r
+ */\r
public void setService(String serviceId) { \r
setParameterInState(new CommandParameter("service","=",serviceId));\r
}\r
\r
+ /**\r
+ * Returns the <code>service</code> parameter value.\r
+ */ \r
public String getService() {\r
return getParameterValue("service");\r
}\r
\r
+ /**\r
+ * Disabled, not supported for <code>init</code>\r
+ */\r
@Override\r
public void setSession (String sessionId) {\r
throw new UnsupportedOperationException("Cannot set session id on init command");\r
}\r
- \r
+\r
+ /**\r
+ * Disabled, not supported for <code>init</code>\r
+ */\r
@Override\r
public String getSession () {\r
throw new UnsupportedOperationException("Cannot set or get session id on init command");\r
- }\r
+ } \r
\r
public InitCommand copy () {\r
+ logger.info("Copying init command");\r
InitCommand newCommand = new InitCommand();\r
for (String parameterName : parameters.keySet()) {\r
newCommand.setParameterInState(parameters.get(parameterName).copy()); \r
- } \r
+ }\r
+ newCommand.spCommand = this.spCommand;\r
return newCommand;\r
}\r
\r
public ServiceProxyCommand getSp() {\r
- return this;\r
+ if (spCommand==null) {\r
+ spCommand = new InitCommandSp(this);\r
+ } \r
+ return spCommand;\r
}\r
\r
@Override\r