/*
 * Created on May 18, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.nasa.jsc.plum.PlumUtil;

import java.util.prefs.Preferences;

/**
 * @author randrews
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class DatabaseConfiguration {
    private Preferences prefs;
    public static final String HOST="host";
    public static final String USER="user";
    public static final String DB="db";
    public static final String PASS="pass";
    public static final String DEBUG="debug";
    
    public DatabaseConfiguration(Class prefsclass){
        prefs=Preferences.userNodeForPackage(prefsclass);
    }
    
    /**
     * @return Returns the avgRuntime.
     */
    public String getHost() {
        return prefs.get(HOST,"127.0.0.1");
    }
    /**
     * @param avgRuntime The avgRuntime to set.
     */
    public void setHost(String host) {
        prefs.put(HOST,host);
    }

    /**
     * @return Returns the avgRuntime.
     */
    public String getDB() {
        return prefs.get(DB,"plum_data");
    }
    /**
     * @param avgRuntime The avgRuntime to set.
     */
    public void setDB(String db) {
        prefs.put(DB,db);
    }

    /**
     * @return Returns the avgRuntime.
     */
    public String getUser() {
        return prefs.get(USER,"root");
    }
    /**
     * @param avgRuntime The avgRuntime to set.
     */
    public void setUser(String user) {
        prefs.put(USER,user);
    }

    /**
     * @return Returns the avgRuntime.
     */
    public String getPass() {
        return prefs.get(PASS,"blah");
    }
    /**
     * @param avgRuntime The avgRuntime to set.
     */
    public void setPass(String pass) {
        prefs.put(PASS,pass);
    }

    /**
     * @return Returns the avgRuntime.
     */
    public boolean getDebug() {
        return prefs.get(DEBUG,"true").equals("true");
    }
    /**
     * @param avgRuntime The avgRuntime to set.
     */
    public void setDebug(boolean debug) {
        prefs.put(DEBUG,(debug?"true":"false"));
    }
}
