Package org.apache.jackrabbit.core

Examples of org.apache.jackrabbit.core.SessionImpl


            throws LockException, RepositoryException {

        acquire();

        try {
            SessionImpl session = (SessionImpl) node.getSession();
            Path path = getPath(node.getId());

            PathMap.Element element = lockMap.map(path, false);
            AbstractLockInfo info = (AbstractLockInfo) element.get();
            if (info == null) {
                throw new LockException("Node not locked: " + node.safeGetJCRPath());
            }
            if (element.hasPath(path) || info.deep) {
                Node lockHolder = (Node) session.getItemManager().getItem(info.getId());
                return new LockImpl(info, lockHolder);
            } else {
                throw new LockException("Node not locked: " + node.safeGetJCRPath());
            }
        } catch (ItemNotFoundException e) {
View Full Code Here


     * {@inheritDoc}
     */
    public void checkLock(NodeImpl node)
            throws LockException, RepositoryException {

        SessionImpl session = (SessionImpl) node.getSession();
        checkLock(getPath(node.getId()), session);
    }
View Full Code Here

         */
        public void loggingOut(SessionImpl session) {
            if (live) {
                if (sessionScoped) {
                    // if no session currently holds lock, reassign
                    SessionImpl lockHolder = getLockHolder();
                    if (lockHolder == null) {
                        setLockHolder(session);
                    }
                    try {
                        NodeImpl node = (NodeImpl) session.getItemManager().getItem(getId());
View Full Code Here

                             NodeTypeRegistry ntReg,
                             int uuidBehavior)
            throws PathNotFoundException, ConstraintViolationException,
            VersionException, LockException, RepositoryException {

        SessionImpl ses = (SessionImpl) wsp.getSession();
        itemOps = new BatchedItemOperations(wsp.getItemStateManager(),
                ntReg, ses.getLockManager(), ses, wsp.getHierarchyManager(),
                ses.getNamespaceResolver());
        hierMgr = wsp.getHierarchyManager();

        // perform preliminary checks
        itemOps.verifyCanWrite(parentPath);
        importTarget = itemOps.getNodeState(parentPath);
View Full Code Here

         */
        EffectiveNodeType ent = itemOps.getEffectiveNodeType(node);
        if (ent.includesNodeType(QName.MIX_VERSIONABLE)) {
            PropDef def;
            PropertyState prop;
            SessionImpl session = (SessionImpl) wsp.getSession();
            VersionManager vMgr = session.getVersionManager();
            /**
             * check if there's already a version history for that
             * node; this would e.g. be the case if a versionable node
             * had been exported, removed and re-imported with either
             * IMPORT_UUID_COLLISION_REMOVE_EXISTING or
View Full Code Here

            info = lockMgr.getLockInfo(node.getNodeId());
        }
        if (info == null) {
            throw new LockException("Node not locked: " + node);
        }
        SessionImpl session = (SessionImpl) node.getSession();
        NodeImpl holder = (NodeImpl) session.getItemManager().getItem(info.getId());
        return new XALockImpl(this, info, holder);
    }
View Full Code Here

     */
    public void checkLock(Path path, Session session)
            throws LockException, RepositoryException {

        if (isInXA()) {
            SessionImpl sessionImpl = (SessionImpl) session;
            checkLock(sessionImpl.getItemManager().getNode(path));
        } else {
            lockMgr.checkLock(path, session);
        }
    }
View Full Code Here

    AbstractLockInfo internalLock(NodeImpl node, boolean isDeep,
                                  boolean isSessionScoped, long timeoutHint,
                                  String ownerInfo)
            throws LockException, RepositoryException {

        SessionImpl session = (SessionImpl) node.getSession();
        String lockOwner = (ownerInfo != null) ? ownerInfo : session.getUserID();
        InternalLockInfo info = new InternalLockInfo(new LockToken(node.getNodeId()),
                isSessionScoped, isDeep, lockOwner, timeoutHint);

        ClusterOperation operation = null;
        boolean successful = false;

        // Cluster is only informed about open-scoped locks
        if (eventChannel != null && !isSessionScoped) {
            operation = eventChannel.create(node.getNodeId(), isDeep, lockOwner);
        }

        acquire();

        try {
            // check whether node is already locked
            Path path = getPath(session, node.getId());
            PathMap.Element element = lockMap.map(path, false);

            LockInfo other = (LockInfo) element.get();
            if (other != null) {
                if (element.hasPath(path)) {
                    throw new LockException("Node already locked: " + node);
                } else if (other.isDeep()) {
                    throw new LockException(
                            "Parent node has a deep lock: " + node);
                }
            }
            if (info.deep && element.hasPath(path)
                    && element.getChildrenCount() > 0) {
                throw new LockException("Some child node is locked.");
            }

            // create lock token
            info.setLockHolder(session);
            info.setLive(true);
            session.addListener(info);
            if (!info.isSessionScoped()) {
                getSessionLockManager(session).lockTokenAdded(info.getLockToken());
            }
            lockMap.put(path, info);
View Full Code Here

        }

        acquire();

        try {
            SessionImpl session = (SessionImpl) node.getSession();
            // check whether node is locked by this session
            PathMap.Element element = lockMap.map(getPath(session, node.getId()), true);
            if (element == null) {
                throw new LockException("Node not locked: " + node);
            }
View Full Code Here

            throws LockException, RepositoryException {

        acquire();

        try {
            SessionImpl session = (SessionImpl) node.getSession();
            Path path = getPath(session, node.getId());

            PathMap.Element element = lockMap.map(path, false);
            AbstractLockInfo info = (AbstractLockInfo) element.get();
            if (info != null && (element.hasPath(path) || info.deep)) {
                Node lockHolder = (Node) session.getItemManager().getItem(info.getId());
                return new LockImpl(info, lockHolder);
            } else {
                throw new LockException("Node not locked: " + node);
            }
        } catch (ItemNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.SessionImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.