if (trigger != null) { trigger.prepare(Trigger.REMOVE_DOCUMENT_EVENT, broker, transaction, getName() + "/" + docname, doc); }  broker.removeDocument(transaction, doc); documents.remove(docname);
if (trigger != null) { trigger.prepare(Trigger.REMOVE_DOCUMENT_EVENT, broker, transaction, getName() + "/" + docname, doc); }
	public void removeDocument(Txn transaction, DBBroker broker, String docname)			throws PermissionDeniedException, TriggerException, LockException {        try {            getLock().acquire(Lock.READ_LOCK);                	    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");                        DocumentTrigger trigger = null;            if (!CollectionConfiguration.DEFAULT_COLLECTION_CONFIG_FILE.equals(docname)) {                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());            }                	    if (trigger != null) {    	        trigger.prepare(Trigger.REMOVE_DOCUMENT_EVENT, broker, transaction,     	        		getName() + "/" + docname, doc);    	    }    	        	    broker.removeDocument(transaction, doc);    	    documents.remove(docname);                	    if (trigger != null) {    	        trigger.finish(Trigger.REMOVE_DOCUMENT_EVENT, broker, transaction, doc);    	    }                	    broker.getBrokerPool().getNotificationService().notifyUpdate(doc, UpdateListener.REMOVE);                    } finally {            getLock().release();        }	}