use of org.apache.openejb.util.SuperProperties in project tomee by apache.
the class WikiGenerator method generateService.
private void generateService(final ServiceProvider provider, final String serviceType) {
final String type = provider.getTypes().get(0);
out.println("# " + type + " <small>" + serviceType + " </small>");
out.println();
out.println("Declarable in openejb.xml via");
out.println();
out.println(" <" + provider.getService() + " id=\"Foo\" type=\"" + type + "\">");
out.println(" </" + provider.getService() + ">");
out.println();
out.println("Declarable in properties via");
out.println();
out.println(" Foo = new://" + provider.getService() + "?type=" + type);
out.println();
final SuperProperties properties = (SuperProperties) provider.getProperties();
final Map<String, String> defaults = new LinkedHashMap<String, String>();
if (properties.size() > 0) {
out.println("## Properties");
out.println();
for (final Object key : properties.keySet()) {
if (key instanceof String) {
final String name = (String) key;
final Map<String, String> attributes = properties.getAttributes(name);
if (attributes.containsKey("hidden")) {
continue;
}
out.println("### " + key);
out.println();
final String value = properties.getProperty(name);
String comment = properties.getComment(name);
comment = scrubText(comment);
defaults.put(name, String.valueOf(value));
if (comment.length() == 0) {
comment = "No description.";
}
out.println(comment);
out.println();
}
}
out.println("## Default declaration");
out.println(" <" + provider.getService() + " id=\"" + provider.getId() + "\" type=\"" + type + "\">");
for (final Map.Entry<String, String> entry : defaults.entrySet()) {
out.print(" ");
out.print(entry.getKey());
out.print(" = ");
out.println(entry.getValue());
}
out.println(" </" + provider.getService() + ">");
} else {
out.println("No properties.");
}
out.println();
}
Aggregations