From: Adam R. <ad...@ex...> - 2011-05-12 21:30:10
|
On 12 May 2011 23:04, Patrick Bosek <pat...@jo...> wrote: > Fairly sure: > > from file /exist-trunk/src/org/exist/xquery/functions/xmldb/XMLDBRemove.java > > package org.exist.xquery.functions.xmldb; > > import org.apache.log4j.Logger; > import org.exist.dom.QName; > import org.exist.xquery.Cardinality; > import org.exist.xquery.FunctionSignature; > import org.exist.xquery.XPathException; > import org.exist.xquery.XQueryContext; > import org.exist.xquery.value.AnyURIValue; > import org.exist.xquery.value.FunctionParameterSequenceType; > import org.exist.xquery.value.Sequence; > import org.exist.xquery.value.SequenceType; > import org.exist.xquery.value.Type; > import org.xmldb.api.base.Collection; > import org.xmldb.api.base.Resource; > import org.xmldb.api.base.XMLDBException; > import org.xmldb.api.modules.CollectionManagementService; > > .... (line 78) > > Resource resource = collection.getResource(doc); > if (resource == null) { > logger.error("Resource " + doc + " not found"); > throw new XPathException(this, "Resource " + doc + " not > found"); > } > collection.removeResource(resource); > > > Am I missing something? Perhaps. That XMLDB Collection actually maps onto either LocalCollection or RemoteCollection in org.exist.xmldb - so if you look at removing a resource for example in LocalCollection (line 612) then it calls org.exist.collections.Collection.removeResource (line 745), and the trigger is called (line 779 ands 786). RemoteCollection should function in a simialr manner, ignoring the XML-RPC middle layer, it will resolve down to calls on org.exist.collections.Collection. The only reason a Trigger should not be called for xmldb:remove, would be if you are already operating in a trigger environment when invoking that function i.e. an XQueryTrigger. > Cheers, > > Patrick > > > On Thu, May 12, 2011 at 4:55 PM, Adam Retter <ad...@ex...> wrote: >> >> Erm, Are you sure that is the case? >> >> XMLDB module functions should call the xmldb either local or remote >> implementation, but at some point that code has to enter into the >> internal API which is where the trigger should be effected from? >> >> On 12 May 2011 22:41, Patrick Bosek <pat...@jo...> wrote: >> > Hello dev team, >> > >> > I'm making good progress on my upgrade to the triggers in eXist, but >> > I've >> > hit a bump and need some guidance. I've found that xmldb:remove uses >> > "org.xmldb.api.base.Collection" to remove the resource, there by never >> > hitting the trigger code. So, after looking through it I figured I'd >> > change >> > the xmldb:remove to use the remove functions in >> > org.exist.collections.Collection. Is this ok? Or is there another method >> > you >> > would prefer I use? >> > >> > >> > Cheers, >> > >> > -- >> > Patrick Bosek >> > Jorsek Software >> > Cell (585) 820 9634 >> > Office (585) 239 6060 >> > Jorsek.com >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Achieve unprecedented app performance and reliability >> > What every C/C++ and Fortran developer should know. >> > Learn how Intel has extended the reach of its next-generation tools >> > to help boost performance applications - inlcuding clusters. >> > http://p.sf.net/sfu/intel-dev2devmay >> > _______________________________________________ >> > Exist-development mailing list >> > Exi...@li... >> > https://lists.sourceforge.net/lists/listinfo/exist-development >> > >> > >> >> >> >> -- >> Adam Retter >> >> eXist Developer >> { United Kingdom } >> ad...@ex... >> irc://irc.freenode.net/existdb > > > > -- > Patrick Bosek > Jorsek Software > Cell (585) 820 9634 > Office (585) 239 6060 > Jorsek.com > > -- Adam Retter eXist Developer { United Kingdom } ad...@ex... irc://irc.freenode.net/existdb |