Search in sources :

Example 1 with PropertyEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.

the class Checkin method persisted.

/**
     * Invalidate the target <code>NodeState</code>.
     *
     * @see Operation#persisted()
     */
public void persisted() {
    assert status == STATUS_PENDING;
    status = STATUS_PERSISTED;
    try {
        NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
        if (vhe != null) {
            vhe.invalidate(true);
        }
    } catch (RepositoryException e) {
        log.debug("Failed to access Version history entry -> skip invalidation.", e);
    }
    Iterator<PropertyEntry> entries = ((NodeEntry) nodeState.getHierarchyEntry()).getPropertyEntries();
    while (entries.hasNext()) {
        PropertyEntry pe = entries.next();
        pe.invalidate(false);
    }
    nodeState.getHierarchyEntry().invalidate(false);
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry) PropertyEntry(org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry) RepositoryException(javax.jcr.RepositoryException)

Example 2 with PropertyEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.

the class Checkout method persisted.

/**
     * Invalidate the target <code>NodeState</code>.
     *
     * @see Operation#persisted()
     */
public void persisted() {
    assert status == STATUS_PENDING;
    status = STATUS_PERSISTED;
    try {
        NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
        if (vhe != null) {
            vhe.invalidate(true);
        }
    } catch (RepositoryException e) {
        log.warn("Failed to access Version history entry -> skip invalidation.", e);
    }
    // non-recursive invalidation (but including all properties)
    NodeEntry nodeEntry = (NodeEntry) nodeState.getHierarchyEntry();
    Iterator<PropertyEntry> entries = nodeEntry.getPropertyEntries();
    while (entries.hasNext()) {
        PropertyEntry pe = entries.next();
        pe.invalidate(false);
    }
    nodeEntry.invalidate(false);
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry) PropertyEntry(org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry) RepositoryException(javax.jcr.RepositoryException)

Example 3 with PropertyEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.

the class Checkpoint method persisted.

/**
     * Invalidate the target <code>NodeState</code>.
     *
     * @see org.apache.jackrabbit.jcr2spi.operation.Operation#persisted()
     */
public void persisted() {
    assert status == STATUS_PENDING;
    status = STATUS_PERSISTED;
    try {
        NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
        if (vhe != null) {
            vhe.invalidate(true);
        }
    } catch (RepositoryException e) {
        log.warn("Failed to access Version history entry -> skip invalidation.", e);
    }
    // non-recursive invalidation (but including all properties)
    NodeEntry nodeEntry = (NodeEntry) nodeState.getHierarchyEntry();
    Iterator<PropertyEntry> entries = nodeEntry.getPropertyEntries();
    while (entries.hasNext()) {
        PropertyEntry pe = entries.next();
        pe.invalidate(false);
    }
    nodeEntry.invalidate(false);
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry) PropertyEntry(org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry) RepositoryException(javax.jcr.RepositoryException)

Example 4 with PropertyEntry

use of org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry in project jackrabbit by apache.

the class LockRelease method persisted.

/**
     * Invalidates the <code>NodeState</code> that has been unlocked 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
    NodeEntry nodeEntry = nodeState.getNodeEntry();
    Iterator<PropertyEntry> entries = nodeEntry.getPropertyEntries();
    while (entries.hasNext()) {
        PropertyEntry pe = entries.next();
        pe.invalidate(false);
    }
    nodeEntry.invalidate(false);
}
Also used : NodeEntry(org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry) PropertyEntry(org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry)

Example 5 with PropertyEntry

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;
}
Also used : Path(org.apache.jackrabbit.spi.Path) NameException(org.apache.jackrabbit.spi.commons.conversion.NameException) PropertyEntry(org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry) RepositoryException(javax.jcr.RepositoryException) PathNotFoundException(javax.jcr.PathNotFoundException) Name(org.apache.jackrabbit.spi.Name)

Aggregations

PropertyEntry (org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry)19 NodeEntry (org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry)10 RepositoryException (javax.jcr.RepositoryException)7 Name (org.apache.jackrabbit.spi.Name)7 ItemNotFoundException (javax.jcr.ItemNotFoundException)4 ArrayList (java.util.ArrayList)3 QValue (org.apache.jackrabbit.spi.QValue)3 ItemExistsException (javax.jcr.ItemExistsException)2 PathNotFoundException (javax.jcr.PathNotFoundException)2 Property (javax.jcr.Property)2 QPropertyDefinition (org.apache.jackrabbit.spi.QPropertyDefinition)2 AccessDeniedException (javax.jcr.AccessDeniedException)1 Node (javax.jcr.Node)1 Version (javax.jcr.version.Version)1 VersionException (javax.jcr.version.VersionException)1 EffectiveNodeTypeProvider (org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider)1 ItemDefinitionProvider (org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider)1 AddProperty (org.apache.jackrabbit.jcr2spi.operation.AddProperty)1 Operation (org.apache.jackrabbit.jcr2spi.operation.Operation)1 PropertyState (org.apache.jackrabbit.jcr2spi.state.PropertyState)1