Package org.exist.collections

Examples of org.exist.collections.Collection$CloseShieldReader


        broker = db.get(null);
      } catch (final EXistException e) {
        return false;
      }
 
          final Collection collection = broker.getCollection(uri.toCollectionPathURI());
          if (collection != null) {return true;}
 
          final Collection parent_collection = broker.getCollection(uri.toCollectionPathURI().removeLastSegment());
          if (parent_collection == null) {return false;}
 
          tm = db.getTransactionManager();
      final Txn transaction = tm.beginTransaction();
     
      try {
        final Collection child = broker.getOrCreateCollection(transaction, uri.toCollectionPathURI());
        broker.saveCollection(transaction, child);
        tm.commit(transaction);
      } catch (final Exception e) {
          tm.abort(transaction);
        return false;
View Full Code Here


        broker = db.get(null);
      } catch (final EXistException e) {
        return false;
      }
 
          final Collection collection = broker.getCollection(uri.toCollectionPathURI());
          if (collection != null) {return true;}
 
      tm = db.getTransactionManager();
      final Txn transaction = tm.beginTransaction();
     
      try {
        final Collection child = broker.getOrCreateCollection(transaction, uri.toCollectionPathURI());
        broker.saveCollection(transaction, child);
        tm.commit(transaction);
      } catch (final Exception e) {
          tm.abort(transaction);
        return false;
View Full Code Here

            transact = pool.getTransactionManager();
            assertNotNull(transact);
            transaction = transact.beginTransaction();
            assertNotNull(transaction);

            Collection root = broker.getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
        broker.saveCollection(transaction, root);
            assertNotNull(root);

            root.addBinaryResource(transaction, broker, XmldbURI.create(name), data.getBytes(), "application/xquery");

            transact.commit(transaction);
        } catch (Exception e) {
            if (transact != null)
                transact.abort(transaction);
View Full Code Here

        public boolean hasNext() {
            return nextCollection != null;
        }

        public Collection next() {
            final Collection oldCollection = nextCollection;
            nextCollection = null;
            while (nodeIterator.hasNext()) {
                final NodeProxy p = nodeIterator.next();
                if (!p.getDocument().getCollection().equals(oldCollection)) {
                    nextCollection = p.getDocument().getCollection();
View Full Code Here

    public final static IndexFlags checkForQNameIndex( IndexFlags idxflags, XQueryContext context, Sequence contextSequence, QName contextQName )
    {
        idxflags.reset( contextQName != null );

        for( final Iterator<Collection> i = contextSequence.getCollectionIterator(); i.hasNext(); ) {
            final Collection collection = i.next();

            if( collection.getURI().equalsInternal( XmldbURI.SYSTEM_COLLECTION_URI ) ) {
                continue;
            }
            final IndexSpec idxcfg = collection.getIndexConfiguration( context.getBroker() );

            if( idxflags.indexOnQName && ( idxcfg.getIndexByQName( contextQName ) == null ) ) {
                idxflags.indexOnQName = false;

                if( LOG.isTraceEnabled() ) {
                    LOG.trace( "cannot use index on QName: " + contextQName + ". Collection " + collection.getURI() + " does not define an index" );
                }
            }

            if( !idxflags.hasIndexOnQNames && idxcfg.hasIndexesByQName() ) {
                idxflags.hasIndexOnQNames = true;
View Full Code Here

                        doc = context.getBroker().getXMLResource(xmldburi, Lock.READ_LOCK);

                        if(doc == null)
                        {
                            // no doc, try for a collection
                            Collection col = context.getBroker().getCollection(xmldburi);

                            if(col != null)
                            {
                                // got a collection
                                compressCollection(os, col, useHierarchy, stripOffset);
View Full Code Here

    }
    // iterate over child collections
    for (Iterator<XmldbURI> itChildCols = col.collectionIterator(context.getBroker()); itChildCols.hasNext();) {
      // get the child collection
      XmldbURI childColURI = (XmldbURI) itChildCols.next();
      Collection childCol = context.getBroker().getCollection(col.getURI().append(childColURI));
      // recurse
      compressCollection(os, childCol, useHierarchy, stripOffset);
    }
  }
View Full Code Here

*/
public class Utils {

    public static Collection createCollection(DBBroker broker, Txn txn, XmldbURI uri) throws PermissionDeniedException, IOException, LockException, TriggerException {

        final Collection collection = broker.getOrCreateCollection(txn, uri);

        if(collection == null) {
            throw new IOException("Collection " + uri + " cannot be created.");
        }

        collection.setPermissions(Permission.DEFAULT_SYSTEM_SECURITY_COLLECTION_PERM);
        broker.saveCollection(txn, collection);

        return collection;
    }
View Full Code Here

        return collection;
    }
   
    public static Collection getOrCreateCollection(DBBroker broker, Txn txn, XmldbURI collectionUri) throws PermissionDeniedException, IOException, LockException, TriggerException {
        Collection col = broker.getCollection(collectionUri);
        if(col == null) {
            col = createCollection(broker, txn, collectionUri);
        }
        return col;
    }
View Full Code Here

            }
        }
        final TransactionManager mgr = broker.getBrokerPool().getTransactionManager();
        final Txn txn = mgr.beginTransaction();
        try {
            Collection collection = broker.getOrCreateCollection(txn, targetCollection);
            if (collection != null)
                {broker.removeCollection(txn, collection);}
            if (target != null) {
                final XmldbURI configCollection = XmldbURI.CONFIG_COLLECTION_URI.append(targetCollection);
                collection = broker.getOrCreateCollection(txn, configCollection);
View Full Code Here

TOP

Related Classes of org.exist.collections.Collection$CloseShieldReader

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.