Examples of NodeProxy


Examples of org.exist.dom.NodeProxy

      } else {
          result = contextSequence.toNodeSet().copy();

          if (inPredicate) {
            for (final SequenceIterator i = result.iterate(); i.hasNext();) {
              final NodeProxy item = (NodeProxy) i.nextItem();
//              item.addContextNode(getExpressionId(), item);
              if (contextId != Expression.NO_CONTEXT_ID)
                            {item.addContextNode(contextId, item);}
              else
                {item.addContextNode(getExpressionId(), item);}
            }
          }

          // evaluate argument expression
          final Sequence argSeq = arg.eval(result);
View Full Code Here

Examples of org.exist.dom.NodeProxy

            try {
                if (!context.inProtectedMode() && !dlock.hasLock()) {
                    dlock.acquire(Lock.READ_LOCK);
                    lockAcquired = true;
                }
                result.add(new NodeProxy(doc)); // , -1, Node.DOCUMENT_NODE));
            } catch (final LockException e) {
                throw new XPathException(e.getMessage());
            } finally {
                if (lockAcquired)
                    {dlock.release(Lock.READ_LOCK);}
View Full Code Here

Examples of org.exist.dom.NodeProxy

        if (node != null) {
            RecordPos rec = null;
            if (StorageAddress.hasAddress(node.getInternalAddress()))
                {rec = db.findRecord(node.getInternalAddress());}
            if (rec == null) {
                final long addr = db.findValue(broker, new NodeProxy(node));
                if (addr == BTree.KEY_NOT_FOUND)
                    {return false;}
                rec = db.findRecord(addr);
            }
            pageNum = rec.getPage().getPageNum();
View Full Code Here

Examples of org.exist.dom.NodeProxy

            String xml[] = null;
            if (Type.subTypeOf(qr.getItemType(), Type.NODE)) {
                // Fix typecast exception RMT
//        NodeList resultSet = (NodeSet)qr;
                final ExtArrayNodeSet hitsByDoc = new ExtArrayNodeSet();
                NodeProxy p;
                String ppath;
                for (final SequenceIterator i = qr.iterate(); i.hasNext(); ) {
//        for (Iterator i = ((NodeSet) resultSet).iterator(); i.hasNext();) {
                    p = (NodeProxy) i.nextItem();
                    ///TODO : use dedicated function in XmldbURI
                    ppath = p.getDocument().getCollection().getURI().toString() + '/' + p.getDocument().getFileURI();
                    if (ppath.equals(path))
                        {hitsByDoc.add(p);}
                }
                --start;
                if (start < 0 || start > hitsByDoc.getLength())
                    {throw new RemoteException(
                            "index " + start + "out of bounds (" + hitsByDoc.getLength() + ")");}
                if (start + howmany >= hitsByDoc.getLength())
                    {howmany = hitsByDoc.getLength() - start;}
                final Serializer serializer = broker.getSerializer();
                serializer.reset();
                serializer.setProperty(OutputKeys.INDENT, indent ? "yes" : "no");
                serializer.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, xinclude ? "yes" : "no");
                serializer.setProperty(EXistOutputKeys.HIGHLIGHT_MATCHES, highlight);
               
                xml = new String[howmany];
                int j=0;
                for (int i = start; i < start + howmany; i++) {
                    final NodeProxy proxy = ((NodeSet) hitsByDoc).get(i);
                    if (proxy == null)
                        {throw new RuntimeException("not found: " + start);}
                    xml[j] = serializer.serialize(proxy);
                    j++; // update count number of results
                }
View Full Code Here

Examples of org.exist.dom.NodeProxy

      for (final SequenceIterator i = results.iterate(); i.hasNext(); ) {
          final Item item = i.nextItem();
          if(Type.subTypeOf(item.getType(), Type.NODE)) {
              final NodeValue node = (NodeValue)item;
              if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) {
                  final NodeProxy p = (NodeProxy)node;
                  if ((documents = (TreeMap) collections.get(p.getDocument().getCollection().getURI())) == null) {
                      documents = new TreeMap();
                      collections.put(p.getDocument().getCollection().getURI(), documents);
                  }
                  if ((hits = (Integer) documents.get(p.getDocument().getFileURI())) == null)
                      documents.put(p.getDocument().getFileURI(), Integer.valueOf(1));
                  else
                      documents.put(p.getDocument().getFileURI(), Integer.valueOf(hits.intValue() + 1));
              }
          }
      }
    } catch (final XPathException e) {
      throw new RemoteException(e.getMessage());
View Full Code Here

Examples of org.exist.dom.NodeProxy

        Terms terms = fields.terms(RangeIndexWorker.FIELD_ID);
        if (terms != null) {
            TermsEnum termsEnum = terms.iterator(null);
            DocsEnum docs = null;
            for (NodeSetIterator i = contextSet.iterator(); i.hasNext(); ) {
                NodeProxy node = i.next();
                BytesRef lowerBound = new BytesRef(LuceneUtil.createId(node.getDoc().getDocId(), node.getNodeId()));
                BytesRef upperBound = new BytesRef(LuceneUtil.createId(node.getDoc().getDocId(), node.getNodeId().nextSibling()));

                if (termsEnum.seekCeil(lowerBound, false) != TermsEnum.SeekStatus.END) {
                    do {
                        BytesRef nextId = termsEnum.term();
                        if (nextId.compareTo(upperBound) < 0) {
View Full Code Here

Examples of org.exist.dom.NodeProxy

    DBBroker broker = null;
    try {
      broker = db.acquireBroker();
      Serializer serializer = broker.getSerializer();
      if (item instanceof NodeProxy) {
        NodeProxy proxy = (NodeProxy) item;
        if (proxy.isDocument()) {
          return serializer.serialize(proxy.getDocument());
        }
      }
      return serializer.serialize((NodeValue) item);
    } catch (SAXException e) {
      throw new DatabaseException(e);
View Full Code Here

Examples of org.exist.dom.NodeProxy

                    continue;
                }
                //contextSet == null should be used to scan the whole index
                if (contextSet == null || refine_query_on_doc || contextSet.getDocumentSet().contains(doc.getDocId())) {
                    NodeId nodeId = new DLN(rs.getInt("NODE_ID_UNITS"), rs.getBytes("NODE_ID"), 0);
                    NodeProxy p = new NodeProxy(doc, nodeId);
                    //Node is in the context : check if it is accurate
                    //contextSet.contains(p) would have made more sense but there is a problem with
                    //VirtualNodeSet when on the DESCENDANT_OR_SELF axis
                    if (contextSet == null || contextSet.get(p) != null) {
                        boolean geometryMatches = false;
View Full Code Here

Examples of org.exist.dom.NodeProxy

                    //Ignore since the broker has no right on the document
                    continue;
                }
                if (contextSet == null || refine_query_on_doc || contextSet.getDocumentSet().contains(doc.getDocId())) {
                    NodeId nodeId = new DLN(rs.getInt("NODE_ID_UNITS"), rs.getBytes("NODE_ID"), 0);
                    NodeProxy p = new NodeProxy(doc, nodeId);
                    //Node is in the context : check if it is accurate
                    //contextSet.contains(p) would have made more sense but there is a problem with
                    //VirtualNodeSet when on the DESCENDANT_OR_SELF axis
                    if (contextSet.get(p) != null) {
                        Geometry geometry = wkbReader.read(rs.getBytes(1));
View Full Code Here

Examples of org.exist.dom.NodeProxy

                    //Ignore since the broker has no right on the document
                    continue;
                }
                if (contextSet.getDocumentSet().contains(doc.getDocId())) {
                    NodeId nodeId = new DLN(rs.getInt("NODE_ID_UNITS"), rs.getBytes("NODE_ID"), 0);
                    NodeProxy p = new NodeProxy(doc, nodeId);
                    //Node is in the context : check if it is accurate
                    //contextSet.contains(p) would have made more sense but there is a problem with
                    //VirtualNodeSet when on the DESCENDANT_OR_SELF axis
                    if (contextSet.get(p) != null) {
                        if (rs.getMetaData().getColumnClassName(1).equals(Boolean.class.getName())) {
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.