X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fclient%2FCmdHelper.java;h=c82f19391eb715aa55f386f847ec1dbc99d62a30;hb=b2a2fdc2bd95a64b3908d8ea2f31270b6c7199d3;hp=509abcc49b7d0872c3a747a1a261f900bd12ec15;hpb=1e1c3681ba25ee1797a46f871b8c80f259afe2ca;p=jabaws.git diff --git a/webservices/compbio/ws/client/CmdHelper.java b/webservices/compbio/ws/client/CmdHelper.java index 509abcc..c82f193 100644 --- a/webservices/compbio/ws/client/CmdHelper.java +++ b/webservices/compbio/ws/client/CmdHelper.java @@ -19,6 +19,7 @@ package compbio.ws.client; import static compbio.ws.client.Constraints.hostkey; import static compbio.ws.client.Constraints.limitList; import static compbio.ws.client.Constraints.listServices; +import static compbio.ws.client.Constraints.listServicesOld; import static compbio.ws.client.Constraints.paramList; import static compbio.ws.client.Constraints.presetList; import static compbio.ws.client.Constraints.presetkey; @@ -27,7 +28,6 @@ import static compbio.ws.client.Constraints.servicekey; import static compbio.ws.client.Constraints.testKey; class CmdHelper { - /** * Check whether presetList is set in the command line * @@ -57,7 +57,7 @@ class CmdHelper { * @return */ static boolean listServices(String[] cmd) { - return keyFound(cmd, listServices); + return (keyFound(cmd, listServices) || keyFound(cmd, listServicesOld)); } /** @@ -80,9 +80,9 @@ class CmdHelper { static boolean keyFound(String[] cmd, String key) { assert cmd != null && cmd.length > 0; assert key != null; - for (int i = 0; i < cmd.length; i++) { - String listPresets = cmd[i]; - if (listPresets.trim().equalsIgnoreCase(key)) { + + for (String c : cmd) { + if (c.trim().equalsIgnoreCase(key)) { return true; } } @@ -98,11 +98,9 @@ class CmdHelper { */ static String getPresetName(String[] cmd) { String preset = null; - for (int i = 0; i < cmd.length; i++) { - String presetPrm = cmd[i]; - if (presetPrm.trim().toLowerCase() - .startsWith(presetkey + pseparator)) { - preset = presetPrm.substring(presetPrm.indexOf(pseparator) + 1); + for (String c : cmd) { + if (c.trim().toLowerCase().startsWith(presetkey + pseparator)) { + preset = c.substring(c.indexOf(pseparator) + 1); break; } } @@ -117,10 +115,9 @@ class CmdHelper { * @return service name or null if it is not defined */ public static String getServiceName(String[] cmd) { - for (int i = 0; i < cmd.length; i++) { - String serv = cmd[i]; - if (serv.trim().toLowerCase().startsWith(servicekey + pseparator)) { - return serv.substring(serv.indexOf(pseparator) + 1); + for (String c : cmd) { + if (c.trim().toLowerCase().startsWith(servicekey + pseparator)) { + return c.substring(c.indexOf(pseparator) + 1); } } return null; @@ -134,10 +131,9 @@ class CmdHelper { * @return host name or null if it is not defined */ public static String getHost(String[] cmd) { - for (int i = 0; i < cmd.length; i++) { - String host = cmd[i]; - if (host.trim().toLowerCase().startsWith(hostkey + pseparator)) { - return host.substring(host.indexOf(pseparator) + 1); + for (String c : cmd) { + if (c.trim().toLowerCase().startsWith(hostkey + pseparator)) { + return c.substring(c.indexOf(pseparator) + 1); } } return null; @@ -153,5 +149,4 @@ class CmdHelper { static boolean listParameters(String[] cmd) { return keyFound(cmd, paramList); } - }