- public boolean writeParamSet(WsParamSetI wsp,
- Writer writer) throws IOException
- {
- if (!(wsp instanceof JabaWsParamSet))
- {
- throw new Error("Implementation error: JabaWsParamSets can only be handled by JabaParamStore");
- }
- writer.write(ParameterUtils.writeParameterSet(((JabaWsParamSet)wsp).getjabaArguments(), " ")
- .toString());
- return true;
+ public WsParamSetI parseServiceParameterFile(String name, String descr,
+ String[] urls, String parameterfile) throws IOException
+ {
+ if (!involves(urls))
+ {
+ throw new IOException(MessageManager.getString("error.implementation_error_cannot_find_service_url_in_given_set"));
+
+ }
+ JabaWsParamSet wsp = new JabaWsParamSet();
+ wsp.setName(name);
+ wsp.setDescription(descr);
+ wsp.setApplicableUrls(urls.clone());
+
+ List<String> lines = new ArrayList<String>();
+ StringTokenizer st = new StringTokenizer(parameterfile, "\n");
+ while (st.hasMoreTokens())
+ {
+ lines.add(st.nextToken());
+ }
+ wsp.setjabaArguments(ParameterUtils.processParameters(lines,
+ serviceOptions, " "));
+ return wsp;
+ }
+
+ @Override
+ public String generateServiceParameterFile(WsParamSetI pset)
+ throws IOException
+ {
+ if (!involves(pset.getApplicableUrls()))
+ {
+ throw new IOException(MessageManager.formatMessage("error.implementation_error_cannot_find_service_url_in_given_set_param_store", new String[]{service.getUri()}));
+ }
+ if (!(pset instanceof JabaWsParamSet))
+ {
+ throw new Error(MessageManager.getString("error.implementation_error_jabaws_param_set_only_handled_by"));
+ }
+
+ StringBuffer rslt = new StringBuffer();
+ for (String ln : ParameterUtils.writeParameterSet(
+ ((JabaWsParamSet) pset).getjabaArguments(), " "))
+ {
+ rslt.append(ln);
+ rslt.append("\n");
+ }
+ ;
+ return rslt.toString();