trigger.finish(Trigger.REMOVE_DOCUMENT_EVENT, broker, getName() + "/" + docname, doc);
trigger.finish(Trigger.REMOVE_DOCUMENT_EVENT, broker, getName() + "/" + docname, null);
	public void removeDocument(Txn transaction, DBBroker broker, String docname)			throws PermissionDeniedException, TriggerException, LockException {        try {            getLock().acquire(Lock.READ_LOCK);    	    DocumentTrigger trigger = null;    	    if (!docname.endsWith(CollectionConfiguration.COLLECTION_CONFIG_SUFFIX)) {    	        if (triggersEnabled) {    	            CollectionConfiguration config = getConfiguration(broker);    	            if (config != null)    	                trigger = (DocumentTrigger)     	                config.getTrigger(Trigger.REMOVE_DOCUMENT_EVENT);    	        }    	    } else {    	        // we remove a collection.xconf configuration file: tell the configuration manager to    	        // reload the configuration.    	        CollectionConfigurationManager confMgr = broker.getBrokerPool().getConfigurationManager();    	        confMgr.invalidateAll(getName());    	    }    	    DocumentImpl doc = getDocument(broker, docname);    	    if (doc == null)    	        return;    	    if(doc.isLockedForWrite())    	        throw new PermissionDeniedException("Document " + doc.getFileName() +     	        " is locked for write");    	    if (!getPermissions().validate(broker.getUser(), Permission.WRITE))    	        throw new PermissionDeniedException(    	                "Write access to collection denied; user=" + broker.getUser().getName());    	    if (!doc.getPermissions().validate(broker.getUser(), Permission.WRITE))    	        throw new PermissionDeniedException("Permission to remove document denied");    	    if (trigger != null && triggersEnabled) {    	        trigger.prepare(Trigger.REMOVE_DOCUMENT_EVENT, broker, getName() + "/" + docname,    	                doc);    	    }    	        	    broker.removeDocument(transaction, doc);    	    documents.remove(docname);    	    if (trigger != null && triggersEnabled) {    	        trigger.finish(Trigger.REMOVE_DOCUMENT_EVENT, broker, getName() + "/" + docname,    	                doc);    	    }        } finally {            getLock().release();        }	}