Package org.exist.storage

Examples of org.exist.storage.DBBroker.openCollection()


        final Txn transaction = transact.beginTransaction();
        DBBroker broker = null;
        Collection collection = null;
        try {
            broker = factory.getBrokerPool().get(user);
            collection = broker.openCollection(docUri.removeLastSegment(), Lock.WRITE_LOCK);
            if (collection == null) {
                transact.abort(transaction);
                throw new EXistException("Collection " + docUri.removeLastSegment() + " not found");
            }
            // keep the write lock in the transaction
View Full Code Here


        final Txn transaction = transact.beginTransaction();
        DBBroker broker = null;
        Collection collection = null;
        try {
            broker = factory.getBrokerPool().get(user);
            collection = broker.openCollection(collURI, Lock.WRITE_LOCK);
            if (collection == null) {
              transact.abort(transaction);
                return false;
            }
            // keep the write lock in the transaction
View Full Code Here

            boolean inclusive) throws EXistException, PermissionDeniedException {
        DBBroker broker = null;
        Collection collection = null;
        try {
            broker = factory.getBrokerPool().get(user);
            collection = broker.openCollection(collUri, Lock.READ_LOCK);
            if (collection == null)
                {throw new EXistException("collection " + collUri + " not found");}
            final Occurrences occurrences[] = broker.getElementIndex().scanIndexedElements(collection,
                    inclusive);
            final Vector<Vector<Object>> result = new Vector<Vector<Object>>(occurrences.length);
View Full Code Here

            throws PermissionDeniedException, EXistException {
        DBBroker broker = null;
        Collection collection = null;
        try {
            broker = factory.getBrokerPool().get(user);
            collection = broker.openCollection(collUri, Lock.READ_LOCK);
            if (collection == null)
                {throw new EXistException("collection " + collUri + " not found");}
            final MutableDocumentSet docs = new DefaultDocumentSet();
            collection.allDocs(broker, docs, inclusive);
            final NodeSet nodes = docs.docsToNodeSet();
View Full Code Here

        Collection destination = null;
        DocumentImpl doc = null;
        try {
          //TODO : use  transaction.registerLock(collection.getLock(), Lock.WRITE_LOCK);
            broker = factory.getBrokerPool().get(user);
            collection = broker.openCollection(docUri.removeLastSegment(), move ? Lock.WRITE_LOCK : Lock.READ_LOCK);
            if (collection == null) {
                transact.abort(transaction);
                throw new EXistException("Collection " + docUri.removeLastSegment() + " not found");
            }          
            doc = collection.getDocumentWithLock(broker, docUri.lastSegment(), Lock.WRITE_LOCK);
View Full Code Here

                throw new EXistException("Document " + docUri + " not found");
            }
            //TODO : register the lock within the transaction ?
           
            // get destination collection
            destination = broker.openCollection(destUri, Lock.WRITE_LOCK);
            if(destination == null) {
                transact.abort(transaction);
                throw new EXistException("Destination collection " + destUri + " not found");
            }
            if(move)
View Full Code Here

        Collection destination = null;
        try {
            broker = factory.getBrokerPool().get(user);
            // get source document
            //TODO : use  transaction.registerLock(collection.getLock(), Lock.WRITE_LOCK);
            collection = broker.openCollection(collUri, move ? Lock.WRITE_LOCK : Lock.READ_LOCK);
            if (collection == null) {
                transact.abort(transaction);
                throw new EXistException("Collection " + collUri + " not found");
            }           
            // get destination collection
View Full Code Here

            if (collection == null) {
                transact.abort(transaction);
                throw new EXistException("Collection " + collUri + " not found");
            }           
            // get destination collection
            destination = broker.openCollection(destUri, Lock.WRITE_LOCK);
            if(destination == null) {
                transact.abort(transaction);
                throw new EXistException("Destination collection " + destUri + " not found");
            }           
            if(move)
View Full Code Here

        BrokerPool pool = BrokerPool.getInstance();
       
    try {
      broker = pool.get(pool.getSecurityManager().getSystemSubject());
     
      Collection testCollection = broker.openCollection(TestConstants.TEST_COLLECTION_URI, Lock.READ_LOCK);
      try{

        XmldbURI docPath = TestConstants.TEST_COLLECTION_URI.append(DOCUMENT_NAME_URI);
       
        BinaryDocument binDoc = (BinaryDocument) broker.getXMLResource(docPath, Lock.NO_LOCK);
View Full Code Here

            broker = pool.get(user);
           
            final XmldbURI collectionUri = XmldbURI.create(xmldbURL.getCollection());
            final XmldbURI documentUri = XmldbURI.create(xmldbURL.getDocumentName());
           
            collection = broker.openCollection(collectionUri, Lock.READ_LOCK);
           
            if(collection == null)
                {throw new IOException("Resource "+collectionUri.toString()+" is not a collection.");}
           
            if(collection.hasChildCollection(broker, documentUri))
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.