Saturday, September 5, 2015

First java "Conf2 Java App"

I've been working on my management library called "Conf2" and while the library is written in Go, I've been working on the seamless integration with Java. As an example app, I created the beginnings of a minecraft mini-game. The game still needs work, but the API is taking enough shape that I thought I could share the initial code : https://github.com/dhubler/mcstone 

The 3 important classes to look at are StoneGame, StoneGameBrowser and Main and one important file mcstone-lite.yang

  • StoneGame is void of any references to the Conf2 library. This represents any pre-existing written application that needs to be configured (read-write fields), inspected (read-only fields), watched (events) or have operations exported (rpcs) 
  • StoneGameBrowser connects the application to the Conf2 library. It navigates the StoneGame app and all it's pieces according to a predefined schema. If you see weird java syntax, it's 1.8's lambda expressions. 
  • Main unites StoneGame and StoneGameBrowser, creates a RESTful service, registers the StoneGameBrowser, then starts the rest service.  
  • mcstone-lite.yang is the application schema that StoneGameBrowser supports. For java, "container" means object instance, "list" means collection, "leaf" means java assessor.
The Conf2 engine is https://github.com/dhubler/yang-c2 but I'm going to eventually move it to https://github.com/dhubler/conf2