MicroBean Configuration API

This is the first of a series of posts on some of the personal projects I’ve been working on.  As I hope you’ll see, they all fit together.  The next post in the series covers MicroBean Configuration.

This post covers MicroBean Configuration API.  Its website is here, its source code is here and its binaries are available from Maven Central.

MicroBean Configuration API is a Java SE API that abstracts over collections of configuration values.  In this regard it is no different from many other Java configuration APIs.  Like many other configuration frameworks, configuration values are always Strings and can be converted.

Where perhaps it is different is: it expresses configurations—collections of configuration values—in terms of their location in configuration space as determined by configuration coordinates.  Other systems tend to use hierarchies of configuration values, but of course configuration space is not hierarchical so there are always problems with the hierarchical approach.

(Also, other systems use configuration coordinates whether they are fully cognizant of what they’re doing or not—one only has to look at the separation of “user” from “system” values in systems like the Java Preferences API.)

Configuration space as an abstract concept is the universe of all configurations.  Some configurations are suitable for certain application deployments and many are not.  Usually there’s one that is suitable for nearly all application deployments of a particular kind, but that one is generally very “defaultish” (one step away from hard-coded values).  For a given application deployment, you want, of course, the maximally specific configuration to apply to it.  To pick this configuration out from all others, you supply configuration coordinates that locate your application deployment in configuration space, and then MicroBean Configuration API finds the most specific or suitable configuration that exists for it.

Sometimes an application is aware of its own configuration coordinates, or the configuration coordinates that it wants to use when seeking a configuration value.  Other times—the vast majority of times—it is not (they are specified “outside” of it, as in the case of other Java configuration frameworks where you “pass in” notions of a “project stage” or other means of locating configuration values suitable for the deployment).  MicroBean Configuration API offers two fundamental flavors of the getValue() method (with convenience overrides) for these two cases: one for getting a configuration value when the configuration coordinates are known, and one for when they are supplied implicitly.

To make MicroBean Configuration API work, you’ll need a concrete implementation of it. Currently there is one implementation—MicroBean Configuration—which is two things: one, a concrete implementation of MicroBean Configuration API, of course, and two, a multiplexing variant of it (i.e. it can front many other configuration systems).  We’ll cover MicroBean Configuration in the next post.

Advertisements

2 thoughts on “MicroBean Configuration API

  1. Pingback: MicroBean Configuration | Blame Laird

  2. Pingback: MicroBean Configuration CDI | Blame Laird

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s