Package org.exist.storage.txn

Examples of org.exist.storage.txn.TransactionManager.beginTransaction()


        }
        builder.endDocument();
        final DocumentImpl updatedXML = builder.getDocument();

        final TransactionManager mgr = broker.getBrokerPool().getTransactionManager();
        final Txn txn = mgr.beginTransaction();
        try {
            final Collection collection = broker.getOrCreateCollection(txn, targetCollection);
            final XmldbURI name = XmldbURI.createInternal("repo.xml");
            final IndexInfo info = collection.validateXMLResource(txn, broker, name, updatedXML);
            final Permission permission = info.getDocument().getPermissions();
View Full Code Here


     * @param directory
     * @param target
     */
    private void scanDirectory(File directory, XmldbURI target, boolean inRootDir) {
        final TransactionManager mgr = broker.getBrokerPool().getTransactionManager();
        final Txn txn = mgr.beginTransaction();
        Collection collection = null;
        try {
            collection = broker.getOrCreateCollection(txn, target);
            setPermissions(true, null, collection.getPermissionsNoLock());
            broker.saveCollection(txn, collection);
View Full Code Here

                MimeType mime = mimeTab.getContentTypeFor(file.getName());
                if (mime == null)
                    {mime = MimeType.BINARY_TYPE;}
                final XmldbURI name = XmldbURI.create(file.getName());

                final Txn txn = mgr.beginTransaction();
                try {
                    if (mime.isXMLType()) {
                        final InputSource is = new InputSource(file.toURI().toASCIIString());
                        final IndexInfo info = targetCollection.validateXMLResource(txn, broker, name, is);
                        info.getDocument().getMetadata().setMimeType(mime.getName());
View Full Code Here

                    return new SkippedEntryDeferredPermission();
                }
            }

          final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
          final Txn txn = txnManager.beginTransaction();
          try {
            currentCollection = broker.getOrCreateCollection(txn, collUri);
           
            rh.startCollectionRestore(currentCollection, atts);
           
View Full Code Here

            if(currentCollection instanceof Observable) {
                listener.observe((Observable)currentCollection);
            }

      final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
      final Txn txn = txnManager.beginTransaction();
 
      DocumentImpl resource = null;
      try {
        if ("XMLResource".equals(type)) {
          // store as xml resource
View Full Code Here

          try {
            final Collection col = broker.getCollection(currentCollection.getURI().append(name));
            if(col != null) {
              //delete
              final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
              final Txn txn = txnManager.beginTransaction();
              try {
                    broker.removeCollection(txn, col);
                txnManager.commit(txn);
              } catch (final Exception e) {
                txnManager.abort(txn);
View Full Code Here

            final XmldbURI uri = XmldbURI.create(name);
            final DocumentImpl doc = currentCollection.getDocument(broker, uri);
           
            if (doc != null) {
              final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
              final Txn txn = txnManager.beginTransaction();
                try {
                 
                  if (doc.getResourceType() == DocumentImpl.BINARY_FILE) {
                      currentCollection.removeBinaryResource(txn, broker, uri);
                  } else {
View Full Code Here

    }
   
    private Collection mkcol(XmldbURI collPath, Date created) throws SAXException {
       
      final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
      final Txn txn = txnManager.beginTransaction();
      try {
        final Collection col = broker.getOrCreateCollection(txn, collPath);
       
        txnManager.commit(txn);
       
View Full Code Here

        Txn txn = null;

        try {
          collection = broker.getCollection(COLLETION_URI);
      if (collection == null) {
        txn = transaction.beginTransaction();
        collection = broker.getOrCreateCollection(txn, COLLETION_URI);
        if (collection == null) {return;}
          //if db corrupted it can lead to unrunnable issue
          //throw new ConfigurationException("Collection '/db/system/plugins' can't be created.");
       
View Full Code Here

 
          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);
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.