DocumentImpl doc = (DocumentImpl) broker.openDocument(resource, Lock.READ_LOCK);
DocumentImpl doc = (DocumentImpl) broker.getXMLResource(resource, Lock.READ_LOCK);
    public org.exist.soap.Permissions getPermissions(java.lang.String sessionId, java.lang.String resource) throws java.rmi.RemoteException {        DBBroker broker = null;		Session session = getSession(sessionId);		User user = session.getUser();        try {            broker = pool.get(user);            resource = XmldbURI.checkPath2(resource, DBBroker.ROOT_COLLECTION);//            if (!resource.startsWith("/"))//                resource = '/' + resource;            /*if (!name.startsWith("/db"))                name = "/db" + name;*///            resource = NativeBroker.checkPath(resource, "/db");            Collection collection = broker.openCollection(resource, Lock.READ_LOCK);            Permission perm = null;            if (collection == null) {                DocumentImpl doc = (DocumentImpl) broker.openDocument(resource, Lock.READ_LOCK);                if (doc == null)                    throw new EXistException("document or collection " + resource                            + " not found");                perm = doc.getPermissions();                doc.getUpdateLock().release(Lock.READ_LOCK);            } else {                perm = collection.getPermissions();                collection.release();            }            Permissions p = new Permissions();            p.setOwner(perm.getOwner());            p.setGroup(perm.getOwnerGroup());            p.setPermissions(perm.getPermissions());            return p;        } catch (Exception ex) {        	throw new RemoteException(ex.getMessage());        } finally {            pool.release(broker);        }    }