Package org.exist.storage.txn

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


            final Permission permission = info.getDocument().getPermissions();
            setPermissions(false, MimeType.XML_TYPE, permission);

            collection.store(txn, broker, info, updatedXML, false);

            mgr.commit(txn);
        } catch (final Exception e) {
            mgr.abort(txn);
        } finally {
            mgr.close(txn);
        }
View Full Code Here


        Collection collection = null;
        try {
            collection = broker.getOrCreateCollection(txn, target);
            setPermissions(true, null, collection.getPermissionsNoLock());
            broker.saveCollection(txn, collection);
            mgr.commit(txn);
        } catch (final Exception e) {
            mgr.abort(txn);
        } finally {
            mgr.close(txn);
        }
View Full Code Here

                        final Permission permission = doc.getPermissions();
                        setPermissions(false, mime, permission);
                        doc.getMetadata().setMimeType(mime.getName());
                        broker.storeXMLResource(txn, doc);
                    }
                    mgr.commit(txn);
                } catch (final Exception e) {
                    mgr.abort(txn);
                    e.printStackTrace();
                } finally {
                    mgr.close(txn);
View Full Code Here

           
            rh.startCollectionRestore(currentCollection, atts);
           
                broker.saveCollection(txn, currentCollection);

            txnManager.commit(txn);
          } catch (final Exception e) {
            txnManager.abort(txn);
            throw new SAXException(e);
        } finally {
                txnManager.close(txn);
View Full Code Here

          rh.startDocumentRestore(resource, atts);

          resource = currentCollection.addBinaryResource(txn, broker, (BinaryDocument)resource, is.getByteStream(), mimetype, is.getByteStreamLength() , date_created, date_modified);
        }

        txnManager.commit(txn);

                final DeferredPermission deferredPermission;
                if(name.startsWith(XmldbURI.SYSTEM_COLLECTION)) {
                    //prevents restore of a backup from changing system collection resource ownership
                    deferredPermission = new ResourceDeferredPermission(listener, resource, SecurityManager.SYSTEM, SecurityManager.DBA_GROUP, Integer.parseInt(perms, 8));
View Full Code Here

              //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);
               
                    listener.warn("Failed to remove deleted collection: " + name + ": " + e.getMessage());
          } finally {
View Full Code Here

                  if (doc.getResourceType() == DocumentImpl.BINARY_FILE) {
                      currentCollection.removeBinaryResource(txn, broker, uri);
                  } else {
                    currentCollection.removeXMLResource(txn, broker, uri);
                  }
                  txnManager.commit(txn);
 
                } catch(final Exception e) {
                  txnManager.abort(txn);
                 
                    listener.warn("Failed to remove deleted resource: " + name + ": " + e.getMessage());
View Full Code Here

      final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
      final Txn txn = txnManager.beginTransaction();
      try {
        final Collection col = broker.getOrCreateCollection(txn, collPath);
       
        txnManager.commit(txn);
       
        return col;
      } catch (final Exception e) {
        txnManager.abort(txn);
        throw new SAXException(e);
View Full Code Here

          //throw new ConfigurationException("Collection '/db/system/plugins' can't be created.");
       
        collection.setPermissions(Permission.DEFAULT_SYSTEM_SECURITY_COLLECTION_PERM);
        broker.saveCollection(txn, collection);

        transaction.commit(txn);
      }
        } catch (final Exception e) {
      transaction.abort(txn);
      e.printStackTrace();
      LOG.debug("loading configuration failed: " + e.getMessage());
View Full Code Here

      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;
      } finally {
                tm.close(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.