Adds alternative version of command.runWith(parameters)
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 26 Jun 2013 14:27:13 +0000 (10:27 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 26 Jun 2013 14:27:13 +0000 (10:27 -0400)
For Glassfish/Jboss support (do not do varargs from the EL)

src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java
src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java

index 25ea8db..d8730b7 100644 (file)
@@ -80,7 +80,7 @@ public abstract class Pazpar2Command implements Serializable  {
   \r
   /**\r
    * Executes the commands with the currently selected parameters, while adding\r
-   * the parameters provided\r
+   * the parameters provided in the vararg\r
    * @param parameters A list of parameters on the form [key=value]\r
    * \r
    * @return Response data object based on the Pazpar2 service response\r
@@ -95,6 +95,29 @@ public abstract class Pazpar2Command implements Serializable  {
     }\r
     return run();\r
   }\r
+\r
+  /**\r
+   * Executes the commands with the currently selected parameters, while adding\r
+   * the parameters provided in the 'delimiter'-separated String.\r
+   * \r
+   * Note: This is for Glassfish/JBoss support. With Tomcat7 the method \r
+   *       runWith(String... parameters) can be used directly from EL \r
+   *       with a vararg \r
+   *  \r
+   * @param parameters A list of parameters separated by 'delimiter'\r
+   * @param delimiter The separator character of the String 'parameters' \r
+   * \r
+   * @return Response data object based on the Pazpar2 service response\r
+   */\r
+  public ResponseDataObject runWith2(String parameters, String delimiter) {    \r
+    StringTokenizer params = new StringTokenizer(parameters,delimiter);\r
+    String[] vararg = new String[params.countTokens()];\r
+    int i=0;\r
+    while (params.hasMoreTokens()) {\r
+      vararg[i++] = params.nextToken();\r
+    }\r
+    return runWith(vararg);\r
+  }\r
     \r
   /**\r
    * Executes the command in a thread.  \r
index a695746..6ccba32 100644 (file)
@@ -3,7 +3,7 @@ package com.indexdata.mkjsf.pazpar2.commands;
 import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
 \r
 /**\r
- * Represents a Pazpar2 <code>ping</code> command, , can be accessed by <code>pzreq.init</code>\r
+ * Represents a Pazpar2 <code>ping</code> command, , can be accessed by <code>pzreq.ping</code>\r
  * \r
  * @author Niels Erik\r
  *\r