Examples of NodeKey


Examples of org.modeshape.jcr.cache.NodeKey

     *
     * @param shareableNode the shareable node
     * @return the SharedSet; never null
     */
    public SharedSet getSharedSet( AbstractJcrNode shareableNode ) {
        NodeKey shareableNodeKey = shareableNode.key();
        SharedSet sharedSet = sharedSets.get(shareableNodeKey);
        if (sharedSet == null) {
            SharedSet newSharedSet = new SharedSet(shareableNode);
            sharedSet = sharedSets.putIfAbsent(shareableNodeKey, newSharedSet);
            if (sharedSet == null) sharedSet = newSharedSet;
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

     *
     * @param shareableNode the shareable node that was removed from its shared set
     * @throws RepositoryException if there is a problem
     */
    public void removed( AbstractJcrNode shareableNode ) throws RepositoryException {
        NodeKey shareableNodeKey = shareableNode.key();
        SharedSet sharedSet = getSharedSet(shareableNode);
        if (sharedSet.shareableNode == shareableNode) {
            // We're removing the original shareable node, so we need to recreate the SharedSet after
            // we figure out the new parent ...
            session().releaseCachedNode(shareableNode);
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

         */
        public AbstractJcrNode getSharedNode( CachedNode cachedNode,
                                              NodeKey parentKey ) {
            assert parentKey != null;
            try {
                NodeKey actualParentKey = shareableNode.parentKey();
                assert actualParentKey != null;
                if (!actualParentKey.equals(parentKey)) {

                    // Obtain the set of keys for all parents ...
                    final SessionCache cache = session.cache();
                    Set<NodeKey> additionalParents = cachedNode.getAdditionalParentKeys(cache);

View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

            // Obtain the set of keys for all parents ...
            final SessionCache cache = session().cache();
            Set<NodeKey> additionalParents = shareableNode.node().getAdditionalParentKeys(cache);

            // Obtain the Node objects for each of these ...
            final NodeKey key = shareableNode.key();
            final String workspaceKey = key.getWorkspaceKey();
            Collection<AbstractJcrNode> sharedNodes = new ArrayList<AbstractJcrNode>(additionalParents.size() + 1);
            sharedNodes.add(shareableNode); // add the shareable node
            for (NodeKey parentKey : additionalParents) {
                if (!workspaceKey.equals(parentKey.getWorkspaceKey())) {
                    // The parent node has to be in this workspace ...
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

        this.repository = repository;

        // Get the node key of the workspace we're going to use ...
        final RepositoryCache repositoryCache = repository.repositoryCache();
        WorkspaceCache workspace = repositoryCache.getWorkspaceCache(workspaceName);
        NodeKey rootKey = workspace.getRootKey();

        // Now create a specific reference factories that know about the root node key ...
        TextDecoder decoder = context.getDecoder();
        ValueFactories factories = context.getValueFactories();
        ReferenceFactory rootKeyAwareStrongRefFactory = NodeIdentifierReferenceFactory.newInstance(rootKey, decoder, factories,
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

     */
    AbstractJcrNode node( CachedNode cachedNode,
                          AbstractJcrNode.Type expectedType,
                          NodeKey parentKey ) {
        assert cachedNode != null;
        NodeKey nodeKey = cachedNode.getKey();
        AbstractJcrNode node = jcrNodes.get(nodeKey);
        boolean mightBeShared = true;
        if (node == null) {

            if (expectedType == null) {
                Name primaryType = cachedNode.getPrimaryType(cache);
                expectedType = Type.typeForPrimaryType(primaryType);
                if (expectedType == null) {
                    // If this node from the system workspace, then the default is Type.SYSTEM rather than Type.NODE ...
                    if (repository().systemWorkspaceKey().equals(nodeKey.getWorkspaceKey())) {
                        expectedType = Type.SYSTEM;
                    } else {
                        expectedType = Type.NODE;
                    }
                    assert expectedType != null;
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

    public AbstractJcrNode getNodeByIdentifier( String id ) throws ItemNotFoundException, RepositoryException {
        checkLive();
        if (NodeKey.isValidFormat(id)) {
            // Try the identifier as a node key ...
            try {
                NodeKey key = new NodeKey(id);
                AbstractJcrNode node = node(key, null);
                checkPermission(pathSupplierFor(node), ModeShapePermissions.READ);
                return node;
            } catch (ItemNotFoundException e) {
                // continue ...
            }
        }
        // First, we're given a partial key, so look first in this workspace's content ...
        NodeKey key = null;
        ItemNotFoundException first = null;
        try {
            // Try as node key identifier ...
            key = this.rootNode.key.withId(id);
            AbstractJcrNode node = node(key, null);
            checkPermission(pathSupplierFor(node), ModeShapePermissions.READ);
            return node;
        } catch (ItemNotFoundException e) {
            // Not found, so capture the exception (which we might use later) and continue ...
            first = e;
        }
        // Next look for it using the same key except with the system workspace part ...
        try {
            String systemWorkspaceKey = this.repository().systemWorkspaceKey();
            key = key.withWorkspaceKey(systemWorkspaceKey);
            AbstractJcrNode systemNode = node(key, null);
            if (systemNode instanceof JcrVersionHistoryNode) {
                // because the version history node has the same key as the original node, we don't want to expose it to clients
                // this means that if we got this far, the original hasn't been found, so neither should the version history
                throw first;
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

    public AbstractJcrNode getNonSystemNodeByIdentifier( String id ) throws ItemNotFoundException, RepositoryException {
        checkLive();
        if (NodeKey.isValidFormat(id)) {
            // Try the identifier as a node key ...
            try {
                NodeKey key = new NodeKey(id);
                return node(key, null);
            } catch (ItemNotFoundException e) {
                // continue ...
            }
        }
        // Try as node key identifier ...
        NodeKey key = this.rootNode.key.withId(id);
        return node(key, null);
    }
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

            throw (cause instanceof RepositoryException) ? (RepositoryException)cause : new RepositoryException(e.getCause());
        } catch (DocumentNotFoundException e) {
            throw new InvalidItemStateException(JcrI18n.nodeModifiedBySessionWasRemovedByAnotherSession.text(e.getKey()), e);
        } catch (DocumentAlreadyExistsException e) {
            // Try to figure out which node in this transient state was the problem ...
            NodeKey key = new NodeKey(e.getKey());
            AbstractJcrNode problemNode = node(key, null);
            String path = problemNode.getPath();
            throw new InvalidItemStateException(JcrI18n.nodeCreatedBySessionUsedExistingKey.text(path, key), e);
        } catch (org.modeshape.jcr.cache.ReferentialIntegrityException e) {
            throw new ReferentialIntegrityException(e);
View Full Code Here

Examples of org.modeshape.jcr.cache.NodeKey

            throw (cause instanceof RepositoryException) ? (RepositoryException)cause : new RepositoryException(e.getCause());
        } catch (DocumentNotFoundException e) {
            throw new InvalidItemStateException(JcrI18n.nodeModifiedBySessionWasRemovedByAnotherSession.text(e.getKey()), e);
        } catch (DocumentAlreadyExistsException e) {
            // Try to figure out which node in this transient state was the problem ...
            NodeKey key = new NodeKey(e.getKey());
            AbstractJcrNode problemNode = node(key, null);
            String path = problemNode.getPath();
            throw new InvalidItemStateException(JcrI18n.nodeCreatedBySessionUsedExistingKey.text(path, key), e);
        } catch (org.modeshape.jcr.cache.ReferentialIntegrityException e) {
            throw new ReferentialIntegrityException(e);
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.