NetKernel/News/3/8/December_16th_2011
search:

NetKernel News Volume 3 Issue 8

December 16th 2011

What's new this week?

Catch up on last week's news here

Repository Updates

The following NetKernel 5.1.1 updates are available in the NKSE and NKEE repositories...

  • http-server 2.12.1
    • Added <maxContentLength> to limit size of entity bearing methods (see below)
  • lang-antlr 1.2.1
    • NEW a grammar/parser language runtime based on Antlr (see below)

Tom's Book - Exciting Announcement: Practical Resource Oriented Computing with NetKernel

It gives me great pleasure to be able to make the first public announcement of very exciting developments with Tom Geudens' book.

You will know that Tom has been diligently crafting his practical guide to using ROC and NetKernel. This project actually began at least five years ago when he wrote an internal guide to NetKernel 3 for his employer, the large Belgian supermarket chain, Colruyt.

Since the advent of the general ROC abstraction circa NetKernel 4 (and now through NK5), he scaled up his ambition and, rather than just port his guide, he set about developing an "open-source" and extensive book. Being a practical and pragmatic fellow, he has kept a hands-on and practical perspective.

I have deliberately maintained a good distance from the process - and have had no involvement at all, other than to offer encouragement. It felt like this book would serve its readership best if it maintained the genuine independent perspective of a real NetKernel user. But many of you have been following the progress and have made excellent contributions with feedback and ideas.

Late in the summer, Joe Devon joined in the community review process and provided some invaluable ideas from the perspective of a new user. But he didn't leave it there. Joe is well connected. Joe joined the dots and said to Tom - "Why don't you publish this as a book - I have some connections, I'll introduce you"...

So enough back-story, without further ado, the announcement:

In February 2012 O'Reilly will publish "Practical Resource Oriented Computing with NetKernel" by Tom Geudens.

The contract is signed, the printers are warming up. But to reflect the open community-based process, Tom has also negotiated the rights so that the "open-source" edition will remain free for digital download.

The ink on the deal is still drying so the book doesn't yet appear in the catalogue for pre-purchase, but Tom now has an O'Reilly author page.

Christmas Reading

Its only a very short time between now and February, but it would be a great community contribution if, over the Christmas holiday, you can tear yourself away from quality time with your mother in law, get hold of the latest "build", read it, offer feedback, suggestions and tips...

http://www.netkernelbook.org/serving/pdf/practical_netkernel_nk5.pdf

Tom can be reached at: practical(dot)netkernel(at)gmail(dot)com

Tom's Blog

With the book deal in his pocket, you will now also understand why Tom has committed to a regular "Practical NetKernel" blog posting. This week he explains why he thinks nCoDE is not a toy.

Tip: How to Limit HTTP File / Form POST Upload Size

Chris Cormack was in touch earlier this week with a requirement to limit the size of file uploads to one of DeltaXML live demos.

If you need to do the same, there are several alternatives. However the general guidelines offered by Jetty cover how to limit POSTed form content size. Not multi-part file transfers.

For file uploads we decided that the best approach is to source httpRequest:/header/Content-Length and if this is too large reject the request and issue a 413 response code. The details, and alternatives, are discussed in this thread...

http://www.1060.org/nk4um/topic/862/index

I realised this would be a very simple feature to add to the RESTOverlay and so with today's update it now supports <maxContentLength> tags on either the overlay config (global) or per-endpoint in the REST metadata tags. So now you can easily throw-up a Content-Length firewall over your REST services.

Announce: NetKernel Plug-in for Gradle

These are exciting times - there's real momentum gathering - I can also announce today that Brian Sletten has developed a NetKernel plug-in for Gradle.

Gradle is a Groovy based build tool (think Ant capabilities but with Groovy syntax and power). Brian's plug-in is a work-in-progress and it is available now from Brian's github account here...

https://github.com/bsletten/nk-gradle-plugin

What can it/will it do?

  • Build modules and automatically discover and link to the core NK foundation libraries (working)
  • Build and version packages of modules for deployment (working)
  • Build and generate apposite repositories of packages (coming soon)
  • Automatically download and install NK (coming soon)
  • Integrates closely with source control (git now, svn later)

Brian has opened this as a community project and welcomes community feedback and participation.

NetKernel gets ANTLRs

Not to be outdone, we've been busy too. There is a new language runtime in the repositories - or rather that should be a "meta-language" runtime. The package lang-antlr provides the active:antlr runtime.

If you're not familiar with Antlr, its a class of tool which compiles powerful EBNF grammars. The grammars are extremely powerful and expressive. They can describe simple patterns (like CSV parsing) through to domain specific languages and right up to full featured languages, even natural language extraction.

A short introduction to Antlr grammars is available on the antlr.org website.

Taming the Beast

Grammar compilation, and Antlr in particular, is very powerful. Unfortunately that means traditionally it has been non-trivial - since, the standard model of all the grammar tools we've explored is to have them generate source code from the grammar to create an executable parser/generator.

So you'll see on the antlr site, that all of the discussion is about using antlr to generate source code - for later consumption in a "real application". This indirection is a little like working with second-order differential equations - it takes some practice to switch your perspective.

Tony thought there might be a better way. He wanted the power of grammars but the flexibility and instant dynamic execution of the ROC language runtime pattern. By hook or by crook he found a way to dynamically compile antlr grammars, compile the generated source, transrept and cache the resulting "parse engine" and have it execute seamlessly as an ROC runtime.

When you start to play with active:antlr and see how incredibly simple it is to use then you'll appreciate what an achievement this is. All the power, none of the complexity.

The active:antlr runtime produces an abstract syntax tree of its operand argument evaluated against the operator antlr grammar definition. With the Unix philosophy this parse tree is a resource that can be built into other composite tools. There's no limit and no static code - its a fully compiled, transrepted, cached and dynamically adaptive solution.

Examples

We've provided a set of unit tests in a module jar file here...

http://temp.1060research.com/2011/12/urn.test.org.netkernel.lang.antlr-1.1.1.jar

...these illustrate usage and examples of several grammars.

We've also created a library of Antlr-based parser tools - for the moment this is just a simple module (called antlr.aux) and is not shipped in the repo (we may migrate these tools into their domain specific library modules as a more natural organisational layout as we move forward).

The module implements active:parseCSS-2.1 and active:parseCSV which take an operand (the resource to be parsed) and produce a clean parse HDS tree - no config. It can be downloaded here...

http://temp.1060research.com/2011/12/urn.org.netkernel.lang.antlr.aux-1.1.1.jar

To install these modules just add an entry to your modules.xml

These tools should admirably illustrate a small sample of the potential of the antlr runtime, as well as being handy little tools in their own right.

Onwards to the Future

So now let your imagination really go wild. Its now possible to easily create DSL runtimes - all with true ROC resource-like characteristics. We can augment existing languages with pre-processing transreption - for example, imagine adding ROC extensions to groovy without meta-programming. And of course, it also heralds the possibility of fewer XML configuration resources and more human configuration syntaxes.

Give it a go and let us know what you think.

JDK Mandatory

One important thing to note: Because Antlr generates classes and these need to be compiled at runtime to bytecode - the antlr runtime can only work when NetKernel is running on a full JDK with javac etc.


Have a great weekend,

Comments

Please feel free to comment on the NetKernel Forum

Follow on Twitter:

@pjr1060 for day-to-day NK/ROC updates
@netkernel for announcements
@tab1060 for the hard-core stuff

To subscribe for news and alerts

Join the NetKernel Portal to get news, announcements and extra features.

NetKernel will ROC your world

Download now
NetKernel, ROC, Resource Oriented Computing are registered trademarks of 1060 Research


WiNK
© 2008-2011, 1060 Research Limited