use of org.apache.jackrabbit.oak.segment.SegmentPropertyState in project jackrabbit-oak by apache.
the class DebugTars method filterNodeStates.
private void filterNodeStates(Set<UUID> uuids, List<String> paths, SegmentNodeState state, String path) {
Set<String> localPaths = newTreeSet();
for (PropertyState ps : state.getProperties()) {
if (ps instanceof SegmentPropertyState) {
SegmentPropertyState sps = (SegmentPropertyState) ps;
RecordId recordId = sps.getRecordId();
UUID id = recordId.getSegmentId().asUUID();
if (uuids.contains(id)) {
if (ps.getType().tag() == PropertyType.STRING) {
String val = "";
if (ps.count() > 0) {
// only shows the first value, do we need more?
val = displayString(ps.getValue(Type.STRING, 0));
}
localPaths.add(getLocalPath(path, ps, val, recordId));
} else {
localPaths.add(getLocalPath(path, ps, recordId));
}
}
if (ps.getType().tag() == PropertyType.BINARY) {
// look for extra segment references
for (int i = 0; i < ps.count(); i++) {
Blob b = ps.getValue(Type.BINARY, i);
for (SegmentId sbid : SegmentBlob.getBulkSegmentIds(b)) {
UUID bid = sbid.asUUID();
if (!bid.equals(id) && uuids.contains(bid)) {
localPaths.add(getLocalPath(path, ps, recordId));
}
}
}
}
}
}
RecordId stateId = state.getRecordId();
if (uuids.contains(stateId.getSegmentId().asUUID())) {
localPaths.add(path + " [SegmentNodeState@" + stateId + "]");
}
RecordId templateId = getTemplateId(state);
if (uuids.contains(templateId.getSegmentId().asUUID())) {
localPaths.add(path + "[Template@" + templateId + "]");
}
paths.addAll(localPaths);
for (ChildNodeEntry ce : state.getChildNodeEntries()) {
NodeState c = ce.getNodeState();
if (c instanceof SegmentNodeState) {
filterNodeStates(uuids, paths, (SegmentNodeState) c, path + ce.getName() + "/");
}
}
}
Aggregations