use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class ResolveMergeConflict method persisted.
/**
* Invalidates the <code>NodeState</code> that had a merge conflict pending
* and all its child properties.
*
* @see Operation#persisted()
*/
public void persisted() {
assert status == STATUS_PENDING;
status = STATUS_PERSISTED;
// non-recursive invalidation BUT including all properties
Iterator<PropertyEntry> propEntries = ((NodeEntry) nodeState.getHierarchyEntry()).getPropertyEntries();
while (propEntries.hasNext()) {
PropertyEntry pe = propEntries.next();
pe.invalidate(false);
}
nodeState.getHierarchyEntry().invalidate(false);
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class SessionImpl method getNodeById.
/**
* Retrieve the <code>Node</code> with the given id.
*
* @param id
* @return node with the given <code>NodeId</code>.
* @throws ItemNotFoundException if no such node exists or if this
* <code>Session</code> does not have permission to access the node.
* @throws RepositoryException
*/
private Node getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException {
// check sanity of this session
checkIsAlive();
try {
NodeEntry nodeEntry = getHierarchyManager().getNodeEntry(id);
Item item = getItemManager().getItem(nodeEntry);
if (item.isNode()) {
return (Node) item;
} else {
log.error("NodeId '" + id + " does not point to a Node");
throw new ItemNotFoundException(LogUtil.saveGetIdString(id, getPathResolver()));
}
} catch (AccessDeniedException e) {
throw new ItemNotFoundException(LogUtil.saveGetIdString(id, getPathResolver()));
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class NodeImpl method checkpoint.
Version checkpoint() throws RepositoryException {
checkIsVersionable();
checkHasPendingChanges();
checkIsLocked();
if (!isCheckedOut()) {
checkout();
return getBaseVersion();
} else {
NodeEntry newVersion;
if (session.isSupportedOption(Repository.OPTION_ACTIVITIES_SUPPORTED)) {
NodeImpl activity = (NodeImpl) session.getWorkspace().getVersionManager().getActivity();
NodeId activityId = (activity == null) ? null : activity.getNodeState().getNodeId();
newVersion = session.getVersionStateManager().checkpoint(getNodeState(), activityId);
} else {
newVersion = session.getVersionStateManager().checkpoint(getNodeState());
}
return (Version) getItemManager().getItem(newVersion);
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class NodeImpl method getNode.
/**
* @see Node#getNode(String)
*/
public Node getNode(String relPath) throws PathNotFoundException, RepositoryException {
checkStatus();
NodeEntry nodeEntry = resolveRelativeNodePath(relPath);
if (nodeEntry == null) {
throw new PathNotFoundException(relPath);
}
try {
return (Node) getItemManager().getItem(nodeEntry);
} catch (ItemNotFoundException e) {
throw new PathNotFoundException(relPath, e);
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry in project jackrabbit by apache.
the class NodeImpl method resolveRelativeNodePath.
/**
* Returns the <code>NodeEntry</code> at <code>relPath</code> or
* <code>null</code> if no node exists at <code>relPath</code>.
* <p>
* Note that access rights are not checked.
*
* @param relPath relative path of a (possible) node.
* @return the HierarchyEntry of the node at <code>relPath</code> or
* <code>null</code> if no node exists at <code>relPath</code>.
* @throws RepositoryException if <code>relPath</code> is not a valid
* relative path.
*/
private NodeEntry resolveRelativeNodePath(String relPath) throws RepositoryException {
NodeEntry targetEntry = null;
try {
Path rp = session.getPathResolver().getQPath(relPath);
// shortcut
if (rp.getLength() == 1) {
if (rp.denotesCurrent()) {
targetEntry = getNodeEntry();
} else if (rp.denotesParent()) {
targetEntry = getNodeEntry().getParent();
} else {
// try to get child entry + force loading of not known yet
targetEntry = getNodeEntry().getNodeEntry(rp.getName(), rp.getNormalizedIndex(), true);
}
} else {
// rp length > 1
Path p = getPath(rp);
targetEntry = session.getHierarchyManager().getNodeEntry(p.getCanonicalPath());
}
} catch (PathNotFoundException e) {
// item does not exist -> ignore and return null
} catch (NameException e) {
String msg = "Invalid relative path: " + relPath;
log.debug(msg);
throw new RepositoryException(msg, e);
}
return targetEntry;
}
Aggregations