Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Application wide configuration
Application wide configuration [message #936971] Mon, 08 October 2012 14:31 Go to next message
Seth Helstrip is currently offline Seth HelstripFriend
Messages: 22
Registered: September 2012
Junior Member
Bit of a OSGi application design type question here.

I was thinking about creating a configuration module, for use by our application. The idea being that this configuration module, contains, all the name/value pairs, used by the application. Things like, db connection details, server name, webservice end-points, etc. I was thinking that we could build a different module for each environment, Integration, UAT, SIT, Prod, etc. And that way, switch the applications deployment environment, simply by changing the deployed configuration module.

Had a hunt through the docs, but nothing really focusing on architecture there. Realatively new to this OSGi game - so was wondering whether maybe blueprint provides something like this, out-of-the-box, or whether this is generally regarded as a good or bad approach to the problem. I can see arguments for both.

What's your opinion?
Re: Application wide configuration [message #937809 is a reply to message #936971] Tue, 09 October 2012 09:28 Go to previous messageGo to next message
Tin N/A is currently offline Tin N/AFriend
Messages: 46
Registered: December 2010
Member
You mean something like this:

http://eclipse.org/virgo/documentation/virgo-documentation-3.5.0.RELEASE/docs/virgo-programmer-guide/html/ch04s04.html

Although it is a neat idea, where I work we found it's more flexible to just use Apache commons configuration with a simple utility class that provides the configuration object relative to a directory in the system property.
So, we start virgo JVM with, e.g. "-Dconfig.home=/etc/virgo/production" and then have this simple class with static methods that can return a org.apache.commons.configuration.Configuration object like this:

ConfigurationProvider.getConfiguration ( "appName/app.properties" );

which would return the config object initialized from "/etc/virgo/production/appName/app.properties" file and hence completely decoupled from the application and app server itself.

This is more in line with traditional JEE concepts wherein the application server environment is prepared by app server admins and not developers, and our work organization mirrors it (in theory, developers should not have access to, or anything to do with, deploying and configuring production systems and apps).
Re: Application wide configuration [message #937857 is a reply to message #937809] Tue, 09 October 2012 10:27 Go to previous messageGo to next message
Seth Helstrip is currently offline Seth HelstripFriend
Messages: 22
Registered: September 2012
Junior Member
Thanks for the thorough response - don't know how I missed that in the docs - sorry.

Looks like two ways of producing a very similar effect, will now try and weigh up the benefits of each.
Re: Application wide configuration [message #939112 is a reply to message #937857] Wed, 10 October 2012 12:41 Go to previous messageGo to next message
Seth Helstrip is currently offline Seth HelstripFriend
Messages: 22
Registered: September 2012
Junior Member
Using the commons configuration approach - presumably you'd need to do this load from the filesystem, in every bundle - because of the non-shared classpath?
Re: Application wide configuration [message #939435 is a reply to message #939112] Wed, 10 October 2012 19:00 Go to previous message
Tin N/A is currently offline Tin N/AFriend
Messages: 46
Registered: December 2010
Member
If I understood correctly, then the answer would be - "ConfigurationManager" class is loaded by its own bundle's classloader. It is imported (via MANIFEST) and used in any other bundles that need it, but it is loaded only once. So when you call the static method ConfigurationManager.getConfiguration you're always hitting the same class, and whatever static members that class keeps are also initialized once. Sorry if I totally misunderstood the question - if you write an example of what you meant I'll probably get it Very Happy
Previous Topic:Timing on deploying a Plan
Next Topic:Virgo 3.6.0.M02 Released
Goto Forum:
  


Current Time: Fri Apr 26 17:27:33 GMT 2024

Powered by FUDForum. Page generated in 0.04329 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top