--- /dev/null
+- Adds parameter 'windowid' (SP extension) to init command\r
+- Fix for state handling in record command (the SP extensions) \r
+- Adds working web.xml context parameters for SP service\r
+\r
+0.3.3 \r
+\r
+- First release
\ No newline at end of file
* </pre>\r
* \r
* <p>For the web.xml configuration scheme (choosing WebXmlConfigReader in beans.xml)\r
- * to pre-define the URL of the Pazpar2 to use, the configuration could be:</p>\r
+ * to pre-define the URL of the Pazpar2 to use and choose Pazpar2 as the selected\r
+ * service type, the configuration could be:</p>\r
* \r
* <pre>\r
* <context-param>\r
* <param-name>PAZPAR2_URL</param-name>\r
* <param-value>http://localhost:8004/</param-value>\r
* </context-param>\r
+ * <context-param>\r
+ * <description>Service type. Possible values: SP, PZ2, TBD</description>\r
+ * <param-name>TYPE</param-name>\r
+ * <param-value>PZ2</param-value> \r
+ * </context-param>\r
* </pre>\r
* \r
* <p>For the Mk2ConfigReader scheme to work, the web.xml must then contain pointers to the configuration directory \r
- * and properties file. \r
+ * and properties file. The specific configuration itself would be in those files then.\r
* In this example the configuration directory is in the web application itself (war://testconfig). A more regular \r
* example would put it in a separate directory to not have it overwritten by each deployment of the war.</p> \r
* <pre>\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.commands.sp.ServiceProxyCommand;\r
import com.indexdata.mkjsf.pazpar2.data.CommandError;\r
import com.indexdata.mkjsf.utils.Utils;\r
\r
return initDocPaths;\r
}\r
\r
- public HttpResponseWrapper postInitDoc(byte[] initDoc, boolean includeDebug) {\r
- HttpPost post = new HttpPost(serviceUrl+"?command=init" + (includeDebug? "&includeDebug=yes" : ""));\r
+ public HttpResponseWrapper postInitDoc(byte[] initDoc, Pazpar2Command command) {\r
+ String requestParameters = command.getEncodedQueryString();\r
+ logger.info("Initiating session with init doc and [" + requestParameters +"]");\r
+ HttpPost post = new HttpPost(serviceUrl+"?" + requestParameters);\r
post.setEntity(new ByteArrayEntity(initDoc));\r
ClientCommandResponse commandResponse = null;\r
byte[] response;\r
for (String parameterName : parameters.keySet()) {\r
newCommand.setParameterInState(parameters.get(parameterName).copy()); \r
}\r
- newCommand.spCommand = this.spCommand;\r
+ newCommand.spCommand = new InitCommandSp(this);\r
+ newCommand.spCommand.setUploadedInitDoc(spCommand.getUploadedInitDoc());\r
return newCommand;\r
}\r
\r
public ServiceProxyCommand getSp() {\r
if (spCommand==null) {\r
- spCommand = new InitCommandSp(this);\r
+ spCommand = new InitCommandSp(this); \r
} \r
return spCommand;\r
}\r
for (String parameterName : parameters.keySet()) {\r
newCommand.setParameterInState(parameters.get(parameterName).copy()); \r
} \r
- newCommand.spCommand = this.spCommand;\r
+ newCommand.spCommand = new RecordCommandSp(newCommand);\r
return newCommand;\r
}\r
\r
import com.indexdata.mkjsf.pazpar2.Pz2Service;\r
import com.indexdata.mkjsf.pazpar2.commands.CommandParameter;\r
import com.indexdata.mkjsf.pazpar2.commands.InitCommand;\r
+import com.indexdata.mkjsf.pazpar2.commands.Pazpar2Command;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseDataObject;\r
import com.indexdata.mkjsf.pazpar2.data.ResponseParser;\r
import com.indexdata.mkjsf.pazpar2.data.sp.SpResponseDataObject;\r
private static Logger logger = Logger.getLogger(InitCommandSp.class);\r
private InitCommand command = null;\r
\r
- private InitDocUpload initDocUpload;\r
+ private InitDocUpload initDocUpload = null;\r
\r
public InitCommandSp(InitCommand initCommand) {\r
this.command=initCommand;\r
public SpResponseDataObject run() {\r
Pz2Service.get().resetSearchAndRecordCommands();\r
Pz2Service.get().getPzresp().getSp().resetAuthAndBeyond(true); \r
- try {\r
- byte[] bytes = getUploadedInitDoc().getBytes();\r
- HttpResponseWrapper response = Pz2Service.get().getSpClient().postInitDoc(bytes,getIncludeDebug().equals("yes")); \r
- ResponseDataObject responseObject = ResponseParser.getParser().getDataObject((ClientCommandResponse)response); \r
- Pz2Service.get().getPzresp().put("init", responseObject);\r
- } catch (IOException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
+ if (initDocUpload.hasUploadedFile()) {\r
+ try {\r
+ byte[] bytes = getUploadedInitDoc().getBytes();\r
+ HttpResponseWrapper response = Pz2Service.get().getSpClient().postInitDoc(bytes,command); \r
+ ResponseDataObject responseObject = ResponseParser.getParser().getDataObject((ClientCommandResponse)response); \r
+ Pz2Service.get().getPzresp().put("init", responseObject);\r
+ } catch (IOException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ } else {\r
+ Pz2Service.get().getSpClient().executeCommand(this.command);\r
}\r
return null;\r
}\r
+ \r
+ /**\r
+ * Sets the <code>windowid</code> parameter. See Service Proxy documentation for details.\r
+ */ \r
+ public void setWindowid (String windowid) {\r
+ command.setParameterInState(new CommandParameter("windowid","=",windowid));\r
+ }\r
+ \r
+ /** \r
+ * Returns the <code>windowid</code> parameter value.\r
+ */\r
+ public String getWindowid () {\r
+ return command.getParameterValue("windowid");\r
+ }\r
\r
@Override\r
public boolean spOnly() {\r
return true;\r
- }\r
- \r
- \r
+ } \r
\r
}\r
e.printStackTrace();\r
}\r
}\r
+ \r
+ public boolean hasUploadedFile () {\r
+ return uploadedFile != null;\r
+ }\r
\r
}\r