public void removeResource( Resource res ) throws XMLDBException { if( !(res instanceof XMLResource) ) throw new XMLDBException( ErrorCodes.NOT_IMPLEMENTED ); if ( res == null ) return; String name = ((XMLResource)res).getDocumentId(); String path = getPath() + '/' + name; DocumentImpl doc = collection.getDocument( path ); if ( doc == null ) throw new XMLDBException( ErrorCodes.INVALID_RESOURCE, "resource " + name + " not found" ); DBBroker broker = null; try { broker = brokerPool.get(user); collection.removeDocument(broker, name); } catch ( EXistException e ) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage(), e ); } catch ( PermissionDeniedException e ) { throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, e.getMessage(), e ); } catch (TriggerException e) { throw new XMLDBException( ErrorCodes.INVALID_RESOURCE, e.getMessage(), e);
public void removeResource(Resource res) throws XMLDBException { if (res == null) return; String name = res.getId(); LOG.debug("removing " + name); String path = getPath() + '/' + name; DocumentImpl doc = collection.getDocument(path); if (doc == null) throw new XMLDBException( ErrorCodes.INVALID_RESOURCE, "resource " + name + " not found"); DBBroker broker = null; try { broker = brokerPool.get(user); if(res.getResourceType().equals("XMLResource")) collection.removeDocument(broker, name); else collection.removeBinaryResource(broker, name); } catch (EXistException e) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage(), e); } catch (PermissionDeniedException e) { throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, e.getMessage(), e); } catch (TriggerException e) { throw new XMLDBException( ErrorCodes.INVALID_RESOURCE, e.getMessage(), e);
    public void removeResource( Resource res ) throws XMLDBException {        if( !(res instanceof XMLResource) )            throw new XMLDBException( ErrorCodes.NOT_IMPLEMENTED );        if ( res == null )            return;		String name = ((XMLResource)res).getDocumentId();        String path = getPath() + '/' + name;        DocumentImpl doc = collection.getDocument( path );        if ( doc == null )            throw new XMLDBException( ErrorCodes.INVALID_RESOURCE,                "resource " + name + " not found" );        DBBroker broker = null;        try {            broker = brokerPool.get(user);            collection.removeDocument(broker, name);        } catch ( EXistException e ) {            throw new XMLDBException( ErrorCodes.VENDOR_ERROR,                e.getMessage(),                e );        } catch ( PermissionDeniedException e ) {            throw new XMLDBException( ErrorCodes.PERMISSION_DENIED,                e.getMessage(),                e );        } catch (TriggerException e) {			throw new XMLDBException( ErrorCodes.INVALID_RESOURCE,                e.getMessage(), e);		} finally {            brokerPool.release( broker );        }        needsSync = true;		load(getPath());    }