Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[config-dev] Configuration Object Examples

Dmitry called (rightly IMHO) for more activity on the mailing list, so here is more activity on the mailing list.  There's no action item in this email.

If you survey the landscape of how Java application (and middleware) developers "do" configuration in their projects, you will discover that in most cases there is a "configuration object" (or several) that says what configuration information the application (or a subsystem) requires to tailor itself to run in a particular environment.

The shape of that configuration object is defined by the application developer or team.

While sometimes "settable" for ostensible Java Beans compliance or other (mostly irrelevant) reasons, generally a configuration object "gets" information that an application developer uses to tailor her application.

There are many different configuration object shapes:
  • Some configuration objects are POJOs with "getter" methods thus enforcing strict names and types (public int getFrobnicationIntervalInSeconds())
  • Some are flat map-like objects (with typed or untyped accessor methods (e.g. getProperty("frobnicationInterval", int.class))
  • Some are nested (e.g. someRootishConfigObject.getSubConfig().getFrobnicatorConfig().getFrobnicationInterval())
  • Some report changes in the underlying information by firing events or notifying listeners; some do not
  • Some are hybrids of all of these patterns, where some information is accessed via getters, other information is accessed via map probes, and other information is accessed by digging down a couple of levels
Other than being generally configuration-oriented in some hazy way, and being designed by the project developer or team, these objects pretty much share nothing else in common.

Here are some arbitrary examples of the kind of thing I'm talking about that are arbitrary that I arbitrarily selected from an arbitrary list that I came up with arbitrarily by flailing around on Google for various Java-related projects in an arbitrary manner (I hope you understand these are arbitrary):
For this discussion I have no opinions about or connections with any of the arbitrary projects listed above; I'm just pointing out patterns in the world.

This pattern exists in Jakarta EE itself, of course, too.  Here are some (again, arbitrarily!) selected examples:
There are others of course.

The JDK itself has a few, too.  Here are some more arbitrary selections:
I'll have more to say (hopefully) about this kind of thing once I can be articulate about it.  For now, I guess, just sit with the patterns above that are used by Java application developers.  I think they're interesting.

Best,
Laird

Back to the top