Example #1
1
  public void commandAction(Command command, Displayable displayable) {

    if (command == back) {
      controller.MainMenu();
    }
    if (command == viewStages) {
      busNos = busNo.getString().toUpperCase();
      fetchStagesData(busNos);
    }
    if (command == backToNo) {

      controller.getDisp().setCurrent(this);
    }
    if (command == MapStages) {
      controller.pointresultCanvas.busStagesPoints.removeAllElements();
      for (int mapStages = 0; mapStages < PostionAddress.length - 1; mapStages++) {
        String pos = PostionAddress[mapStages];
        String[] point = StringUtil.split(pos, "||");
        System.out.println(point[0] + "== " + point[1]);
        controller.pointBusStages(point[0], point[1]);
      }

      String pos = PostionAddress[Stages.getSelectedIndex()];
      String[] point = StringUtil.split(pos, "||");
      controller.gotoSpot(point[0], point[1]);
      controller.ShowPointingCanvas();
    }
    if (command == backToPlaces) {

      controller.getDisp().setCurrent(Stages);
    }
    if (command == showBuses) {
      controller.showProgressBar();
      fetchBusNoData();
    }
    if (command == showStages) {
      busNos = busesNearMe.getString(busesNearMe.getSelectedIndex()).toUpperCase();
      fetchStagesData(busNos);
    }
    if (command == viewBusPosition) {

      String[] data = GetBusPosition("Tt");
      String Message = "" + data[0] + "\n" + data[1] + "\n" + data[2];
      controller.showBusPosition(Message, data[3], data[4]);
    }
  }
Example #2
0
  private String[] GetBusPosition(String Str) {
    String uploadWebsite = "http://" + controller.URL_BASE + "/php/busposition?q=";
    String[] ArrayOfData = null;
    StreamConnection c = null;
    InputStream s = null;
    StringBuffer b = new StringBuffer();

    String url = uploadWebsite + Str;
    System.out.print(url);
    try {
      /* c = (StreamConnection)Connector.open(url);
      s = c.openDataInputStream();
      int ch;
      int k =0;
      while((ch = s.read()) != -1) {
            System.out.print((char) ch);
          b.append((char) ch);   }
      */
      String result; // = b.toString();
      result = "365E~~RTONO~~09:30:23~~12.21212~~89.23324234";
      //   System.out.print("in thread---------");
      // System.out.print(result);
      if (!result.equals("")) {

        ArrayOfData = StringUtil.split(result.toString().trim(), "~~");
      }
    } catch (Exception e) {
      System.out.print(e);
      controller.ShowPointingCanvas();
      controller.showAlert("Network Error", 3, AlertType.ERROR);
    }

    return ArrayOfData;
  }
Example #3
0
 private void setStaticContents() {
   Set<String> tmp = new HashSet<String>();
   String[] s = StringUtil.split(this.mgr_static_content_extensions, ',');
   for (int i = 0; i < s.length; i++) {
     String ss = s[i].trim();
     if (ss.length() > 0) {
       tmp.add(ss);
     }
   }
   static_contents = tmp;
 }
Example #4
0
 private StringSet getStringSet(String key, String deli) {
   StringSet set = new StringSet();
   String v = getValue(key);
   if (v != null) {
     String[] vv = StringUtil.split(v, deli);
     for (String x : vv) {
       x = StringUtil.trimToEmpty(x);
       if (x.length() > 0) set.put(x);
     }
   }
   return set;
 }
Example #5
0
  private String[] GetDataFromSite() {

    String uploadWebsite = "http://" + controller.selectedCity.URL + "/cameras/mobile_cam_list.php";
    String[] ArrayOfData = null;
    StreamConnection c = null;
    InputStream s = null;
    StringBuffer b = new StringBuffer();

    String url = uploadWebsite;
    System.out.print(url);
    try {
      c = (StreamConnection) Connector.open(url);
      s = c.openDataInputStream();
      int ch;
      int k = 0;
      while ((ch = s.read()) != -1) {
        System.out.print((char) ch);
        b.append((char) ch);
      }

      String result = b.toString();
      if (!result.equals("")) {

        ArrayOfData = StringUtil.split(result.toString().trim(), "~~");
        if (ArrayOfData.length == 0) {
          controller.MainMenu();
          new Thread() {
            public void run() {
              controller.showAlert("Network Error", 0, AlertType.ERROR);
            }
          }.start();
        }
      }
    } catch (Exception e) {
      System.out.print(e);
      new Thread() {
        public void run() {
          controller.showProgressBar();
        }
      }.start();
      // controller.getDisp().setCurrent(this);

    }

    return ArrayOfData;
  }
Example #6
0
  private void apply() {
    this.profile_http_querystring_enabled = getBoolean("profile_http_querystring_enabled", false);
    this.profile_http_header_enabled = getBoolean("profile_http_header_enabled", false);
    this.profile_http_parameter_enabled = getBoolean("profile_http_parameter_enabled", false);
    this.profile_summary_mode_enabled = getBoolean("profile_summary_mode_enabled", false);
    this.xlog_lower_bound_time_ms = getInt("xlog_lower_bound_time_ms", 0);
    this.trace_service_name_header_key = getValue("trace_service_name_header_key", null);
    this.trace_service_name_get_key = getValue("trace_service_name_get_key");
    this.trace_service_name_post_key = getValue("trace_service_name_post_key");
    this.dump_dir = new File(getValue("dump_dir", "./dump"));
    try {
      this.dump_dir.mkdirs();
    } catch (Exception e) {
    }
    //		this.mgr_agent_lib_dir = new File(getValue("mgr_agent_lib_dir", "./_scouter_"));
    //		try {
    //			this.mgr_agent_lib_dir.mkdirs();
    //		} catch (Exception e) {
    //		}
    this.plugin_dir = new File(getValue("plugin_dir", "./plugin"));

    this.autodump_enabled = getBoolean("autodump_enabled", false);
    this.autodump_trigger_active_service_cnt = getInt("autodump_trigger_active_service_cnt", 10000);
    if (this.autodump_trigger_active_service_cnt < 1) {
      this.autodump_trigger_active_service_cnt = 1;
    }
    this.autodump_level = getInt("autodump_level", 1);
    this.autodump_interval_ms = getInt("autodump_interval_ms", 30000);
    if (this.autodump_interval_ms < 5000) {
      this.autodump_interval_ms = 5000;
    }
    this.autodump_stuck_thread_ms = getInt("autodump_stuck_thread_ms", 0);
    this.mgr_static_content_extensions =
        getValue("mgr_static_content_extensions", "js, htm, html, gif, png, jpg, css");
    this.profile_thread_cputime_enabled = getBoolean("profile_thread_cputime_enabled", false);
    this.profile_socket_open_fullstack_enabled =
        getBoolean("profile_socket_open_fullstack_enabled", false);
    this.trace_background_socket_enabled = getBoolean("trace_background_socket_enabled", true);
    this.profile_socket_open_fullstack_port = getInt("profile_socket_open_fullstack_port", 0);
    this.profile_sql_escape_enabled = getBoolean("profile_sql_escape_enabled", true);
    this.profile_sqlmap_name_enabled = getBoolean("profile_sqlmap_name_enabled", true);
    this.net_udp_packet_max_bytes = getInt("net_udp_packet_max_bytes", 60000);
    this.trace_activeserivce_yellow_time = getLong("trace_activeserivce_yellow_time", 3000);
    this.trace_activeservice_red_time = getLong("trace_activeservice_red_time", 8000);
    this.mgr_log_ignore_ids = getValue("mgr_log_ignore_ids", "");
    this.log_ignore_set = getStringSet("mgr_log_ignore_ids", ",");
    this._log_udp_xlog_enabled = getBoolean("_log_udp_xlog_enabled", false);
    this._log_udp_counter_enabled = getBoolean("_log_udp_counter_enabled", false);
    this._log_udp_object_enabled = getBoolean("_log_udp_object_enabled", false);
    this.net_local_udp_ip = getValue("net_local_udp_ip");
    this.net_local_udp_port = getInt("net_local_udp_port", 0);
    this.net_collector_ip = getValue("net_collector_ip", "127.0.0.1");
    this.net_collector_udp_port = getInt("net_collector_udp_port", NetConstants.SERVER_UDP_PORT);
    this.net_collector_tcp_port = getInt("net_collector_tcp_port", NetConstants.SERVER_TCP_PORT);
    this.net_collector_tcp_session_count = getInt("net_collector_tcp_session_count", 1, 1);
    this.net_collector_tcp_connection_timeout_ms =
        getInt("net_collector_tcp_connection_timeout_ms", 3000);
    this.net_collector_tcp_so_timeout_ms = getInt("net_collector_tcp_so_timeout_ms", 60000);
    this.hook_signature = 0;
    this.hook_args_patterns = getValue("hook_args_patterns", "");
    this.hook_return_patterns = getValue("hook_return_patterns", "");
    this.hook_constructor_patterns = getValue("hook_constructor_patterns", "");
    this.hook_connection_open_patterns = getValue("hook_connection_open_patterns", "");

    this._log_datasource_lookup_enabled = getBoolean("_log_datasource_lookup_enabled", true);
    this.profile_connection_open_enabled = getBoolean("profile_connection_open_enabled", true);
    this._summary_connection_leak_fullstack_enabled =
        getBoolean("_summary_connection_leak_fullstack_enabled", false);
    this.hook_method_patterns = getValue("hook_method_patterns", "");
    this.hook_method_access_public_enabled = getBoolean("hook_method_access_public_enabled", true);
    this.hook_method_access_protected_enabled =
        getBoolean("hook_method_access_protected_enabled", false);
    this.hook_method_access_private_enabled =
        getBoolean("hook_method_access_private_enabled", false);
    this.hook_method_access_none_enabled = getBoolean("hook_method_access_none_enabled", false);
    this.hook_method_ignore_prefixes =
        StringUtil.removeWhitespace(getValue("hook_method_ignore_prefixes", "get,set"));
    this._hook_method_ignore_prefix = StringUtil.split(this.hook_method_ignore_prefixes, ",");
    this._hook_method_ignore_prefix_len =
        this._hook_method_ignore_prefix == null ? 0 : this._hook_method_ignore_prefix.length;
    this.hook_method_ignore_classes =
        StringUtil.trimEmpty(
            StringUtil.removeWhitespace(getValue("hook_method_ignore_classes", "")));
    this._hook_method_ignore_classes =
        new StringSet(StringUtil.tokenizer(this.hook_method_ignore_classes.replace('.', '/'), ","));
    this.profile_method_enabled = getBoolean("profile_method_enabled", true);
    this.hook_service_patterns = getValue("hook_service_patterns", "");
    this.hook_apicall_patterns = getValue("hook_apicall_patterns", "");
    this.hook_apicall_info_patterns = getValue("hook_apicall_info_patterns", "");
    this.hook_jsp_patterns = getValue("hook_jsp_patterns", "");

    this.hook_jdbc_pstmt_classes = getValue("hook_jdbc_pstmt_classes", "");
    this.hook_jdbc_stmt_classes = getValue("hook_jdbc_stmt_classes", "");
    this.hook_jdbc_rs_classes = getValue("hook_jdbc_rs_classes", "");
    this.hook_jdbc_wrapping_driver_patterns = getValue("hook_jdbc_wrapping_driver_patterns", "");
    this.hook_add_fields = getValue("hook_add_fields", "");
    this.hook_context_classes = getValue("hook_context_classes", "javax/naming/InitialContext");

    this.hook_signature ^= this.hook_args_patterns.hashCode();
    this.hook_signature ^= this.hook_return_patterns.hashCode();
    this.hook_signature ^= this.hook_constructor_patterns.hashCode();
    this.hook_signature ^= this.hook_connection_open_patterns.hashCode();
    this.hook_signature ^= this.hook_method_patterns.hashCode();
    this.hook_signature ^= this.hook_service_patterns.hashCode();
    this.hook_signature ^= this.hook_apicall_patterns.hashCode();
    this.hook_signature ^= this.hook_jsp_patterns.hashCode();
    this.hook_signature ^= this.hook_jdbc_wrapping_driver_patterns.hashCode();

    this.control_reject_service_enabled = getBoolean("control_reject_service_enabled", false);
    this.control_reject_service_max_count = getInt("control_reject_service_max_count", 10000);
    this.control_reject_redirect_url_enabled =
        getBoolean("control_reject_redirect_url_enabled", false);
    this.control_reject_text = getValue("control_reject_text", "too many request!!");
    this.control_reject_redirect_url = getValue("control_reject_redirect_url", "/error.html");

    this.profile_step_max_count = getInt("profile_step_max_count", 1024);
    if (this.profile_step_max_count < 100) this.profile_step_max_count = 100;
    this._log_background_sql = getBoolean("_log_background_sql", false);
    this.profile_fullstack_service_error_enabled =
        getBoolean("profile_fullstack_service_error_enabled", false);
    this.profile_fullstack_apicall_error_enabled =
        getBoolean("profile_fullstack_apicall_error_enabled", false);
    this.profile_fullstack_sql_error_enabled =
        getBoolean("profile_fullstack_sql_error_enabled", false);
    this.profile_fullstack_sql_commit_enabled =
        getBoolean("profile_fullstack_sql_commit_enabled", false);
    this.profile_fullstack_max_lines = getInt("profile_fullstack_max_lines", 0);
    this.net_udp_collection_interval_ms = getInt("net_udp_collection_interval_ms", 100);
    this.profile_http_parameter_url_prefix = getValue("profile_http_parameter_url_prefix", "/");
    this.profile_http_header_url_prefix = getValue("profile_http_header_url_prefix", "/");
    this.trace_http_client_ip_header_key = getValue("trace_http_client_ip_header_key", "");
    this.trace_interservice_enabled = getBoolean("trace_interservice_enabled", false);
    this.trace_response_gxid_enabled = getBoolean("trace_response_gxid_enabled", false);
    this._trace_interservice_gxid_header_key =
        getValue("_trace_interservice_gxid_header_key", "X-Scouter-Gxid");
    this._trace_interservice_callee_header_key =
        getValue("_trace_interservice_callee_header_key", "X-Scouter-Callee");
    this._trace_interservice_caller_header_key =
        getValue("_trace_interservice_caller_header_key", "X-Scouter-Caller");
    this.profile_connection_open_fullstack_enabled =
        getBoolean("profile_connection_open_fullstack_enabled", false);
    this.profile_connection_autocommit_status_enabled =
        getBoolean("profile_connection_autocommit_status_enabled", false);
    this.trace_user_mode = getInt("trace_user_mode", 2);
    this.trace_user_session_key = getValue("trace_user_session_key", "JSESSIONID");
    this._trace_auto_service_enabled = getBoolean("_trace_auto_service_enabled", false);
    this._trace_auto_service_backstack_enabled =
        getBoolean("_trace_auto_service_backstack_enabled", true);
    this.counter_enabled = getBoolean("counter_enabled", true);
    this._hook_serivce_enabled = getBoolean("_hook_serivce_enabled", true);
    this._hook_dbsql_enabled = getBoolean("_hook_dbsql_enabled", true);
    this._hook_dbconn_enabled = getBoolean("_hook_dbconn_enabled", true);
    this._hook_cap_enabled = getBoolean("_hook_cap_enabled", true);
    this._hook_methods_enabled = getBoolean("_hook_methods_enabled", true);
    this._hook_socket_enabled = getBoolean("_hook_socket_enabled", true);
    this._hook_jsp_enabled = getBoolean("_hook_jsp_enabled", true);
    this._hook_async_enabled = getBoolean("_hook_async_enabled", true);
    this.trace_db2_enabled = getBoolean("trace_db2_enabled", true);
    this._hook_usertx_enabled = getBoolean("_hook_usertx_enabled", true);
    this._hook_direct_patch_classes = getValue("_hook_direct_patch_classes", "");
    this.counter_recentuser_valid_ms =
        getLong("counter_recentuser_valid_ms", DateUtil.MILLIS_PER_FIVE_MINUTE);
    this.counter_object_registry_path = getValue("counter_object_registry_path", "/tmp/scouter");
    this.sfa_dump_enabled = getBoolean("sfa_dump_enabled", false);
    this.sfa_dump_interval_ms = getInt("sfa_dump_interval_ms", 10000);
    // 웹시스템으로 부터 WAS 사이의 성능과 어떤 웹서버가 요청을 보내 왔는지를 추적하는 기능을 ON/OFF하고
    // 관련 키정보를 지정한다.
    this.trace_webserver_enabled = getBoolean("trace_webserver_enabled", false);
    this.trace_webserver_name_header_key =
        getValue("trace_webserver_name_header_key", "X-Forwarded-Host");
    this.trace_webserver_time_header_key =
        getValue("trace_webserver_time_header_key", "X-Forwarded-Time");
    // SUMMARY최대 갯수를 관리한다.
    this.summary_enabled = getBoolean("summary_enabled", true);
    this._summary_sql_max_count = getInt("_summary_sql_max_count", 5000);
    this._summary_api_max_count = getInt("_summary_api_max_count", 5000);
    this._summary_service_max_count = getInt("_summary_service_max_count", 5000);
    this._summary_ip_max_count = getInt("_summary_ip_max_count", 5000);
    this._summary_useragent_max_count = getInt("_summary_useragent_max_count", 5000);
    this._summary_error_max_count = getInt("_summary_error_max_count", 500);

    this._summary_enduser_nav_max_count = getInt("_summary_enduser_nav_max_count", 5000);
    this._summary_enduser_ajax_max_count = getInt("_summary_enduser_ajax_max_count", 5000);
    this._summary_enduser_error_max_count = getInt("_summary_enduser_error_max_count", 5000);

    // Experimental(ignoreset)
    this.__experimental = getBoolean("__experimental", false);
    this.__control_connection_leak_autoclose_enabled =
        getBoolean("_control_connection_leak_autoclose_enabled", false);

    this.alert_perm_warning_pct = getInt("alert_perm_warning_pct", 90);
    this._hook_spring_rest_enabled = getBoolean("_hook_spring_rest_enabled", false);
    this.alert_message_length = getInt("alert_message_length", 3000);
    this.alert_send_interval_ms = getInt("alert_send_interval_ms", 3000);
    this.xlog_error_jdbc_fetch_max = getInt("xlog_error_jdbc_fetch_max", 10000);
    this.xlog_error_sql_time_max_ms = getInt("xlog_error_sql_time_max_ms", 30000);
    this._log_asm_enabled = getBoolean("_log_asm_enabled", false);
    this.obj_type_inherit_to_child_enabled = getBoolean("obj_type_inherit_to_child_enabled", false);
    this._profile_fullstack_sql_connection_enabled =
        getBoolean("_profile_fullstack_sql_connection_enabled", false);
    this._trace_fullstack_socket_open_port = getInt("_trace_fullstack_socket_open_port", 0);
    this.log_dir = getValue("log_dir", "");
    this.log_rotation_enabled = getBoolean("log_rotation_enabled", true);
    this.log_keep_days = getInt("log_keep_days", 7);
    this._log_trace_enabled = getBoolean("_log_trace_enabled", false);
    this._log_trace_use_logger = getBoolean("_log_trace_use_logger", false);

    this.enduser_trace_endpoint_url =
        getValue("enduser_trace_endpoint_url", "_scouter_browser.jsp");
    this.enduser_perf_endpoint_hash = HashUtil.hash(this.enduser_trace_endpoint_url);

    this.xlog_error_check_user_transaction_enabled =
        getBoolean("xlog_error_check_user_transaction_enabled", true);

    resetObjInfo();
    setStaticContents();
  }