NetKernel News Volume 7 Issue 1 - JSON Schema, London Talk

NetKernel News Volume 7 Issue 2

February 26th 2016

Catch up on last week's news here, or see full volume index.

Repository Updates

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

  • database-relational-1.20.1
    • NEW: active:sqlPSBatch support for batched stored procedure invocation. Thanks to Stefan Hermanek for suggesting this.
  • http-server-3.7.1
    • Updated to Jetty 9.2.12
    • HTTP Bridge enhanced to support unlimited size file uploads - file uploads are now seamlessly buffered to disk once they exceed 1MB.
  • json-schema-1.1.1 Requires Java 8
    • NEW JSON schema runtime (see below)
  • layer1-1.51.1
    • active:java runtime now clears internal class cache when any module reload occurs. Thanks to Stefan again for suggesting this.
  • module-standard-1.67.1
    • Added Java runtime version constraint checking (see below)
  • wiki-core-1.17.1
    • Slinki enhanced with dynamic aspect ratio toggling to maximize display use - toggles 5:4, 4:3, 16:9 and 16:10 by pressing "w" key.

JVM Constraint

We're in that twilight zone where library developers are increasingly tempted by the bells and whistles offered by Java 8 but operationally its good to stick with what you know and stay on Java 7.

Our general strategy for the NetKernel core and modules is to target the mature Java generation - currently all our libraries target Java 7. However we're constantly adding to the modules available for NetKernel in the repositories and want to provide useful new tools as they become available - even if they are using libraries designed for the latest Java generation.

To square this circle, we've updated the Standard Module to enable Java runtime version constraint checking for modules.

You can now provide a tag in the declaration for a module...


When the module is commissioned a check is made to ensure that the current executing JVM is at least this version (or higher). If it is not, then the module will not be commissioned and a warning is issued...

18:25:43 StandardModu~ !file:/home/dexter/latest/ :
Java version must be 1.8 or higher !

The system health check will also show a warning that you are trying to commission a module that requires a newer version of JVM runtime.

The first repository module to use this constraint checking is today's new json-schema module (see below) which requires Java 8.

New: JSON Schema Validator

As part of ongoing enhancements to the JSON tool set, today we've published a new json-schema module in the repos.

This provides the active:jsonSchema validator to validate JSON against JSON Schema.

After install the docs are here.


Here's an example of what it does...

Given a JSON resource r1.json, representing a rectangle data structure...

    "rectangle" : {
        "a" : -5,
        "b" : 10

Then we can write a JSON schema rectangle-schema.json for the rectangle structure with a constraint that size must not be negative (as shown by, "minimum" : 0)...

    "type" : "object",
    "properties" : {
        "rectangle" : {"$ref" : "#/definitions/Rectangle" }
    "definitions" : {
        "size" : {
            "type" : "number",
            "minimum" : 0
        "Rectangle" : {
            "type" : "object",
            "properties" : {
                "a" : {"$ref" : "#/definitions/size"},
                "b" : {"$ref" : "#/definitions/size"}
    "required": ["rectangle"]

We can validate r1.json against the schema with this resource request...


Since r1.json has "a" as a negative number the JSON fails to validate and an execption is thrown..

#/rectangle/a: -5.0 is not higher or equal to 0

Validation as Resource

By default the validator will throw an exception if the JSON does not validate. However often it is a better model to consider the validation as a resource (whether or not the JSON is valid).

To support rich validation resources, an optional hds argument may be provided. For example...


The validation will now return a full validation representation as an HDS structure like this...

<validation xmlns:hds="">
    <error>#/rectangle/a: -5.0 is not higher or equal to 0</error>
  <valid hds:type="BOOLEAN">false</valid>

The advantage of this mode is that if the JSON fails to validate for multiple reasons, then all of the errors are returned, with a JSON Path reference, as nodes in the HDS and appropriate steps can be taken to deal with each one.

If you only care about boolean validity then you can simply use IHDSNode getFirstValue("/validation/valid") to test validity.

ROC URI Resolver

JSON schema supports URI references. The transreptor that does the schema compilation provides the contextual ROC domain as the resolution scope for schema references.

Therefore you may seamlessly reference schemas as resources resolvable in the ROC domain.

So for example, you could have active: URI references to dynamically generated schema or, with a suitable import of the http:client, remote schemas over HTTP etc.


The underlying Schema transreptor produces a cacheable compiled Schema representation that is threadsafe. Therefore active:jsonSchema is very high performance and can concurrently validate very large numbers of JSON documents against the same schema.

JSON Schema XUnit Assert

urn:org:netkernel:json:schema also provides an XUnit assertion library, which can be imported to an XUnit testlist with...


This provides the following assertion...


which validates the test result against the specified JSON schema.

Java 8 Requirement

Due to the underlying schema engine using Java 8 features, this library is constrained to Java 8 or higher (see above).

Talk: Resource Oriented Microservices - London Microservices Meetup

I'm giving a public talk on Wednesday evening to the London Microservices Meetup group. Attendance is open and you're very welcome to come along.

Details here: Resource Oriented Microservices, Wednesday 2nd March 2016, 6:30pm

Microservices allow us to adopt composite architectures in which the value of the composite is greater than the sum of the parts. Compositional solutions have a long tradition and are a core element of the Unix philosophy.

Through REST we understand that the Web is a Resource Oriented Architecture. So perhaps we should think of microservices in terms of "microresources"?

In this talk we will introduce Resource Oriented Computing, a general abstraction for software in which "everything is a resource". ROC solutions are built by composing resources from service endpoints located in "microweb" spaces.

Evolvable highly scaled, ultra-high performance solutions are created by the scale-invariant composition of "microwebs". Resources all the way down, or if you prefer, micro-, nano-, femto-services all the way down...

There are 200 people signed up already so it should be a great evening.

Have a great weekend, hopefully I'll see some of you in London..


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

© 2008-2011, 1060 Research Limited