use of org.apache.jackrabbit.spi.NodeInfo in project jackrabbit by apache.
the class ItemInfoJsonHandler method object.
public void object() throws IOException {
if (name != null) {
try {
NodeInfo current = getCurrentNodeInfo();
Path relPath = pFactory.create(name, index);
NodeId id = idFactory.createNodeId(current.getId(), relPath);
Path currentPath = current.getPath();
Path p = pFactory.create(currentPath, relPath, true);
NodeInfo nInfo = new NodeInfoImpl(id, p);
nodeInfos.push(nInfo);
propInfoLists.push(new ArrayList<PropertyInfoImpl>(8));
} catch (RepositoryException e) {
throw new IOException(e.getMessage());
}
}
}
use of org.apache.jackrabbit.spi.NodeInfo in project jackrabbit by apache.
the class ItemInfoJsonHandler method endObject.
public void endObject() throws IOException {
try {
NodeInfoImpl nInfo = (NodeInfoImpl) nodeInfos.pop();
List<PropertyInfoImpl> props = propInfoLists.pop();
// all required information to create a node info should now be gathered
nInfo.setPropertyInfos(props.toArray(new PropertyInfoImpl[props.size()]), idFactory);
NodeInfo parent = getCurrentNodeInfo();
if (parent != null) {
if (nInfo.getPath().getAncestor(1).equals(parent.getPath())) {
ChildInfo ci = new ChildInfoImpl(nInfo.getName(), nInfo.getUniqueID(), nInfo.getIndex());
((NodeInfoImpl) parent).addChildInfo(ci);
} else {
log.debug("NodeInfo '" + nInfo.getPath() + "' out of hierarchy. Parent path = " + parent.getPath());
}
}
if (nInfo.isCompleted()) {
itemInfos.addAll(props);
itemInfos.add(nInfo);
} else {
log.debug("Incomplete NodeInfo '" + nInfo.getPath() + "' -> Only present as ChildInfo with its parent.");
}
} catch (RepositoryException e) {
throw new IOException(e.getMessage());
} finally {
// reset all node-related handler state
name = null;
index = Path.INDEX_DEFAULT;
}
}
Aggregations