comment(out, cr, info.service + "(id=" + info.id + ")");
comment(out, cr, "className: " + info.className);
// TODO: the codebase value usually isn't filled in, we should do that.
// comment("codebase: " + info.codebase);
comment(out, cr, "");
SuperProperties p = new SuperProperties();
p.setSpaceBetweenProperties(false);
p.setKeyValueSeparator(" = ");
p.setLineSeparator(cr);
String uri = "new://" + info.service;
if (info.service.matches("Container|Resource|Connector")){
try {
Map query = new HashMap();
query.put("type", info.types.get(0));
uri += "?" + URISupport.createQueryString(query);
} catch (Exception e) {
}
}
p.put(info.id, uri);
for (Map.Entry<Object, Object> entry : info.properties.entrySet()) {
if (!(entry.getKey() instanceof String)) continue;
if (!(entry.getValue() instanceof String)) continue;
// If property name is 'password' replace value with 'xxxx' to protect it
if ("password".equalsIgnoreCase((String) entry.getKey())) {
p.put(info.id + "." + entry.getKey(), "xxxx");
} else {
p.put(info.id + "." + entry.getKey(), entry.getValue());
}
}
p.store(out, null);
} catch (IOException e) {
out.println("# Printing service(id=" + info.id + ") failed.");
e.printStackTrace(new PrintWriter(new CommentsFilter(out)));
}