Hello karaf users.

I have been working on what i believe to be a simplification of the
configuration handling in OSGi containers. The project is slated to be able
to handle different sources, but for now the the only configuration source
is the felix config admin.

https://github.com/TDC-Netdesign/ManagedProperties

The way it works is that you register an annotated interface, which is
turned into a proxy that keeps track of the configuration for you. The
proxy object is transparently updated whenever the configuration changes.
It is also possible to register mappers, which can parse values into other
types, for example a String to a File or an Long to an Instant.

Most importantly the filters allow for validating data. This allows for
checking the validity of the configuration before applying it. The
MangedProperties object will revert to the last accepted configuration if a
new configuration fails, eliminating the situation where the config admin
holds a config set that was never applied.

Two other features worth mentioning is the locking a callback functions.
The properties object can lock itself, allowing any update to the
configuration to be postponed. This is useful for combinations like
username-password, where you do not want the configuration to change in
between the calls. For example, you can lock the configuration before
calling config.getUsername() and config.getPassword().
The last function is a ConfigurationCallback, that can be registered on the
configuration object. When the configuration is updated the callback is
called afterwards, allowing for restarts of message queues, rest clients or
whatever is using the configuration but requires restarts with new
configurations.

I hope you will take a look at this project and use it/comment and
participate, I look forward to your comments and i hope someone will find
it useful.


-Martin

Reply via email to