public void finish(int event, DBBroker broker, Txn transaction, DocumentImpl document) {   if (document == null) return; if (document instanceof BinaryDocument) return;
public void finish(int event, DBBroker broker, Txn transaction, DocumentImpl document) {
    public void finish(int event, DBBroker broker, Txn transaction, DocumentImpl document) {    			//TODO : think    	if (document == null) return;    	if (document instanceof BinaryDocument) return;    	    	LOG.debug("Finishing " + eventToString(event) + "XQuery trigger for document : '" + document.getName() + "'");		if (query == null)			return;		        XQueryContext context = service.newContext();        CompiledXQuery compiledQuery = null;        try {        	        	compiledQuery = service.compile(context, new StringSource(query));        	        	/*        	Variable globalVar;        	globalVar = new Variable(new QName("collectionName", XQueryContext.EXIST_NS, "exist"));	        globalVar.setValue(new StringValue(collection.getName()));	    	        context.declareGlobalVariable(globalVar);	        	        globalVar = new Variable(new QName("documentName", XQueryContext.EXIST_NS, "exist"));	        globalVar.setValue(new StringValue(documentName));	        context.declareGlobalVariable(globalVar);	        globalVar = new Variable(new QName("triggerEvent", XQueryContext.EXIST_NS, "exist"));	        globalVar.setValue(new StringValue(eventToString(event)));	        context.declareGlobalVariable(globalVar);	  	        globalVar = new Variable(new QName("document", XQueryContext.EXIST_NS, "exist"));	        globalVar.setValue(new NodeProxy((DocumentImpl)document));	        context.declareGlobalVariable(globalVar);	        */        	      	        	context.declareVariable(bindingPrefix + "collectionName", new StringValue(collection.getName()));        	context.declareVariable(bindingPrefix + "documentName", new StringValue(document.getName()));        	context.declareVariable(bindingPrefix + "triggerEvent", new StringValue(eventToString(event)));        	context.declareVariable(bindingPrefix + "document", (DocumentImpl)document);	        	                } catch (XPathException e) {        	//Should never be reached	    } catch (IOException e) {	    	//Should never be reached	    }        try {        	//TODO : should we provide another contextSet ?	        NodeSet contextSet = NodeSet.EMPTY_SET;	        			service.execute(compiledQuery, contextSet);			//TODO : should we have a special processing ?			LOG.debug("done.");			        } catch (XPathException e) {        	//Should never be reached		}	       }	