Package org.exist.storage.txn

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


        try {
            broker = pool.get(pool.getSecurityManager().getSystemSubject());
            assertNotNull(broker);
            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);
View Full Code Here


                    remove_account.setCollection(broker, collectionRemovedAccounts, XmldbURI.create(UUIDGenerator.getUUID()+".xml"));

                    final TransactionManager transaction = getDatabase().getTransactionManager();
                    Txn txn = null;
                    try {
                        txn = transaction.beginTransaction();

                        collectionAccounts.removeXMLResource(txn, broker, XmldbURI.create( remove_account.getName() + ".xml"));

                        transaction.commit(txn);
                    } catch(final Exception e) {
View Full Code Here

                remove_group.setCollection(broker, collectionRemovedGroups, XmldbURI.create(UUIDGenerator.getUUID() + ".xml"));
   
                final TransactionManager transaction = getDatabase().getTransactionManager();
                Txn txn = null;
                try {
                    txn = transaction.beginTransaction();

                    collectionGroups.removeXMLResource(txn, broker, XmldbURI.create(remove_group.getName() + ".xml" ));

                    transaction.commit(txn);
                } catch (final Exception e) {
View Full Code Here

   
        Collection systemCollection = null;
        try {
          systemCollection = broker.getCollection(XmldbURI.SYSTEM_COLLECTION_URI);
                if(systemCollection == null) {
                    txn = transaction.beginTransaction();
                    systemCollection = broker.getOrCreateCollection(txn, XmldbURI.SYSTEM_COLLECTION_URI);
                    if (systemCollection == null)
                            {return;}
                    systemCollection.setPermissions(Permission.DEFAULT_SYSTEM_COLLECTION_PERM);
                    broker.saveCollection(txn, systemCollection);
View Full Code Here

        }

        try {
            collection = broker.getCollection(SECURITY_COLLECTION_URI);
            if (collection == null) {
                txn = transaction.beginTransaction();
                collection = broker.getOrCreateCollection(txn, SECURITY_COLLECTION_URI);
                if (collection == null){
                    return;
                }
                //if db corrupted it can lead to unrunnable issue
View Full Code Here

        public void apply() {
            try {
              getTarget().getLock().acquire(Lock.WRITE_LOCK);

                final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
                final Txn txn = txnManager.beginTransaction();
              try {
                    final Permission permission = getTarget().getPermissions();
                  permission.setOwner(getOwner());
                  permission.setGroup(getGroup());
                  permission.setMode(getMode());
View Full Code Here

        public void apply() {
            try {
              getTarget().getUpdateLock().acquire(Lock.WRITE_LOCK);

              final TransactionManager txnManager = broker.getDatabase().getTransactionManager();
                final Txn txn = txnManager.beginTransaction();

              try {
               
                final Permission permission = getTarget().getPermissions();
                  permission.setOwner(getOwner());
View Full Code Here

     * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
     */
    @Override
    public Node appendChild(Node child) throws DOMException {
        final TransactionManager transact = ownerDocument.getBrokerPool().getTransactionManager();
        final Txn transaction = transact.beginTransaction();
        final NodeListImpl nl = new NodeListImpl();
        nl.add(child);
        DBBroker broker = null;
        try {
            broker = ownerDocument.getBrokerPool().get(null);
View Full Code Here

        if (!(refChild instanceof StoredNode))
            {throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "Wrong node type");}
        final NodeListImpl nl = new NodeListImpl();
        nl.add(newChild);
        final TransactionManager transact = ownerDocument.getBrokerPool().getTransactionManager();
        final Txn transaction = transact.beginTransaction();
        DBBroker broker = null;
        try {
            broker = ownerDocument.getBrokerPool().get(null);
            insertBefore(transaction, nl, refChild);
            broker.storeXMLResource(transaction, (DocumentImpl) getOwnerDocument());
View Full Code Here

            } catch (final Exception e) {
                throw new PackageException("Bad collection URI for <target> element: " + targetPath);
            }
        }
        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) {
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.