Re: [Kernow] Namespace bindings feature added to XQuery Sandbox
Brought to you by:
ajwelch
From: Andrew W. <and...@gm...> - 2007-06-27 09:03:55
|
> I added a simple functionality, almost to discover Kernow > internals and play a little bit with it. I added a button > "namespaces" on the XQuery Sandbox panel. It launches a > dialogue box (designed after the ParamsDiag class) that > allow to add namespace bindings (pairs of String, prefixes > and URIs). Bindings are saved to and loaded from the config > file. > > That permits you to add permanently bindings for prefixes > 'xsl', 'fo', 'h', and the like. I think that it could be > worth having it in a XQuery Sandbox. The XQuery Sandbox was added just as a way to play with XQuery. Good idea though (and a good choice of a discrete package of work). > After this first look, I have a couple of remarks. Mainly > about the configuration. I saw Params.java uses static > members. And I think Config.java is too monolithic and > rather big and could be break down within a few classes. The Config class maintains the state for Kernow, and as such its pretty big. In this case though its not needed. If you want to store the namespaces in the Properties file, just write Save and Load methods in NamespaceBindings (called from TabbedView on load and close) that uses the static PropertyManager. > For example for the namespace bindings, I add a new class > NamespaceBindings whose the only responsablity is to act as > a container for bindings. You can then store it in the > configuration, and pass it to the dialog box. The dialog > box then never use the config singleton, so it is easier to > reuse it later. Yes, I think it should work in exactly the same way as ParamsDiag and Params. > Unfortunately, NetBeans changed a lot of files, mainly > project and build related. It changed also generated code > in TabbedView.java and TabbedView.form. So I'm not sure > they are suitable to commit. You can instead find a patch > and the new files there: > > http://www.fgeorges.org/tmp/kernow.diff > http://www.fgeorges.org/tmp/kernow-simple.diff > http://www.fgeorges.org/tmp/NamespaceBindings.java > http://www.fgeorges.org/tmp/NamespacesDiag.form > http://www.fgeorges.org/tmp/NamespacesDiag.java [snip] > Is that in accord with the way you are developing Kernow? Yes, I think that's a good start. Some things that needs fixing first though: - The buttons on the NamespacesDiag still say "Add Param" and "Delete Param" - The variable names in NamespacesDiag are still the same as in ParamsDiag (eg paramsTable) they should really be renamed - NamespaceBindings should be static, as should the "myBindings" Map (just like Params) - There aren't any comments, or JUnit tests. Ideally the code you submit should be reasonably documented and at least have a few JUnit tests (I know my code isn't exactly well documented or tested, but these things become really important when there's more than 1 developer). I couldn't comment on the changes to TabbedView, or on StandaloneXQuery if you've made any changes there. cheers andrew -- http://andrewjwelch.com |