if (existingDocument == null)
if (existingDocument instanceof BinaryDocument)
	public void prepare(int event, DBBroker broker, Txn transaction, String documentName, DocumentImpl existingDocument)		throws TriggerException {				//TODO : think		if (existingDocument == null) return;		if (existingDocument instanceof BinaryDocument) return;				LOG.debug("Preparing " + eventToString(event) + "XQuery trigger for document : '" + documentName + "'");				if (query == null)			return;                                        XQueryContext context = service.newContext();        //TODO : futher initializations ?        CompiledXQuery compiledQuery;        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)existingDocument));	        context.declareGlobalVariable(globalVar);	        */        	        	context.declareVariable(bindingPrefix + "collectionName", new StringValue(collection.getName()));        	context.declareVariable(bindingPrefix + "documentName", new StringValue(documentName));        	context.declareVariable(bindingPrefix + "triggerEvent", new StringValue(eventToString(event)));         	if (existingDocument == null)        		context.declareVariable(bindingPrefix + "document", Sequence.EMPTY_SEQUENCE);        	else        		context.declareVariable(bindingPrefix + "document", (DocumentImpl)existingDocument);	        	                } catch (XPathException e) {        	query = null; //prevents future use        	throw new TriggerException("Error during trigger prepare", e);	    } catch (IOException e) {        	query = null; //prevents future use        	throw new TriggerException("Error during trigger prepare", e);	    }        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) {        	query = null; //prevents future use        	throw new TriggerException("Error during trigger prepare", e);		}	   			}