James Williams
LinkedInMastodonGithub

Deckchair Groovy JSON store

Tags: Groovy

Deckchair is a Groovy lightweight JSON document store ported from JS(Lawnchair). In a lot of desktop applications, there is a need to store some sort of information. It's usually not a massive amount but enough that the current options aren't exactly suitable:

  • JNLP Persistence API
  • Java Preferences API

The JNLP Persistence and Java Preferences APIs don't really allow you to structure your data and JNLP Persistence doesn't exactly work in difference contexts.

Deckchair uses JSON documents to allow you to structure your data without regard for how it will be stored by the backing adaptor. Currently the only implemented adaptor is Derby but others will be coming. Deckchair is fairly easy to use and is API compatible with all the signatures of Lawnchair.

Sample Usage:

def d = new Deckchair(['name':'temp', 'adaptor':'derby'])
d.save([name:'James', age:28])
println d.all()[0]

You can download the source here.