tags:

views:

159

answers:

4

I'm building a restaurant system, and I want to give adminstrator a privilege to change and save the settings so that when other users log in, will find new settings.

+2  A: 

You can use the java properties api to save any settings as Key-Value pairs.

A tutorial is here http://java.sun.com/docs/books/tutorial/essential/environment/properties.html

This can save your properties as .properties files as well as XML files

Midhat
+1  A: 

You can create a directory to the disk and store files which are looking like

user=Ben
font=arial
...

These file you can read with a java.util.Properties object.

Properties p;
p.load(inStream);

The properties you can add to the system properties and use it in every location of your code by calling

System.setProperty(font, arial);

System.getProperty(font);
Markus Lausberg
+4  A: 

Java has a dedicated preferences API, which is more powerful than using Properties files - that should be exactly what you want. It offers "System" preferences and "User" preferences - presumably the admin would be allowed to change "System" preferences.

Michael Borgwardt
A: 

There are many ways to do it : - Serialization - Preferences API - Using text files (XML, properties file, ini like files, etc.) - Databases