Date: 2004-04-26T17:08:41 Editor: HarishKrishnaswamy <[EMAIL PROTECTED]> Wiki: Jakarta HiveMind Wiki Page: NotXMLProposal URL: http://wiki.apache.org/jakarta-hivemind/NotXMLProposal
no comment Change Log: ------------------------------------------------------------------------------ @@ -80,3 +80,57 @@ In the meantime, I've updated the example above to reflect a slightly more verbose but significantly more consistent approach (based on additional thoughts I had composing [http://howardlewisship.com/blog/2004_04_01_archive.html#108300769165342372 this blog entry]). Keeping the design isomorphic to a subset of XML had advantages ... I can just make my parser spew out SAX events, maybe even feed it into a SDL (Simple Data Language) to XML to HTML pipeline. +HarishKrishnaswamy: I am completely against the idea of a proprietary language. I think it will certainly hinder adoption. I would like to see a Java scripting language being used for this purpose. I agree Groovy is certainly not stable but Beanshell is. I have already wipped up some configuration for work using Beanshell with line precise error reporting. And all that is needed is a simple helper class and a very small Beanshell script to execute the configuration one node at a time. The script will look something like this: + +{{{ +evalModule(url, helper, interpreter, callstack) +{ + setAccessibility(true); + + reader = null; + + try + { + reader = new InputStreamReader(url.openStream()); + parser = new Parser(reader); + parser.setRetainComments(true); + + while (!parser.Line()/* eof */) + { + node = parser.popNode(); + + node.setSourceFile(url.toString()); + + // Cache the line number for error reporting purposes + helper.setCurrentLineNumber(node.getLineNumber()); + + node.eval(callstack, interpreter); + } + } + finally + { + if (reader != null) + reader.close(); + } +} +}}} + +And the configuration could look like this: +{{{ +servicePoint("service-id", ServiceInterface.class); + +// Singleton service constructed via constructor injection +singleton(implementation("service-id", ServiceImplementation.class, new Object[]{1.34, "some string", service("some-service-id")})); + +// Pooled service constructed via setter injection +dependencies = new HashMap(); +dependencies.put("property1", property1Value); +dependencies.put("anotherService", service("anotherServiceId")); +pooled(implementation("service-id", ServiceImplementation.class, dependencies)); +}}} + +Likewise for configuration. + +servicePoint, service, implementation, singleton, pooled ... are all methods in our helper class that will do the needful. + +Although I haven't yet tried out to build a doc from the config file, I am pretty sure its very simple. Beanshell already has a Bshdoc.bsh script that generates javadoc like doc. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
