Search in sources :

Example 1 with LockOperation

use of org.apache.jackrabbit.jcr2spi.operation.LockOperation in project jackrabbit by apache.

the class LockManagerImpl method lock.

/**
     * @see LockStateManager#lock(NodeState,boolean,boolean,long,String)
     */
public Lock lock(NodeState nodeState, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerHint) throws RepositoryException {
    // retrieve node first
    Node lhNode;
    Item item = itemManager.getItem(nodeState.getHierarchyEntry());
    if (item.isNode()) {
        lhNode = (Node) item;
    } else {
        throw new RepositoryException("Internal error: ItemManager returned Property from NodeState");
    }
    // execute the operation
    LockOperation op = LockOperation.create(nodeState, isDeep, isSessionScoped, timeoutHint, ownerHint);
    wspManager.execute(op);
    Lock lock = new LockImpl(new LockState(nodeState, op.getLockInfo()), lhNode);
    return lock;
}
Also used : Item(javax.jcr.Item) LockOperation(org.apache.jackrabbit.jcr2spi.operation.LockOperation) Node(javax.jcr.Node) RepositoryException(javax.jcr.RepositoryException) Lock(javax.jcr.lock.Lock)

Aggregations

Item (javax.jcr.Item)1 Node (javax.jcr.Node)1 RepositoryException (javax.jcr.RepositoryException)1 Lock (javax.jcr.lock.Lock)1 LockOperation (org.apache.jackrabbit.jcr2spi.operation.LockOperation)1