package com.ftinc.si.assist.test.gui;

import java.util.ArrayList;
import java.util.HashMap;

public class EnvironmentData {
	public String vendor = "postgresql";
	public String serverName = "localhost";
	public String port = "5432";
	public String dbName = "db_TestCase";
	public String encode = "UTF-8";
	public String fakedir = null;		//fakeクラス出力先
	public String uID = "postgres";
	public String pwd = "postgres";
	public ArrayList<String> rootDirs = new ArrayList<String>();
	public ArrayList<String> plugins = new ArrayList<String>();
	public HashMap<String, HashMap<String, String>> plugins_properties;
	boolean hiddenMode = false;//不活性なコマンドを隠す
	public String logdir;
	public String prevPath;
	public int caseSize;
	public boolean process_mode;
	public boolean remote_db;
	public String groupCode = "";
	public HashMap<String, String> aliasNames;
	public String version = "";
	public Boolean debug_mode = false;
	
	public String jdbcString() {
		String t_str = "jdbc:";
		t_str += vendor;
		t_str += "://" + serverName;
		t_str += ":" + port;
		t_str += "/" + dbName;
		
		return t_str;
	}
	
	//DBを再接続すべきかどうか
	public boolean shouldReconnectDB(EnvironmentData env) {
		if (uID.equals(env.uID) && remote_db == env.remote_db) {
			if (jdbcString().equals(env.jdbcString())) {
				return false;
			}
		}
		return true;//何かが違う。
	}
}
