Package org.exist.storage

Examples of org.exist.storage.NotificationService


            //start a transaction
            final Txn transaction = getTransaction();
            try {
                final StoredNode[] ql = selectAndLock(transaction, inSeq);
                final NotificationService notifier = context.getBroker().getBrokerPool().getNotificationService();
                final IndexListener listener = new IndexListener(ql);               
                final NodeList contentList = seq2nodeList(contentSeq);
                for (int i = 0; i < ql.length; i++) {
                    final StoredNode node = ql[i];
                    final DocumentImpl doc = (DocumentImpl)node.getOwnerDocument();
                    if (!doc.getPermissions().validate(context.getUser(), Permission.WRITE)) {
                        throw new PermissionDeniedException("User '" + context.getSubject().getName() + "' does not have permission to write to the document '" + doc.getDocumentURI() + "'!");
                    }
                    doc.getMetadata().setIndexListener(listener);
                   
                    //update the document
            if (mode == INSERT_APPEND) {
              node.appendChildren(transaction, contentList, -1);
            } else {
              final NodeImpl parent = (NodeImpl) node.getParentNode();
                      switch (mode) {
                          case INSERT_BEFORE:
                              parent.insertBefore(transaction, contentList, node);
                              break;
                          case INSERT_AFTER:
                              parent.insertAfter(transaction, contentList, node);
                              break;
                      }
            }
                    doc.getMetadata().clearIndexListener();
                    doc.getMetadata().setLastModified(System.currentTimeMillis());
                    modifiedDocuments.add(doc);
                    context.getBroker().storeXMLResource(transaction, doc);
                    notifier.notifyUpdate(doc, UpdateListener.UPDATE);
                }
                finishTriggers(transaction);
                //commit the transaction
                commitTransaction(transaction);
            } catch (final PermissionDeniedException e) {
View Full Code Here

TOP

Related Classes of org.exist.storage.NotificationService

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.