package org.josast.CubesatSim.influxDB;

import java.util.logging.Logger;

import org.josast.property.ConfigObject;

public class InfluxDatabaseConfig extends ConfigObject {

    private Logger log = Logger.getLogger(getClass().getName());

    private String adresse = "replace by your URL";
    private String login = "replace by your login";
    private String password = "replace by your Password";

    /**
     * @param configFilename
     */
    public InfluxDatabaseConfig(final String configFilename) {
        super(configFilename);

        String temp = ConfigFile.GetProperty("adresse");
        if (temp == null) {
            // config file not initialised
            ConfigFile.SetProperty("adresse", adresse);
            ConfigFile.SetProperty("login", login);
            ConfigFile.SetProperty("password", password);
            log.severe(
                    "propoerties file not initialised - a file is created with properties with comments");
            System.out.println(
                    "config file does not content required properties \n the file "
                            + configFilename
                            + " has been set up with properties to configure");
            System.exit(-1);
        } else {
            adresse = temp;
            login = ConfigFile.GetProperty("login");
            password = ConfigFile.GetProperty("password");
        }
    }

    /**
     * @return adresse
     */
    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    /**
     * @return login
     */
    public String getLogin() {
        return login;
    }

    /**
     * @param login
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     * @return password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param password
     */
    public void setPassword(String password) {
        this.password = password;
    };

}
