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, "");
final 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 {
final Map query = new HashMap();
query.put("type", info.types.get(0));
uri += "?" + URISupport.createQueryString(query);
} catch (final Exception e) {
// no-op
}
}
p.put(info.id, uri);
for (final 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 (final IOException e) {
out.println("# Printing service(id=" + info.id + ") failed.");
e.printStackTrace(new PrintWriter(new CommentsFilter(out)));
}