From: M. D. P. <m.d...@gm...> - 2005-04-01 12:49:18
|
Dr Kay, (and Jeroen) > The extension mechanisms in Saxon are now highly configurable: you can plug > in "extension binders" I assume you are refering to the released 8.3 build in this regard? I am still going through and mapping this portion of the code and documenting the areas in which I have questions. To be honest I hadnt realized that this was even possible and as such wasnt thinking along these lines when I was studying the latest source. Maybe with this in mind going back through it will make A LOT more sense :) But I should first make sure you are not refering to the next release before I spend my time trying to study something that doesnt exist in the current base :) >"extension binders" When you say extension binders I assume you are refering to, for example, java:// or the ext:// extensions which then binds to a particular set of class files or external resources, or etc.. It seems obvious that the smartest thing to do is to create a "cli" binder. But heres the biggest issue that must be considered with this. The latest build of IKVM does not support dynamic class loading in external libraries (at least not from a Java class loading perspective.) In other words, if its not a part of your compiled assembly or part of the main classpath dll theres no way (that I know of) to make this work. In fact, I have even had troubles with accessing results from the "cli" based class files (java classpath works fine) when using the ext:// namespace extension. I think that a lot of this has to do with not having a full comprehension of what is being bound to this namespace. Is there anything that you can point me to that might aid in my study of this? It seems with the proper understanding implementing a cli specific extension will aid in the final steps to combatting this one last missing feature and a such we can release and RC2 and then take things from there. NOTE: While its possible to gain dynamic class loading back by simply compiling the Saxon.NET class files via a standard java compiler, create a proper jar file to then load using the actual IKVM instead of the compiler I have tried this several times and have still run into some issues (beyond the longer load time each time you start up the VM and load the proper class file.) I've copied Jeroen Frijters, the developer of the IKVM project as obviously if there is a work around to this he will know. Jeroen, do you have any comments (or questions if I havent been clear to the exact problem) in this area? > that implement their own rules for binding to > external functions, either alongside or instead of the default mechanism. So > it should be possible to do this in a very clean way. If you could verify that in fact you are refering to 8.3 then I will continue to scour the code base to attempt a better understanding of the above. Any suggestions? -- <M:D/> :: M. David Peterson :: XML & XML Transformations, C#, .NET, and Functional Languages Specialist |
From: Michael K. <mi...@sa...> - 2005-04-01 13:30:48
|
> > I assume you are refering to the released 8.3 build in this regard? Yes: though actually, there is one piece missing from the jigsaw. You are supposed to be able to call setExtensionBinder() on the Configuration object, but in the issued code this has no effect. However, the fix is trivial and will appear in a few days. The thing you actually pass is a FunctionLibrary. Despite its name, this isn't necessarily a fixed repertoire of functions: rather, it's a class that provides a bind() method which is given the name and arity of a function call appearing in the stylesheet or query source, and returns an Expression object responsible for the run-time implementation of the function. Internally, Saxon maintains a list of FunctionLibrary's (one for system functions, one for constructor functions, one for Saxon extensions, one for Java extensions, etc) and offers a function call to each of them until it gets back a non-null response from the bind method (if no FunctionLibrary expresses an interest, you get a "function not found" error). So you're not constrained on the meaning you attach to the URI part of the function name. The standard Java extension mechanism offered by Saxon is the JavaExtensionLibrary. Calling setExtensionBinder will override this. But if you prefer, you can call setExtensionBinder supplying a FunctionLibraryList (which is also a FunctionLibrary...) that contains your own extension mechanism alongside the standard JavaExtensionLibrary, in either order. > But heres the biggest issue that must be considered with > this. The latest build of IKVM does not support dynamic class loading > in external libraries (at least not from a Java class loading > perspective.) In other words, if its not a part of your compiled > assembly or part of the main classpath dll theres no way (that I know > of) to make this work. You might consider using the mechanism that the JAXP XPath API uses, which doesn't rely on dynamic loading. Here the user simply nominates a FunctionResolver, which is called directly to evaluate the function call. It's not a very flexible mechanism, but you could use it as a stopgap or build something more flexible from it. Saxon includes an implementation of FunctionLibrary, the XPathFunctionLibrary, that supports this mechanism. In fact, I have even had troubles with > accessing results from the "cli" based class files (java classpath > works fine) when using the ext:// namespace extension. I think that a > lot of this has to do with not having a full comprehension of what is > being bound to this namespace. Is there anything that you can point > me to that might aid in my study of this? Sorry, I'm out of my depth here. Michael Kay http://www.saxonica.com/ |
From: M. D. P. <m.d...@gm...> - 2005-04-01 13:41:03
|
This is PERFECT!!!! Exactly what I needed :) Between Jeroens reassurance that statically compiled code will work and this vast amount of information you have provided I have no more excuses not to developing a working solution. Cheers to you both. And Jeroen, given that I have you here as part of this Saxon-Help thread, thank you again for everything you have done in bringing together the IKVM.NET project. You're work with this project is absolutely tremendous and I want to make sure that you know how much this project is appreciated, especially in allowing Saxon.NET to reach such a high level of performance in such a short period of time. In regard to you Jeroen, and to Dr. Kay the .NET community is deeply indebted to you both. Best regards, Mark On Apr 1, 2005 6:30 AM, Michael Kay <mi...@sa...> wrote: > > > > I assume you are refering to the released 8.3 build in this regard? > > Yes: though actually, there is one piece missing from the jigsaw. You are > supposed to be able to call setExtensionBinder() on the Configuration > object, but in the issued code this has no effect. However, the fix is > trivial and will appear in a few days. The thing you actually pass is a > FunctionLibrary. Despite its name, this isn't necessarily a fixed repertoire > of functions: rather, it's a class that provides a bind() method which is > given the name and arity of a function call appearing in the stylesheet or > query source, and returns an Expression object responsible for the run-time > implementation of the function. > > Internally, Saxon maintains a list of FunctionLibrary's (one for system > functions, one for constructor functions, one for Saxon extensions, one for > Java extensions, etc) and offers a function call to each of them until it > gets back a non-null response from the bind method (if no FunctionLibrary > expresses an interest, you get a "function not found" error). So you're not > constrained on the meaning you attach to the URI part of the function name. > > The standard Java extension mechanism offered by Saxon is the > JavaExtensionLibrary. Calling setExtensionBinder will override this. But if > you prefer, you can call setExtensionBinder supplying a FunctionLibraryList > (which is also a FunctionLibrary...) that contains your own extension > mechanism alongside the standard JavaExtensionLibrary, in either order. > > > But heres the biggest issue that must be considered with > > this. The latest build of IKVM does not support dynamic class loading > > in external libraries (at least not from a Java class loading > > perspective.) In other words, if its not a part of your compiled > > assembly or part of the main classpath dll theres no way (that I know > > of) to make this work. > > You might consider using the mechanism that the JAXP XPath API uses, which > doesn't rely on dynamic loading. Here the user simply nominates a > FunctionResolver, which is called directly to evaluate the function call. > It's not a very flexible mechanism, but you could use it as a stopgap or > build something more flexible from it. Saxon includes an implementation of > FunctionLibrary, the XPathFunctionLibrary, that supports this mechanism. > > > In fact, I have even had troubles with > > accessing results from the "cli" based class files (java classpath > > works fine) when using the ext:// namespace extension. I think that a > > lot of this has to do with not having a full comprehension of what is > > being bound to this namespace. Is there anything that you can point > > me to that might aid in my study of this? > > Sorry, I'm out of my depth here. > > Michael Kay > http://www.saxonica.com/ > > ------------------------------------------------------- > This SF.net email is sponsored by Demarc: > A global provider of Threat Management Solutions. > Download our HomeAdmin security software for free today! > http://www.demarc.com/info/Sentarus/hamr30 > _______________________________________________ > saxon-help mailing list > sax...@li... > https://lists.sourceforge.net/lists/listinfo/saxon-help > -- <M:D/> :: M. David Peterson :: XML & XML Transformations, C#, .NET, and Functional Languages Specialist |