Package org.exist.storage

Examples of org.exist.storage.NodePath


        if (nodes == null || nodes.getLength() == 0)
            {return;}
        DBBroker broker = null;
        try {
            broker = ownerDocument.getBrokerPool().get(null);
            final NodePath path = getPath();
            StreamListener listener = null;
            //May help getReindexRoot() to make some useful things
            broker.getIndexController().setDocument(ownerDocument);
            StoredNode reindexRoot = broker.getIndexController().getReindexRoot(this, path, true, true);
            broker.getIndexController().setMode(StreamListener.STORE);
View Full Code Here


        if (!(refChild instanceof StoredNode))
            {throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "wrong node type");}
        DBBroker broker = null;
        try {
            broker = ownerDocument.getBrokerPool().get(null);
            final NodePath path = getPath();
            StreamListener listener = null;
            //May help getReindexRoot() to make some useful things
            broker.getIndexController().setDocument(ownerDocument);
            final StoredNode reindexRoot = broker.getIndexController().getReindexRoot(this, path, true, true);
            broker.getIndexController().setMode(StreamListener.STORE);
View Full Code Here

        if (!(refChild instanceof StoredNode))
            {throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "wrong node type: ");}
        DBBroker broker = null;
        try {
            broker = ownerDocument.getBrokerPool().get(null);
            final NodePath path = getPath();
            StreamListener listener = null;
            //May help getReindexRoot() to make some useful things
            broker.getIndexController().setDocument(ownerDocument);
            final StoredNode reindexRoot = broker.getIndexController().getReindexRoot(this, path, true, true);
            broker.getIndexController().setMode(StreamListener.STORE);
View Full Code Here

     *
     * @param newContent
     * @throws DOMException
     */
    public void update(Txn transaction, NodeList newContent) throws DOMException {
        final NodePath path = getPath();
        // remove old child nodes
        final NodeList nodes = getChildNodes();
        StreamListener listener = null;
        DBBroker broker = null;
        //May help getReindexRoot() to make some useful things
        try {
            broker = ownerDocument.getBrokerPool().get(null);
            broker.getIndexController().setDocument(ownerDocument);
            final StoredNode reindexRoot = broker.getIndexController().getReindexRoot(this, path, true, true);
            broker.getIndexController().setMode(StreamListener.REMOVE_SOME_NODES);
            if (reindexRoot == null) {
                listener = broker.getIndexController().getStreamListener();
            } else {
                broker.getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_SOME_NODES);
            }
            // TODO: fix once range index has been moved to new architecture
            final StoredNode valueReindexRoot = broker.getValueIndex().getReindexRoot(this, path);
            broker.getValueIndex().reindex(valueReindexRoot);
            StoredNode last = this;
            int i = nodes.getLength();
            for (; i > 0; i--) {
                StoredNode child = (StoredNode) nodes.item(i - 1);
                if (child.getNodeType() == Node.ATTRIBUTE_NODE) {
                    last = child;
                    break;
                }
                if (child.getNodeType() == Node.ELEMENT_NODE)
                    {path.addComponent(child.getQName());}
                broker.removeAllNodes(transaction, child, path, listener);
                if (child.getNodeType() == Node.ELEMENT_NODE)
                    {path.removeLastComponent();}
            }
            broker.getIndexController().flush();
            broker.getIndexController().setMode(StreamListener.STORE);
            broker.getIndexController().getStreamListener();
            broker.endRemove(transaction);
View Full Code Here

        StoredNode previousNode = (StoredNode) oldNode.getPreviousSibling();
        if (previousNode == null)
            {previousNode = this;}
        else
            {previousNode = getLastNode(previousNode);}
        final NodePath currentPath = getPath();
        final NodePath oldPath = oldNode.getPath(currentPath);
        DBBroker broker = null;
        try {
            broker = ownerDocument.getBrokerPool().get(null);
            //May help getReindexRoot() to make some useful things
            broker.getIndexController().setDocument(ownerDocument);
            //Check if the change affects any ancestor nodes, which then need to be reindexed later
            StoredNode reindexRoot = broker.getIndexController().getReindexRoot(oldNode, oldPath, false);
            //Remove indexes
            if (reindexRoot == null)
                {reindexRoot = oldNode;}
            broker.getIndexController().reindex(transaction, reindexRoot, StreamListener.REMOVE_SOME_NODES);
            //TODO: fix once range index has been moved to new architecture
            final StoredNode valueReindexRoot = broker.getValueIndex().getReindexRoot(this, oldPath);
            broker.getValueIndex().reindex(valueReindexRoot);
            //Remove the actual node data
            broker.removeNode(transaction, oldNode, oldPath, null);
            broker.endRemove(transaction);
            newNode.nodeId = oldNode.nodeId;
            //Reinsert the new node data
            broker.insertNodeAfter(transaction, previousNode, newNode);
            final NodePath path = newNode.getPath(currentPath);
            broker.indexNode(transaction, newNode, path);
            if (newNode.getNodeType() == Node.ELEMENT_NODE)
            {broker.endElement(newNode, path, null);}
            broker.updateNode(transaction, this, true);
            //Recreate indexes on ancestor nodes
View Full Code Here

            {throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "wrong node type");}
        final StoredNode oldNode = (StoredNode) oldChild;
        if (!oldNode.nodeId.getParentId().equals(nodeId))
            {throw new DOMException(DOMException.NOT_FOUND_ERR,
                "node is not a child of this element");}
        final NodePath oldPath = oldNode.getPath();
        StreamListener listener = null;
        DBBroker broker = null;
        try {
            //May help getReindexRoot() to make some useful things
            broker = ownerDocument.getBrokerPool().get(null);
View Full Code Here

                        final StoredNode old = (StoredNode) oldChild;
                        if (!old.nodeId.isChildOf(nodeId))
                            {throw new DOMException(DOMException.NOT_FOUND_ERR, "node " +
                                old.nodeId.getParentId() +
                                " is not a child of element " + nodeId);}
                        final NodePath oldPath = old.getPath();
                        // remove old custom indexes
                        broker.getIndexController().reindex(transaction, old,
                            StreamListener.REMOVE_SOME_NODES);
                        broker.removeNode(transaction, old, oldPath, null);
                        children--;
                        attributes--;
                    }
                } finally {
                    broker.endRemove(transaction);
                }
            }
            final NodePath path = getPath();
            broker.getIndexController().setDocument(ownerDocument, StreamListener.STORE);
            final StreamListener listener = broker.getIndexController().getStreamListener();
            if (children == 0) {
                appendChildren(transaction, nodeId.newChild(), null,
                    new NodeImplRef(this), path, appendList, listener);
View Full Code Here

        StoredNode previous = (StoredNode) oldNode.getPreviousSibling();
        if (previous == null)
            {previous = this;}
        else
            {previous = getLastNode(previous);}
        final NodePath oldPath = oldNode.getPath();
        StreamListener listener = null;
        //May help getReindexRoot() to make some useful things
        Node newNode = null;
        DBBroker broker = null;
        try {
View Full Code Here

    public RangeIndexConfigElement(Element node, Map<String, String> namespaces) throws DatabaseConfigurationException {
        String match = node.getAttribute("match");
        if (match != null && match.length() > 0) {
            try {
                path = new NodePath(namespaces, match);
                if (path.length() == 0)
                    throw new DatabaseConfigurationException("Range index module: Invalid match path in collection config: " + match);
            } catch (IllegalArgumentException e) {
                throw new DatabaseConfigurationException("Range index module: invalid qname in configuration: " + e.getMessage());
            }
        } else if (node.hasAttribute("qname")) {
            QName qname = LuceneIndexConfig.parseQName(node, namespaces);
            path = new NodePath(NodePath.SKIP);
            path.addComponent(qname);
            isQNameIndex = true;
        }
        String typeStr = node.getAttribute("type");
        if (typeStr != null && typeStr.length() > 0) {
View Full Code Here

            throw new DatabaseConfigurationException("Range index module: field element requires a name attribute");
        }
        String match = elem.getAttribute("match");
        if (match != null && match.length() > 0) {
            try {
                relPath = new NodePath(namespaces, match);
                if (relPath.length() == 0)
                    throw new DatabaseConfigurationException("Range index module: Invalid match path in collection config: " + match);
                path = new NodePath(parentPath);
                path.append(relPath);
            } catch (IllegalArgumentException e) {
                throw new DatabaseConfigurationException("Range index module: invalid qname in configuration: " + e.getMessage());
            }
        } else {
View Full Code Here

TOP

Related Classes of org.exist.storage.NodePath

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.