docs.add(this.doc); System.out.println("doc is " + this.doc.hashCode());
docs.add(doc);
	public void prepare(int event, DBBroker broker, String documentName, Document existingDocument)		throws TriggerException {		String xupdate;		// we react to the store and remove events		if(event == STORE_DOCUMENT_EVENT)			// create XUpdate command for inserts			xupdate = "<?xml version=\"1.0\"?>" +				"<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +				"<xu:append select='/contents'><xu:element name='file'>" +				documentName +				"</xu:element></xu:append></xu:modifications>";		else if(event == REMOVE_DOCUMENT_EVENT)			// create XUpdate command for removals			xupdate = "<?xml version=\"1.0\"?>" +				"<xu:modifications version=\"1.0\" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +				"<xu:remove select=\"//file[text()='" + documentName + "']\"></xu:remove>" +				"</xu:modifications>";		else			return;		getLogger().debug(xupdate);		// create a document set containing "contents.xml"		DocumentSet docs = new DocumentSet();		docs.add(this.doc);		System.out.println("doc is " + this.doc.hashCode());		try {			// IMPORTANT: temporarily disable triggers on the collection.			// We would end up in infinite recursion if we don't do that			getCollection().setTriggersEnabled(false);			// create the XUpdate processor			XUpdateProcessor processor = new XUpdateProcessor(broker, docs);			// process the XUpdate			Modification modifications[] = processor.parse(new InputSource(new StringReader(xupdate)));			for(int i = 0; i < modifications.length; i++)				modifications[i].process();			broker.flush();		} catch (Exception e) {			e.printStackTrace();			throw new TriggerException(e.getMessage(), e);		} finally {			// IMPORTANT: reenable trigger processing for the collection.			getCollection().setTriggersEnabled(true);		}	}