On Sep 23, 2009, at 7:28 PM, maven apache wrote:

Hi:
I found the Commons Configuration  can do most of read configuraion
job for me ,so I want to have a try.
But I am not sure the Commons Configuration how to read the file(for
example a xml file), is it a Singleton?  Since if not, I think I
should build a Singleton class to save the properties read by the
Commons Configuration, if so , I can use the Commons Configuration
directly.
Thanks.


Have you looked at http://commons.apache.org/configuration/userguide/howto_xml.html#Accessing_properties_defined_in_XML_documents? If the user's guide doesn't provide all the information you are looking for you might want to describe your use case so others can give you advice on how to do it.

In answer to your specific question, no it is not a singleton. But if your application keeps a reference to the configuration object you can retrieve the properties as often as needed. If your application needs to allow the configuration to be updated without restarting the application you should not transfer the data to other objects. Instead, use a reloading strategy and get the properties from the configuration every time they are needed.

Ralph

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to