Package org.exist.numbering

Examples of org.exist.numbering.NodeId


           
            // put 1000 values into the btree
            long firstToRemove = -1;
            for (int i = 1; i <= 10000; i++) {
                byte[] data = ("Value" + i).getBytes();
                NodeId id = idFact.createInstance(i);
                long addr = domDb.put(txn, new NativeBroker.NodeRef(500, id), data);
//              TODO : test addr ?
                if (i == 1)
                    firstToRemove = addr;
            }
View Full Code Here


        EmbeddedXMLStreamReader reader = broker.newXMLStreamReader(new NodeProxy(root, NodeId.DOCUMENT_NODE, root.getFirstChildAddress()), false);
        List<DiffNode> nodes = new ArrayList<DiffNode>();
        DiffNode node;
        while (reader.hasNext()) {
            int status = reader.next();
            NodeId nodeId = (NodeId) reader.getProperty(EmbeddedXMLStreamReader.PROPERTY_NODE_ID);
            switch (status) {
                case XMLStreamReader.START_ELEMENT:
                    node = new DiffNode(nodeId, status, reader.getQName());
                    nodes.add(node);
View Full Code Here

                // XXX: understand: check permissions here? No, it may slowdown, better to check final set
               
                BytesRef ref = new BytesRef(buf);
                this.nodeIdValues.get(doc, ref);
                int units = ByteConversion.byteToShort(ref.bytes, ref.offset);
                NodeId nodeId = db.getNodeFactory().createFromData(units, ref.bytes, ref.offset + 2);
                //LOG.info("doc: " + docId + "; node: " + nodeId.toString() + "; units: " + units);

                NodeProxy storedNode = new NodeProxy(storedDocument, nodeId);
                if (qname != null)
                    storedNode.setNodeType(qname.getNameType() == ElementValue.ATTRIBUTE ? Node.ATTRIBUTE_NODE : Node.ELEMENT_NODE);
View Full Code Here

    if (!nv.isPersistentSet())
      return nv;
    NodeProxy node = (NodeProxy) nv;
   
    String matchStr = null;
    NodeId nodeId = null;
    try {
      for (EmbeddedXMLStreamReader reader = context.getBroker().getXMLStreamReader(node, true); reader.hasNext(); ) {
          int status = reader.next();
          if (status == XMLStreamConstants.CHARACTERS) {
            matchStr = reader.getText();
View Full Code Here

                final Object[] docs = new Object[1];
                docs[0] = docUri.toString();
                parameters.put(RpcAPI.STATIC_DOCUMENTS, docs);
               
                if(s_id.length() > 0) {
                    final NodeId nodeId = factory.getBrokerPool().getNodeFactory().createFromString(s_id);
                    final NodeProxy node = new NodeProxy(doc, nodeId);
                    nodes = new ExtArrayNodeSet(1);
                    nodes.add(node);
                }
            }
View Full Code Here

    private String retrieve(XmldbURI docUri, String s_id,
            HashMap<String, Object> parameters) throws EXistException, PermissionDeniedException {
        DBBroker broker = null;
        try {
            broker = factory.getBrokerPool().get(user);
            final NodeId nodeId = factory.getBrokerPool().getNodeFactory().createFromString(s_id);
            DocumentImpl doc;
                LOG.debug("loading doc " + docUri);
                doc = (DocumentImpl) broker.getXMLResource(docUri);
            final NodeProxy node = new NodeProxy(doc, nodeId);
            final Serializer serializer = broker.getSerializer();
View Full Code Here

        compression = (String) parameters.get(EXistOutputKeys.COMPRESS_OUTPUT);
      }
      try {
        final XmldbURI docUri=XmldbURI.xmldbUriFor(docName);
        broker = factory.getBrokerPool().get(user);
        final NodeId nodeId = factory.getBrokerPool().getNodeFactory().createFromString(id);
        DocumentImpl doc;
        LOG.debug("loading doc " + docUri);
        doc = (DocumentImpl) broker.getXMLResource(docUri);
        final NodeProxy node = new NodeProxy(doc, nodeId);
View Full Code Here

            domDb.setOwnerObject(this);
           
            BrokerPool.FORCE_CORRUPTION = true;
           
            // put 1000 values into the btree
            NodeId id;
            for (int i = 1; i < 1001; i++) {
              id = idFact.createInstance(i);
                domDb.addValue(txn, new NativeBroker.NodeRef(500, id), i);
            }
           
View Full Code Here

            if (length == 0)
                {return;}
            int pos = 0;
            int startPos = 0;
            NodeProxy nb = array[pos];
            NodeId lastMarked = na.getNodeId();
            while (true) {
                // first, try to find nodes belonging to the same doc
                if (na.getDocument().getDocId() != nb.getDocument().getDocId()) {
                    break;
                }
                // same document
                final NodeId pa = na.getNodeId();
                final NodeId pb = nb.getNodeId();
                final int relation = pb.computeRelation(pa);
                if (relation != -1) {
                    if (relation == NodeId.IS_CHILD) {
                        if(mode == NodeSet.DESCENDANT) {
                            if (Expression.NO_CONTEXT_ID != contextId) {
                                nb.addContextNode(contextId, na);
View Full Code Here

            // of valid child ids
            int low = 0;
            int high = length - 1;
            int mid = 0;
            int cmp;
            NodeId id;
            while (low <= high) {
                mid = (low + high) / 2;
                id = array[mid].getNodeId();
                if (id.isDescendantOrSelfOf(ancestorId)) {
                    break; // found a child node, break out.
                }
                cmp = id.compareTo(ancestorId);
                if (cmp > 0) {
                    high = mid - 1;
                } else {
                    low = mid + 1;
                }
View Full Code Here

TOP

Related Classes of org.exist.numbering.NodeId

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.