From b5b696f4045e9488c28e3483c2389856bb431676 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Wed, 26 Jun 2013 10:27:13 -0400 Subject: [PATCH] Adds alternative version of command.runWith(parameters) For Glassfish/Jboss support (do not do varargs from the EL) --- .../mkjsf/pazpar2/commands/Pazpar2Command.java | 25 +++++++++++++++++++- .../mkjsf/pazpar2/commands/PingCommand.java | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java index 25ea8db..d8730b7 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/Pazpar2Command.java @@ -80,7 +80,7 @@ public abstract class Pazpar2Command implements Serializable { /** * Executes the commands with the currently selected parameters, while adding - * the parameters provided + * the parameters provided in the vararg * @param parameters A list of parameters on the form [key=value] * * @return Response data object based on the Pazpar2 service response @@ -95,6 +95,29 @@ public abstract class Pazpar2Command implements Serializable { } return run(); } + + /** + * Executes the commands with the currently selected parameters, while adding + * the parameters provided in the 'delimiter'-separated String. + * + * Note: This is for Glassfish/JBoss support. With Tomcat7 the method + * runWith(String... parameters) can be used directly from EL + * with a vararg + * + * @param parameters A list of parameters separated by 'delimiter' + * @param delimiter The separator character of the String 'parameters' + * + * @return Response data object based on the Pazpar2 service response + */ + public ResponseDataObject runWith2(String parameters, String delimiter) { + StringTokenizer params = new StringTokenizer(parameters,delimiter); + String[] vararg = new String[params.countTokens()]; + int i=0; + while (params.hasMoreTokens()) { + vararg[i++] = params.nextToken(); + } + return runWith(vararg); + } /** * Executes the command in a thread. diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java index a695746..6ccba32 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/commands/PingCommand.java @@ -3,7 +3,7 @@ package com.indexdata.mkjsf.pazpar2.commands; import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand; /** - * Represents a Pazpar2 ping command, , can be accessed by pzreq.init + * Represents a Pazpar2 ping command, , can be accessed by pzreq.ping * * @author Niels Erik * -- 1.7.10.4