Examples of SessionImpl


Examples of mage.remote.SessionImpl

        public ClientMock(String username) {
            this.username = username;
        }

        public void connect() {
            session = new SessionImpl(this);
            Connection connection = new Connection();
            connection.setUsername(username);
            connection.setHost("localhost");
            connection.setPort(17171);
            connection.setProxyType(Connection.ProxyType.NONE);
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

    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();
        LockInfo info = new LockInfo(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.deep) {
                    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.lockToken.toString());
            }
            lockMap.put(path, info);
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

        }

        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

Examples of org.apache.jackrabbit.core.SessionImpl

            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

Examples of org.apache.jackrabbit.core.SessionImpl

     */
    public boolean holdsLock(NodeImpl node) throws RepositoryException {
        acquire();

        try {
            SessionImpl session = (SessionImpl) node.getSession();
            PathMap.Element element = lockMap.map(getPath(session, node.getId()), true);
            if (element == null) {
                return false;
            }
            return element.get() != null;
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

    public boolean isLockHolder(Session session, NodeImpl node)
            throws RepositoryException {
        acquire();

        try {
            SessionImpl nodeSession = (SessionImpl) node.getSession();
            PathMap.Element element = lockMap.map(getPath(nodeSession, node.getId()), true);
            if (element == null) {
                return false;
            }
            AbstractLockInfo info = (AbstractLockInfo) element.get();
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

     */
    public boolean isLocked(NodeImpl node) throws 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) {
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

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

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

Examples of org.apache.jackrabbit.core.SessionImpl

     * @param isDeep
     */
    protected void writeLockProperties(NodeImpl node, String lockOwner, boolean isDeep) throws RepositoryException {
        boolean success = false;

        SessionImpl editingSession = (SessionImpl) node.getSession();
        WorkspaceImpl wsp = (WorkspaceImpl) editingSession.getWorkspace();
        UpdatableItemStateManager stateMgr = wsp.getItemStateManager();
        ItemValidator helper = new ItemValidator(editingSession.getNodeTypeManager().getNodeTypeRegistry(), wsp.getHierarchyManager(), editingSession);

        synchronized (stateMgr) {
            if (stateMgr.inEditMode()) {
                throw new RepositoryException("Unable to write lock properties.");
            }
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

     * @throws RepositoryException
     */
    protected void removeLockProperties(NodeImpl node) throws RepositoryException {
        boolean success = false;

        SessionImpl editingSession = (SessionImpl) node.getSession();
        WorkspaceImpl wsp = (WorkspaceImpl) editingSession.getWorkspace();
        UpdatableItemStateManager stateMgr = wsp.getItemStateManager();

        synchronized (stateMgr) {
            try {
                // add properties to content
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.