final TransactionManager transact = pool.getTransactionManager();
final Txn transaction = transact.beginTransaction();
try {
broker = pool.get(session.getUser());
final org.exist.security.SecurityManager manager = pool.getSecurityManager();
collection = broker.openCollection(resource, Lock.WRITE_LOCK);
if (collection == null) {
// TODO check XML/Binary resource
doc = broker.getXMLResource(resource, Lock.WRITE_LOCK);
if (doc == null)
{throw new RemoteException("document or collection "