Package org.exist.dom

Examples of org.exist.dom.DefaultDocumentSet


           
            transaction = transact.beginTransaction();
            assertNotNull(transaction);
            System.out.println("Transaction started ...");
           
            MutableDocumentSet docs = new DefaultDocumentSet();
            docs.add(info.getDocument());
            XUpdateProcessor proc = new XUpdateProcessor(broker, docs, AccessContext.TEST);
            assertNotNull(proc);
           
            String xupdate;
            Modification modifications[];
View Full Code Here


            broker = pool.get(pool.getSecurityManager().getSystemSubject());
           
            TransactionManager mgr = pool.getTransactionManager();
           
            IndexInfo info = init(broker, mgr);
            MutableDocumentSet docs = new DefaultDocumentSet();
            docs.add(info.getDocument());
            XUpdateProcessor proc = new XUpdateProcessor(broker, docs, AccessContext.TEST);
           
            Txn transaction = mgr.beginTransaction();
           
            String xupdate;
View Full Code Here

            broker.saveCollection(transaction, root);

            CollectionConfigurationManager mgr = pool.getConfigurationManager();
            mgr.addConfiguration(transaction, broker, root, COLLECTION_CONFIG);

            docs = new DefaultDocumentSet();

            IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create("test_string.xml"), XML);
            assertNotNull(info);
            root.store(transaction, broker, info, XML, false);
View Full Code Here

                  //TODO : how to enforce this ?
                  //If $node, or the context item if the second argument is omitted,
                  //is a node in a tree whose root is not a document node [err:FODC0001] is raised                    processInMem = true;
                    {processInMem = true;}
                else {
                    MutableDocumentSet ndocs = new DefaultDocumentSet();
                    ndocs.add(((NodeProxy)node).getDocument());
                    docs = ndocs;
                }
                contextSequence = node;
            } else if (contextSequence == null)
                {throw new XPathException(this, ErrorCodes.XPDY0002, "no context item specified");}
View Full Code Here

        if( protectedDocuments != null ) {
            staticDocuments = protectedDocuments.toDocumentSet();
            return( staticDocuments );
        }
        MutableDocumentSet ndocs = new DefaultDocumentSet( 1031 );

        if( staticDocumentPaths == null ) {

            // no path defined: return all documents in the db
            try {
                getBroker().getAllXMLResources( ndocs );
            } catch(final PermissionDeniedException pde) {
                LOG.warn("Permission denied to read resource all resources" + pde.getMessage(), pde);
                throw new XPathException("Permission denied to read resource all resources" + pde.getMessage(), pde);
            }
        } else {
            DocumentImpl doc;
            Collection   collection;

            for( int i = 0; i < staticDocumentPaths.length; i++ ) {

                try {
                    collection = getBroker().getCollection( staticDocumentPaths[i] );

                    if( collection != null ) {
                        collection.allDocs( getBroker(), ndocs, true);
                    } else {
                        doc = getBroker().getXMLResource( staticDocumentPaths[i], Lock.READ_LOCK );

                        if( doc != null ) {

                            if( doc.getPermissions().validate(
                                getBroker().getSubject(), Permission.READ ) ) {
                               
                              ndocs.add( doc );
                            }
                            doc.getUpdateLock().release( Lock.READ_LOCK );
                        }
                    }
                }
View Full Code Here


    public void addModifiedDoc( DocumentImpl document )
    {
        if( modifiedDocuments == null ) {
            modifiedDocuments = new DefaultDocumentSet();
        }
        modifiedDocuments.add( document );
    }
View Full Code Here

    throws XMLDBException {
      final Subject preserveSubject = pool.getSubject();
    DBBroker broker = null;
    try {
      broker = pool.get(user);
      final MutableDocumentSet docs = new DefaultDocumentSet();
      parent.getCollection().allDocs(broker, docs, inclusive);
      return broker.getTextEngine().scanIndexTerms(docs, docs.docsToNodeSet(),  start, end);
    } catch (final PermissionDeniedException e) {
      throw new XMLDBException(ErrorCodes.PERMISSION_DENIED,
        "permission denied", e);
    } catch (final EXistException e) {
      throw new XMLDBException(
View Full Code Here

                    }

                } else if (rootNS != null && rootNS.equals(XUpdateProcessor.XUPDATE_NS)) {

                    LOG.debug("Got xupdate request: " + content);
                    final MutableDocumentSet docs = new DefaultDocumentSet();
                    final Collection collection = broker.getCollection(pathUri);
                    if (collection != null) {
                        collection.allDocs(broker, docs, true);

                    } else {
                        final DocumentImpl xupdateDoc = broker.getResource(pathUri, Permission.READ);

                        if (xupdateDoc != null) {
                            docs.add(xupdateDoc);

                        } else {
                            broker.getAllXMLResources(docs);
                        }
                    }
View Full Code Here

        System.out.println("\nstoring document " + documentName + " into collection " + getCollection().getURI());
        if(existingDocument != null) {
            System.out.println("replacing document " + ((DocumentImpl)existingDocument).getFileURI());
        }
        System.out.println("collection contents:");
        final DefaultDocumentSet docs = new DefaultDocumentSet();
       
        try {
            getCollection().getDocuments(broker, docs);
        } catch (final PermissionDeniedException pde) {
            throw new TriggerException(pde.getMessage(), pde);
        }
       
        for (final Iterator<DocumentImpl> i = docs.getDocumentIterator(); i.hasNext(); ) {
            System.out.println("\t" + i.next().getFileURI());
        }
    }
View Full Code Here

            // sections in the query that can be safely cached
      //          if(cached != null) {
      //              result = cached;
      //              docs = cachedDocs;
      //          } else {
      MutableDocumentSet mdocs = new DefaultDocumentSet();
            try {
                context.getBroker().getAllXMLResources(mdocs);
            } catch(final PermissionDeniedException pde) {
                LOG.error(pde.getMessage(), pde);
                throw new XPathException(this, pde);
            }
      docs = mdocs;
      //          }
  } else {
      List<String> args = getParameterValues(contextSequence, contextItem);
      if(cachedArgs != null)
    {cacheIsValid = compareArguments(cachedArgs, args);}
      if(cacheIsValid) {
    result = cached;
    docs = cachedDocs;
      } else {
                MutableDocumentSet mdocs = new DefaultDocumentSet();
    for(int i = 0; i < args.size(); i++) {
        try {
      final String next = (String)args.get(i);
      XmldbURI nextUri = new AnyURIValue(next).toXmldbURI();
      if(nextUri.getCollectionPath().length() == 0) {
          throw new XPathException(this, "Invalid argument to " + XMLDBModule.PREFIX + ":document() function: empty string is not allowed here.");
      }
      if(nextUri.numSegments()==1) {                    
          nextUri = context.getBaseURI().toXmldbURI().resolveCollectionPath(nextUri);
      }
      final DocumentImpl doc = context.getBroker().getResource(nextUri, Permission.READ);
      if(doc == null) {
          if (context.isRaiseErrorOnFailedRetrieval()) {
        throw new XPathException(this, ErrorCodes.FODC0002, "can not access '" + nextUri + "'");
          }           
      }else {
          mdocs.add(doc);
      }
        } catch (final XPathException e) { //From AnyURIValue constructor
                        e.setLocation(line, column);
      logger.error("From AnyURIValue constructor:", e);
View Full Code Here

TOP

Related Classes of org.exist.dom.DefaultDocumentSet

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.