in core/src/main/java/org/apache/brooklyn/core/entity/Dumper.java [85:186]
static void dumpInfo(Entity e, Writer out, String currentIndentation, String tab) throws IOException {
out.append(currentIndentation+e.toString()+" "+e.getId()+"\n");
out.append(currentIndentation+tab+tab+"displayName = "+e.getDisplayName()+"\n");
if (Strings.isNonBlank(e.getCatalogItemId())) {
out.append(currentIndentation+tab+tab+"catalogItemId = "+e.getCatalogItemId()+"\n");
}
final List<String> searchPath = e.getCatalogItemIdSearchPath();
if (!searchPath.isEmpty()) {
out.append(currentIndentation + tab + tab + "searchPath = [");
for (int i = 0 ; i < searchPath.size() ; i++) {
out.append(i > 0 ? ",\n" : "\n");
out.append(currentIndentation + tab + tab + tab + searchPath.get(i));
}
out.append("\n" + currentIndentation + tab + tab + "]\n");
}
out.append(currentIndentation+tab+tab+"locations = "+e.getLocations()+"\n");
Set<ConfigKey<?>> keys = Sets.newLinkedHashSet(
((EntityInternal)e).config().getLocalBag().getAllConfigAsConfigKeyMap().keySet()
//((EntityInternal)e).getConfigMap().getLocalConfig().keySet()
);
for (ConfigKey<?> it : sortConfigKeys(keys)) {
// use the official config key declared on the type if available
// (since the map sometimes contains <object> keys
ConfigKey<?> realKey = e.getEntityType().getConfigKey(it.getName());
if (realKey!=null) it = realKey;
Maybe<Object> mv = ((EntityInternal)e).config().getLocalRaw(it);
if (!isTrivial(mv)) {
Object v = mv.get();
out.append(currentIndentation+tab+tab+it.getName());
out.append(" = ");
if (isSecret(it.getName())) out.append("xxxxxxxx");
else if ((v instanceof Task) && ((Task<?>)v).isDone()) {
if (((Task<?>)v).isError()) {
out.append("ERROR in "+v);
} else {
try {
out.append(((Task<?>)v).get() + " (from "+v+")");
} catch (ExecutionException ee) {
throw new IllegalStateException("task "+v+" done and !isError, but threw exception on get", ee);
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
return;
}
}
} else out.append(""+v);
out.append("\n");
}
}
for (Sensor<?> it : sortSensors(e.getEntityType().getSensors())) {
if (it instanceof AttributeSensor) {
Object v = e.getAttribute((AttributeSensor<?>)it);
if (!isTrivial(v)) {
out.append(currentIndentation+tab+tab+it.getName());
out.append(": ");
if (isSecret(it.getName())) out.append("xxxxxxxx");
else out.append(""+v);
out.append("\n");
}
}
}
if (e instanceof Group) {
StringBuilder members = new StringBuilder();
for (Entity it : ((Group)e).getMembers()) {
if (members.length()>0) members.append(", ");
members.append(it.getId());
}
out.append(currentIndentation+tab+tab+"Members: "+members.toString()+"\n");
}
if (!e.policies().isEmpty()) {
out.append(currentIndentation+tab+tab+"Policies:\n");
for (Policy policy : e.policies()) {
dumpInfo(policy, out, currentIndentation+tab+tab+tab, tab);
}
}
if (!e.enrichers().isEmpty()) {
out.append(currentIndentation+tab+tab+"Enrichers:\n");
for (Enricher enricher : e.enrichers()) {
dumpInfo(enricher, out, currentIndentation+tab+tab+tab, tab);
}
}
if (!((EntityInternal)e).feeds().getFeeds().isEmpty()) {
out.append(currentIndentation+tab+tab+"Feeds:\n");
for (Feed feed : ((EntityInternal)e).feeds().getFeeds()) {
dumpInfo(feed, out, currentIndentation+tab+tab+tab, tab);
}
}
for (Entity it : e.getChildren()) {
dumpInfo(it, out, currentIndentation+tab, tab);
}
out.flush();
}