custom config

I need to know - what is the best way to store and edit custom parameters for vaadin application ?

I need to store
1 database connection string
2 text of sql queries for different database types.
3 custom parameter list name1=value1, name2=value2

Probably this should be some xml file. What is the best location of this file ? Is there vaadin based editor for such files ?

Thanks in advance…

You can do it in any normal Java way - there is nothing Vaadin specific.
Java properties
or XML is fine. Depending of the content of the settings you have to places to put them. You can put them in the source tree of your project if you want to package it along with the rest of the project. The more usual way to do it is to leave the config file outside the project, so that the sys admin can change the settings to fit the server. Store the file outside the source tree (so that it isn’t deployed automatically) and then you can copy it into a folder of the server application, like Tomcat or JBoss. The server just provides the file to the classpath from where your application can read it. For example, if you use Tomcat, the correct place to put the files is /lib.

One possibility is [tt]
[/tt], which might be a good place for certain types of configuration files. It’s a private directory that can not be accessed directly through the web server (though the application can provide access to it).

It’s good if you want to distribute just a war and nothing else. It’s not good if you’re deploying as a War and have to edit the configuration files
deployment. Well, that doesn’t really matter if the files are edited before the application is accessed.

Just notice that the files could be overwritten if you redeploy your application.

In order to facilitate deployment, you might want to consider

  • all predefined configurations should be kept in WEB-INF/classes This includes internationalization, sizes, etc. This is trivial to do – just make sure your IDE or build script copies *.properties and *.xml files in addition to .class files. You can retrieve the configuration files by using the classloader getResource() calls.
  • the database connection string should generally be configured through the web server (so that it does not appear in any configuration file). The application can retrieve the database connection using the JNDI lookups. That way, you can deploy your War with complete flexibility
  • editable parameters should be in the database. This is the only way to make sure that things survive between deployments.