use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry 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.PropertyEntry in project jackrabbit by apache.
the class NodeImpl method resolveRelativePropertyPath.
/**
* Returns the id of the property at <code>relPath</code> or <code>null</code>
* if no property exists at <code>relPath</code>.
* <p>
* Note that access rights are not checked.
*
* @param relPath relative path of a (possible) property
* @return the PropertyEntry of the property at <code>relPath</code> or
* <code>null</code> if no property exists at <code>relPath</code>
* @throws RepositoryException if <code>relPath</code> is not a valid
* relative path
*/
private PropertyEntry resolveRelativePropertyPath(String relPath) throws RepositoryException {
PropertyEntry targetEntry = null;
try {
Path rp = session.getPathResolver().getQPath(relPath);
if (rp.getLength() == 1 && rp.denotesName()) {
// a single path element must always denote a name. '.' and '..'
// will never point to a property. If the NodeEntry does not
// contain such a property entry, the targetEntry is 'null;
Name propName = rp.getName();
// check if property entry exists
targetEntry = getNodeEntry().getPropertyEntry(propName, true);
} else {
// build and resolve absolute path
Path p = getPath(rp).getCanonicalPath();
try {
targetEntry = session.getHierarchyManager().getPropertyEntry(p);
} catch (PathNotFoundException e) {
// ignore -> return null;
}
}
} catch (NameException e) {
String msg = "failed to resolve property path " + relPath + " relative to " + safeGetJCRPath();
log.debug(msg);
throw new RepositoryException(msg, e);
}
return targetEntry;
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.
the class NodeImpl method getProperty.
/**
* @see Node#getProperty(String)
*/
public Property getProperty(String relPath) throws PathNotFoundException, RepositoryException {
checkStatus();
PropertyEntry entry = resolveRelativePropertyPath(relPath);
if (entry == null) {
throw new PathNotFoundException(relPath);
}
try {
return (Property) getItemManager().getItem(entry);
} catch (AccessDeniedException e) {
throw new PathNotFoundException(relPath);
} catch (ItemNotFoundException e) {
throw new PathNotFoundException(relPath);
}
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.
the class NodeImpl method getMixinTypes.
/**
* Retrieves the value of the jcr:mixinTypes property present with this
* Node including those that have been transiently added and excluding
* those, that have been transiently removed.<br>
* NOTE, that the result of this method, does NOT represent the list of
* mixin-types that currently affect this node.
*
* @return mixin names present with the jcr:mixinTypes property.
*/
private List<Name> getMixinTypes() {
Name[] mixinValue;
if (getNodeState().getStatus() == Status.EXISTING) {
// jcr:mixinTypes must correspond to the mixins present on the nodestate.
mixinValue = getNodeState().getMixinTypeNames();
} else {
try {
PropertyEntry pe = getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES);
if (pe != null) {
// prop entry exists (and ev. has been transiently mod.)
// -> retrieve mixin types from prop
mixinValue = StateUtility.getMixinNames(pe.getPropertyState());
} else {
// prop entry has not been loaded yet -> not modified
mixinValue = getNodeState().getMixinTypeNames();
}
} catch (RepositoryException e) {
// should never occur
log.warn("Internal error", e);
mixinValue = Name.EMPTY_ARRAY;
}
}
List<Name> l = new ArrayList<Name>();
l.addAll(Arrays.asList(mixinValue));
return l;
}
use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.
the class ItemManagerImpl method hasChildProperties.
/**
* @see ItemManager#hasChildProperties(NodeEntry)
*/
public synchronized boolean hasChildProperties(NodeEntry parentEntry) throws ItemNotFoundException, RepositoryException {
// check sanity of session
session.checkIsAlive();
Iterator<PropertyEntry> iter = parentEntry.getPropertyEntries();
while (iter.hasNext()) {
try {
PropertyEntry entry = iter.next();
// check read access by accessing the propState (also implicit validation).
entry.getPropertyState();
return true;
} catch (ItemNotFoundException e) {
// should not occur. ignore
log.debug("Failed to access node state.", e);
}
}
return false;
}
Aggregations