<commit_before>/*
 *  Copyright 2015 LG CNS.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License. 
 */

package scouter.agent;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import scouter.Version;
import scouter.agent.netio.data.DataProxy;
import scouter.lang.conf.ConfObserver;
import scouter.lang.conf.ConfigValueUtil;
import scouter.lang.counters.CounterConstants;
import scouter.lang.value.ListValue;
import scouter.lang.value.MapValue;
import scouter.net.NetConstants;
import scouter.util.DateUtil;
import scouter.util.FileUtil;
import scouter.util.HashUtil;
import scouter.util.IntSet;
import scouter.util.StringEnumer;
import scouter.util.StringKeyLinkedMap;
import scouter.util.StringSet;
import scouter.util.StringUtil;
import scouter.util.SysJMX;
import scouter.util.SystemUtil;
import scouter.util.ThreadUtil;

public class Configure extends Thread {

	public static boolean JDBC_REDEFINED = false;
	private static Configure instance = null;

	public final static synchronized Configure getInstance() {
		if (instance == null) {
			instance = new Configure();
			instance.setDaemon(true);
			instance.setName(ThreadUtil.getName(instance));
			instance.start();
		}
		return instance;
	}

	public boolean debug_config = false;

	public String local_addr = null;
	public int local_port;
	
	public String server_addr = "127.0.0.1";
	public int server_udp_port = NetConstants.DATAUDP_SERVER_PORT;
	public int server_tcp_port = NetConstants.DATATCP_SERVER_PORT;
	public int server_tcp_session_count = 2;
	public int server_tcp_so_timeout = 60000;
	public int server_tcp_connection_timeout = 3000;

	public String scouter_type = "";
	public String scouter_name = "";
	public String scouter_host_type = "";
	public String scouter_hostname = "";
	public int objHash;
	public String objName;

	public int objHostHash;
	public String objHostName;
	public boolean enable_host_agent = false;

	public boolean enable_scouter_name_pid = false;
	public boolean enable_plus_objtype = false;

	public boolean enable_asm_jdbc = true;
	public boolean enable_asm_httpsession = true;
	public boolean enable_asm_socket = true;

	public boolean http_debug_querystring;
	public boolean http_debug_header;
	public String http_debug_header_url = "/";
	public boolean http_debug_parameter;
	public String http_debug_parameter_url = "/";

	/*
	 * user: 
	 *  0 - remoteIp 
	 *  1 - JSESSIONID + remoteIp 
	 *  2 - SCOUTER(set-cookie)
	 */
	public int mode_userid = 2;

	public boolean enable_profile_summary = false;
	public boolean profile_thread_cputime = false;
	public boolean profile_socket_openstack = false;
	public boolean debug_socket_openstack = false;
	public int profile_socket_openstack_port = 0;
	public int debug_socket_openstack_port = 0;

	public int xlog_time_limit = 0;

	public String http_error_status = "";
	private IntSet http_error_status_set = new IntSet();

	public String service_header_key;
	public String service_get_key;
	public String service_post_key;

	public File dump_dir = new File(".");
	public File subagent_dir = new File("./_scouter_");

	public boolean enable_auto_dump = false;
	public int auto_dump_trigger = 10000;
	public long auto_dump_interval = 30000;
	public int auto_dump_level = 1;
	
	public int debug_long_tx_autostack = 0;

	public String http_static_contents = "js, htm, html, gif, png, jpg, css";
	private Set<String> static_contents = new HashSet<String>();

	public int alert_message_length = 3000;
	public long alert_send_interval = 3000;
	public int alert_fetch_count = 100000;
	public int alert_sql_time = 30000;

	public int udp_packet_max = 60000;
	public boolean debug_asm;
	public boolean debug_udp_xlog;
	public boolean debug_udp_object;

	public long yellow_line_time = 3000;
	public long red_line_time = 8000;

	public long delayed_time = 10000;

	public String plugin_classpath = "";

	public StringSet log_ignore = new StringSet();

	public String hook_args = "";
	public String hook_return = "";
	public String hook_init = "";
	public String hook_dbc_close = "";
	public String hook_dbc_open = "";
	public String hook_dbc_open_detect = "";
	public boolean enable_dbc_open_detect = false;

	public String hook_method = "";
	public String hook_method_ignore_prefix = "";
	private String[] _hook_method_ignore_prefix = null;
	private int _hook_method_ignore_prefix_len = 0;
	
	public String hook_method_ignore_classes = "";
	private StringSet _hook_method_ignore_classes = new StringSet();
	
	public boolean hook_method_access_public = true;
	public boolean hook_method_access_private = false;
	public boolean hook_method_access_protected = false;
	public boolean hook_method_access_none = false;

	public String hook_service = "";
	public String hook_apicall = "";
	public String hook_apicall_info = "";
	public String hook_jsp = "";

	// /LOAD CONTROL/////
	public boolean enable_reject_service = false;
	public int max_active_service = 10000;
	public boolean enable_reject_url = false;
	public String reject_text = "too many request!!";
	public String reject_url = "/error.html";

	public int profile_step_max = 1024;
	
	public boolean debug_background_sql = false;
<commit_msg>set a default value on the config<commit_after>/*
 *  Copyright 2015 LG CNS.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License. 
 */

package scouter.agent;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import scouter.Version;
import scouter.agent.netio.data.DataProxy;
import scouter.lang.conf.ConfObserver;
import scouter.lang.conf.ConfigValueUtil;
import scouter.lang.counters.CounterConstants;
import scouter.lang.value.ListValue;
import scouter.lang.value.MapValue;
import scouter.net.NetConstants;
import scouter.util.DateUtil;
import scouter.util.FileUtil;
import scouter.util.HashUtil;
import scouter.util.IntSet;
import scouter.util.StringEnumer;
import scouter.util.StringKeyLinkedMap;
import scouter.util.StringSet;
import scouter.util.StringUtil;
import scouter.util.SysJMX;
import scouter.util.SystemUtil;
import scouter.util.ThreadUtil;

public class Configure extends Thread {

	public static boolean JDBC_REDEFINED = false;
	private static Configure instance = null;

	public final static synchronized Configure getInstance() {
		if (instance == null) {
			instance = new Configure();
			instance.setDaemon(true);
			instance.setName(ThreadUtil.getName(instance));
			instance.start();
		}
		return instance;
	}

	public boolean debug_config = false;

	public String local_addr = null;
	public int local_port;
	
	public String server_addr = "127.0.0.1";
	public int server_udp_port = NetConstants.DATAUDP_SERVER_PORT;
	public int server_tcp_port = NetConstants.DATATCP_SERVER_PORT;
	public int server_tcp_session_count = 2;
	public int server_tcp_so_timeout = 60000;
	public int server_tcp_connection_timeout = 3000;

	public String scouter_type = "";
	public String scouter_name = "";
	public String scouter_host_type = "";
	public String scouter_hostname = "";
	public int objHash;
	public String objName;

	public int objHostHash;
	public String objHostName;
	public boolean enable_host_agent = false;

	public boolean enable_scouter_name_pid = false;
	public boolean enable_plus_objtype = false;

	public boolean enable_asm_jdbc = true;
	public boolean enable_asm_httpsession = true;
	public boolean enable_asm_socket = true;

	public boolean http_debug_querystring;
	public boolean http_debug_header;
	public String http_debug_header_url = "/";
	public boolean http_debug_parameter;
	public String http_debug_parameter_url = "/";

	/*
	 * user: 
	 *  0 - remoteIp 
	 *  1 - JSESSIONID + remoteIp 
	 *  2 - SCOUTER(set-cookie)
	 */
	public int mode_userid = 2;

	public boolean enable_profile_summary = false;
	public boolean profile_thread_cputime = false;
	public boolean profile_socket_openstack = false;
	public boolean debug_socket_openstack = false;
	public int profile_socket_openstack_port = 0;
	public int debug_socket_openstack_port = 0;

	public int xlog_time_limit = 0;

	public String http_error_status = "";
	private IntSet http_error_status_set = new IntSet();

	public String service_header_key;
	public String service_get_key;
	public String service_post_key;

	public File dump_dir = new File(".");
	public File subagent_dir = new File("./_scouter_");

	public boolean enable_auto_dump = false;
	public int auto_dump_trigger = 10000;
	public long auto_dump_interval = 30000;
	public int auto_dump_level = 1;
	
	public int debug_long_tx_autostack = 0;

	public String http_static_contents = "js, htm, html, gif, png, jpg, css";
	private Set<String> static_contents = new HashSet<String>();

	public int alert_message_length = 3000;
	public long alert_send_interval = 3000;
	public int alert_fetch_count = 100000;
	public int alert_sql_time = 30000;

	public int udp_packet_max = 60000;
	public boolean debug_asm;
	public boolean debug_udp_xlog;
	public boolean debug_udp_object;

	public long yellow_line_time = 3000;
	public long red_line_time = 8000;

	public long delayed_time = 10000;

	public String plugin_classpath = "";

	public StringSet log_ignore = new StringSet();

	public String hook_args = "";
	public String hook_return = "";
	public String hook_init = "";
	public String hook_dbc_close = "";
	public String hook_dbc_open = "";
	public String hook_dbc_open_detect = "";
	public boolean enable_dbc_open_detect = false;

	public String hook_method = "";
	public String hook_method_ignore_prefix = "get,set";
	private String[] _hook_method_ignore_prefix = null;
	private int _hook_method_ignore_prefix_len = 0;
	
	public String hook_method_ignore_classes = "";
	private StringSet _hook_method_ignore_classes = new StringSet();
	
	public boolean hook_method_access_public = true;
	public boolean hook_method_access_private = false;
	public boolean hook_method_access_protected = false;
	public boolean hook_method_access_none = false;

	public String hook_service = "";
	public String hook_apicall = "";
	public String hook_apicall_info = "";
	public String hook_jsp = "";

	// /LOAD CONTROL/////
	public boolean enable_reject_service = false;
	public int max_active_service = 10000;
	public boolean enable_reject_url = false;
	public String reject_text = "too many request!!";
	public String reject_url = "/error.html";

	public int profile_step_max = 1024;
	
	public boolean debug_background_sql = false;

{'fraction_non_alphanumeric': 0.07809977054474378, 'fraction_numerical': 0.015297017081669074, 'mean_word_length': 5.025601638504864, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3824923', 'n_tokens_mistral': 3803, 'n_tokens_neox': 3530, 'n_words': 1063}