* @see org.xmldb.api.modules.XUpdateQueryService#updateResource(java.lang.String, java.lang.String)
*/
public long updateResource(String resource, String xupdate)
throws XMLDBException {
final long start = System.currentTimeMillis();
MutableDocumentSet docs = new DefaultDocumentSet();
final TransactionManager transact = pool.getTransactionManager();
final Txn transaction = transact.beginTransaction();
final Subject preserveSubject = pool.getSubject();
DBBroker broker = null;
final org.exist.collections.Collection c = parent.getCollection();
try {
broker = pool.get(user);
if (resource == null) {
docs = c.allDocs(broker, docs, true);
} else {
final XmldbURI resourceURI = XmldbURI.xmldbUriFor(resource);
final DocumentImpl doc = c.getDocument(broker, resourceURI);
if(doc == null) {
transact.abort(transaction);
throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "Resource not found: " + resource);
}
docs.add(doc);
}
if(processor == null)
{processor = new XUpdateProcessor(broker, docs, parent.getAccessContext());}
else {
processor.setBroker(broker);