From dcce692208a46603554ceaa0533dc15908b3fc60 Mon Sep 17 00:00:00 2001 From: crusader Date: Mon, 11 Dec 2017 15:47:37 +0900 Subject: [PATCH] ing --- .idea/codeStyles/Project.xml | 52 ++ .idea/compiler.xml | 16 + .idea/dbnavigator.xml | 453 ++++++++++++++++++ .idea/encodings.xml | 6 + ..._ch_qos_logback_logback_classic_1_1_11.xml | 13 + ...en__ch_qos_logback_logback_core_1_1_11.xml | 13 + ...jackson_core_jackson_annotations_2_9_0.xml | 13 + ...terxml_jackson_core_jackson_core_2_9_2.xml | 13 + ...ml_jackson_core_jackson_databind_2_9_2.xml | 13 + ...n__com_jayway_jsonpath_json_path_2_2_0.xml | 13 + ...ogle_android_json_0_0_20131108_vaadin1.xml | 13 + ...Maven__io_netty_netty_all_4_1_17_Final.xml | 13 + .idea/libraries/Maven__junit_junit_4_12.xml | 13 + ...Maven__net_minidev_accessors_smart_1_1.xml | 13 + .../Maven__net_minidev_json_smart_2_2_1.xml | 13 + .../Maven__org_assertj_assertj_core_2_6_0.xml | 13 + .../Maven__org_hamcrest_hamcrest_core_1_3.xml | 13 + ...ven__org_hamcrest_hamcrest_library_1_3.xml | 13 + ...aven__org_mockito_mockito_core_1_10_19.xml | 13 + .../Maven__org_objenesis_objenesis_2_1.xml | 13 + .../Maven__org_ow2_asm_asm_5_0_3.xml | 13 + ...aven__org_skyscreamer_jsonassert_1_4_0.xml | 13 + ...Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml | 13 + .../Maven__org_slf4j_jul_to_slf4j_1_7_25.xml | 13 + ...ven__org_slf4j_log4j_over_slf4j_1_7_25.xml | 13 + .../Maven__org_slf4j_slf4j_api_1_7_25.xml | 13 + ...amework_boot_spring_boot_1_5_9_RELEASE.xml | 13 + ...pring_boot_autoconfigure_1_5_9_RELEASE.xml | 13 + ...boot_spring_boot_starter_1_5_9_RELEASE.xml | 13 + ...ing_boot_starter_logging_1_5_9_RELEASE.xml | 13 + ...spring_boot_starter_test_1_5_9_RELEASE.xml | 13 + ...rk_boot_spring_boot_test_1_5_9_RELEASE.xml | 13 + ..._boot_test_autoconfigure_1_5_9_RELEASE.xml | 13 + ...ingframework_spring_aop_4_3_13_RELEASE.xml | 13 + ...gframework_spring_beans_4_3_13_RELEASE.xml | 13 + ...ramework_spring_context_4_3_13_RELEASE.xml | 13 + ...ngframework_spring_core_4_3_13_RELEASE.xml | 13 + ...ework_spring_expression_4_3_13_RELEASE.xml | 13 + ...ngframework_spring_test_4_3_13_RELEASE.xml | 13 + .../Maven__org_yaml_snakeyaml_1_17.xml | 13 + .idea/misc.xml | 13 + .idea/modules.xml | 8 + .idea/uiDesigner.xml | 124 +++++ .idea/vcs.xml | 6 + overflow_probe_container_general.iml | 52 ++ pom.xml | 45 ++ .../overflow/probe/container/Application.java | 25 + .../probe/container/rpc/invoker/Invoker.java | 7 + .../rpc/invoker/spring/SpringInvoker.java | 181 +++++++ .../rpc/protocol/json/ServerRequest.java | 43 ++ .../rpc/protocol/json/ServerResponse.java | 40 ++ .../server/ContainerChannelInitializer.java | 36 ++ .../server/ContainerConfiguration.java | 52 ++ .../server/ContainerJSONHandler.java | 68 +++ .../container/server/ContainerServer.java | 34 ++ .../probe/container/util/Primitives.java | 44 ++ src/main/resources/application.properties | 0 .../probe/container/ApplicationTests.java | 25 + src/test/resources/_ | 0 59 files changed, 1798 insertions(+) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/dbnavigator.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml create mode 100644 .idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml create mode 100644 .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml create mode 100644 .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_2.xml create mode 100644 .idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_2.xml create mode 100644 .idea/libraries/Maven__com_jayway_jsonpath_json_path_2_2_0.xml create mode 100644 .idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml create mode 100644 .idea/libraries/Maven__io_netty_netty_all_4_1_17_Final.xml create mode 100644 .idea/libraries/Maven__junit_junit_4_12.xml create mode 100644 .idea/libraries/Maven__net_minidev_accessors_smart_1_1.xml create mode 100644 .idea/libraries/Maven__net_minidev_json_smart_2_2_1.xml create mode 100644 .idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml create mode 100644 .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml create mode 100644 .idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml create mode 100644 .idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml create mode 100644 .idea/libraries/Maven__org_objenesis_objenesis_2_1.xml create mode 100644 .idea/libraries/Maven__org_ow2_asm_asm_5_0_3.xml create mode 100644 .idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml create mode 100644 .idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml create mode 100644 .idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml create mode 100644 .idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml create mode 100644 .idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_1_5_9_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_9_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_5_9_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_5_9_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_spring_aop_4_3_13_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_spring_beans_4_3_13_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_spring_context_4_3_13_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_spring_core_4_3_13_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_spring_expression_4_3_13_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_springframework_spring_test_4_3_13_RELEASE.xml create mode 100644 .idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 overflow_probe_container_general.iml create mode 100644 pom.xml create mode 100644 src/main/java/com/loafle/overflow/probe/container/Application.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/rpc/invoker/Invoker.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/rpc/invoker/spring/SpringInvoker.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerRequest.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerResponse.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/server/ContainerChannelInitializer.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/server/ContainerConfiguration.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/server/ContainerJSONHandler.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/server/ContainerServer.java create mode 100644 src/main/java/com/loafle/overflow/probe/container/util/Primitives.java create mode 100644 src/main/resources/application.properties create mode 100644 src/test/java/com/loafle/overflow/probe/container/ApplicationTests.java create mode 100644 src/test/resources/_ diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..6d799a0 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..572df67 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 0000000..67ce0f0 --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,453 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..b26911b --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml b/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml new file mode 100644 index 0000000..c6ea67e --- /dev/null +++ b/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml b/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml new file mode 100644 index 0000000..f538e36 --- /dev/null +++ b/.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml new file mode 100644 index 0000000..06441f4 --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_2.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_2.xml new file mode 100644 index 0000000..f0f5ccb --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_2.xml b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_2.xml new file mode 100644 index 0000000..25753a3 --- /dev/null +++ b/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_2.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_2_0.xml b/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_2_0.xml new file mode 100644 index 0000000..578b079 --- /dev/null +++ b/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_2_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml b/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml new file mode 100644 index 0000000..b8581a6 --- /dev/null +++ b/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__io_netty_netty_all_4_1_17_Final.xml b/.idea/libraries/Maven__io_netty_netty_all_4_1_17_Final.xml new file mode 100644 index 0000000..9d57bdf --- /dev/null +++ b/.idea/libraries/Maven__io_netty_netty_all_4_1_17_Final.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__junit_junit_4_12.xml b/.idea/libraries/Maven__junit_junit_4_12.xml new file mode 100644 index 0000000..d411041 --- /dev/null +++ b/.idea/libraries/Maven__junit_junit_4_12.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_minidev_accessors_smart_1_1.xml b/.idea/libraries/Maven__net_minidev_accessors_smart_1_1.xml new file mode 100644 index 0000000..88d626e --- /dev/null +++ b/.idea/libraries/Maven__net_minidev_accessors_smart_1_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__net_minidev_json_smart_2_2_1.xml b/.idea/libraries/Maven__net_minidev_json_smart_2_2_1.xml new file mode 100644 index 0000000..6c692c8 --- /dev/null +++ b/.idea/libraries/Maven__net_minidev_json_smart_2_2_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml b/.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml new file mode 100644 index 0000000..58bdc9a --- /dev/null +++ b/.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..f58bbc1 --- /dev/null +++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml b/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml new file mode 100644 index 0000000..78dbe45 --- /dev/null +++ b/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml b/.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml new file mode 100644 index 0000000..a523703 --- /dev/null +++ b/.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml b/.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml new file mode 100644 index 0000000..7ab319b --- /dev/null +++ b/.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_ow2_asm_asm_5_0_3.xml b/.idea/libraries/Maven__org_ow2_asm_asm_5_0_3.xml new file mode 100644 index 0000000..da69f6c --- /dev/null +++ b/.idea/libraries/Maven__org_ow2_asm_asm_5_0_3.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml b/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml new file mode 100644 index 0000000..f86d2c8 --- /dev/null +++ b/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml b/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml new file mode 100644 index 0000000..bae9949 --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml b/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml new file mode 100644 index 0000000..6073e53 --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml b/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml new file mode 100644 index 0000000..a14ac63 --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml new file mode 100644 index 0000000..20e8163 --- /dev/null +++ b/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_5_9_RELEASE.xml new file mode 100644 index 0000000..44dc419 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_1_5_9_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_9_RELEASE.xml new file mode 100644 index 0000000..4c3a2b7 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_9_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_5_9_RELEASE.xml new file mode 100644 index 0000000..c6ba5e1 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_5_9_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_5_9_RELEASE.xml new file mode 100644 index 0000000..33c0b1c --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_5_9_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml new file mode 100644 index 0000000..d7db397 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml new file mode 100644 index 0000000..9312efe --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml b/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml new file mode 100644 index 0000000..07d7bca --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_aop_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_aop_4_3_13_RELEASE.xml new file mode 100644 index 0000000..e06e71e --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_spring_aop_4_3_13_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_beans_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_beans_4_3_13_RELEASE.xml new file mode 100644 index 0000000..0a8cafe --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_spring_beans_4_3_13_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_context_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_context_4_3_13_RELEASE.xml new file mode 100644 index 0000000..8050852 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_spring_context_4_3_13_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_core_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_core_4_3_13_RELEASE.xml new file mode 100644 index 0000000..b95dd78 --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_spring_core_4_3_13_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_expression_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_expression_4_3_13_RELEASE.xml new file mode 100644 index 0000000..7a825ff --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_spring_expression_4_3_13_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_springframework_spring_test_4_3_13_RELEASE.xml b/.idea/libraries/Maven__org_springframework_spring_test_4_3_13_RELEASE.xml new file mode 100644 index 0000000..0c0fcbf --- /dev/null +++ b/.idea/libraries/Maven__org_springframework_spring_test_4_3_13_RELEASE.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml new file mode 100644 index 0000000..20e2920 --- /dev/null +++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e8942bd --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1cb20e0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..e96534f --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/overflow_probe_container_general.iml b/overflow_probe_container_general.iml new file mode 100644 index 0000000..cc93fd1 --- /dev/null +++ b/overflow_probe_container_general.iml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..83ead1b --- /dev/null +++ b/pom.xml @@ -0,0 +1,45 @@ + + + 4.0.0 + + + com.loafle + maven_parent_spring_boot + 1.5.9-RELEASE + + + + com.loafle.overflow + probe_container_general + 1.0.0-SNAPSHOT + jar + + com.loafle.overflow.probe_container_general + probe_container_general project for Spring Boot + + + 4.1.17.Final + 2.9.2 + + + + + io.netty + netty-all + ${netty.version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + + + + \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/probe/container/Application.java b/src/main/java/com/loafle/overflow/probe/container/Application.java new file mode 100644 index 0000000..1763122 --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/Application.java @@ -0,0 +1,25 @@ +package com.loafle.overflow.probe.container; + +import com.loafle.overflow.probe.container.server.ContainerServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.Banner; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application implements CommandLineRunner { + @Autowired + private ContainerServer containerServer; + + @Override + public void run(String... strings) throws Exception { + containerServer.start(); + } + + public static void main(String[] args) { + SpringApplication app = new SpringApplication(Application.class); + app.setBannerMode(Banner.Mode.OFF); + app.run(args); + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/rpc/invoker/Invoker.java b/src/main/java/com/loafle/overflow/probe/container/rpc/invoker/Invoker.java new file mode 100644 index 0000000..344b5d0 --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/rpc/invoker/Invoker.java @@ -0,0 +1,7 @@ +package com.loafle.overflow.probe.container.rpc.invoker; + +import java.util.List; + +public interface Invoker { + Object invoke(String method, List params) throws Exception; +} diff --git a/src/main/java/com/loafle/overflow/probe/container/rpc/invoker/spring/SpringInvoker.java b/src/main/java/com/loafle/overflow/probe/container/rpc/invoker/spring/SpringInvoker.java new file mode 100644 index 0000000..cd8e2c1 --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/rpc/invoker/spring/SpringInvoker.java @@ -0,0 +1,181 @@ +package com.loafle.overflow.probe.container.rpc.invoker.spring; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.loafle.overflow.probe.container.rpc.invoker.Invoker; +import com.loafle.overflow.probe.container.util.Primitives; +import org.springframework.aop.support.AopUtils; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.security.InvalidParameterException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Component +public class SpringInvoker implements Invoker { + @Autowired + private ApplicationContext applicationContext; + + @Autowired + private ObjectMapper objectMapper; + + private Map serviceCacheMap; + + public SpringInvoker() { + serviceCacheMap = new HashMap<>(); + } + + private static class Cache { + private ServiceCache serviceCache; + private Map methodCacheMap; + + private Cache(Object bean) { + serviceCache = new ServiceCache(); + serviceCache.bean = bean; + + methodCacheMap = new HashMap<>(10); + } + + private Object getBean() { + return serviceCache.bean; + } + + private MethodCache getMethodCache(String methodName) throws NoSuchMethodException { + MethodCache methodCache = methodCacheMap.get(methodName); + if (null != methodCache) { + return methodCache; + } + + Method method = getMethod(methodName); + if (null == method) { + throw new NoSuchMethodException(); + } + methodCache = new MethodCache(); + methodCacheMap.put(methodName, methodCache); + + methodCache.method = method; + methodCache.returnClazz = method.getReturnType(); + + int paramCount = method.getParameterCount(); + if (0 == paramCount) { + return methodCache; + } + + methodCache.parameterTypes = method.getGenericParameterTypes(); + + return methodCache; + } + + private Method getMethod(String methodName) { + Class clazz = AopUtils.getTargetClass(serviceCache.bean); + Method[] methods = clazz.getMethods(); + + Method targetMethod = null; + for(Method m : methods){ + if (methodName.equals(m.getName())) { + targetMethod = m; + break; + } + } + return targetMethod; + } + + private static class ServiceCache { + private Object bean; + private Map methodCacheMap; + } + private static class MethodCache { + private Method method; + private Class returnClazz; + private Type[] parameterTypes; + } + } + + private Cache getServiceCache(String serviceName) throws Exception { + Cache serviceCache = serviceCacheMap.get(serviceName); + if (null != serviceCache) { + return serviceCache; + } + try { + Object bean = applicationContext.getBean(serviceName); + serviceCache = new Cache(bean); + serviceCacheMap.put(serviceName, serviceCache); + } catch (BeansException e) { + throw new Exception(); + } + + return serviceCache; + } + + private Object getValue(Type parameterType, String json) throws InvalidParameterException { + JavaType targetType = objectMapper.getTypeFactory().constructType(parameterType); + if (!Primitives.isPrimitive(parameterType) && !parameterType.getTypeName().equals(String.class.getName())) { + try { + return objectMapper.readValue(json, targetType); + } catch (IOException e) { + throw new InvalidParameterException(); + } + } + return objectMapper.convertValue(json, targetType); + } + + + private Object[] getParameters(Type[] parameterTypes, List params) throws InvalidParameterException { + if (null == parameterTypes || null == params) { + return null; + } + + if (parameterTypes.length != params.size()) { + throw new IllegalArgumentException(); + } + + Object[] result = new Object[parameterTypes.length]; + + for (int i = 0; i < parameterTypes.length; i++) { + result[i] = getValue(parameterTypes[i], params.get(i)); + } + + return result; + } + + + public Object invoke(String method, List params) throws Exception { + String[] ms = method.split("\\."); + String serviceName = ms[0]; + String methodName = ms[1]; + + Cache serviceCache = getServiceCache(serviceName); + Cache.MethodCache methodCache = serviceCache.getMethodCache(methodName); + + if (null == methodCache.parameterTypes) { + if (null != params && 0 < params.size()) { + throw new InvalidParameterException(); + } + } else { + if (methodCache.parameterTypes.length != params.size()) { + throw new InvalidParameterException(); + } + } + + Object[] parameters = null; + if (null != methodCache.parameterTypes && 0 < methodCache.parameterTypes.length) { + parameters = getParameters(methodCache.parameterTypes, params); + } + + Object result = null; + try { + result = methodCache.method.invoke(serviceCache.getBean(), parameters); + } catch (Exception e) { + throw e; + } + + return result; + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerRequest.java b/src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerRequest.java new file mode 100644 index 0000000..2397a7d --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerRequest.java @@ -0,0 +1,43 @@ +package com.loafle.overflow.probe.container.rpc.protocol.json; + +import java.util.List; + +public class ServerRequest { + private String jsonrpc; + private String method; + private List params; + private Object id; + + + public String getJsonrpc() { + return jsonrpc; + } + + public void setJsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public List getParams() { + return params; + } + + public void setParams(List params) { + this.params = params; + } + + public Object getId() { + return id; + } + + public void setId(Object id) { + this.id = id; + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerResponse.java b/src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerResponse.java new file mode 100644 index 0000000..619b2bf --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/rpc/protocol/json/ServerResponse.java @@ -0,0 +1,40 @@ +package com.loafle.overflow.probe.container.rpc.protocol.json; + +public class ServerResponse { + private String jsonrpc = "2.0"; + private Object result; + private Object error; + private Object id; + + public String getJsonrpc() { + return jsonrpc; + } + + public void setJsonrpc(String jsonrpc) { + this.jsonrpc = jsonrpc; + } + + public Object getResult() { + return result; + } + + public void setResult(Object result) { + this.result = result; + } + + public Object getError() { + return error; + } + + public void setError(Object error) { + this.error = error; + } + + public Object getId() { + return id; + } + + public void setId(Object id) { + this.id = id; + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/server/ContainerChannelInitializer.java b/src/main/java/com/loafle/overflow/probe/container/server/ContainerChannelInitializer.java new file mode 100644 index 0000000..84d52af --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/server/ContainerChannelInitializer.java @@ -0,0 +1,36 @@ +package com.loafle.overflow.probe.container.server; + +import io.netty.channel.Channel; +import io.netty.channel.ChannelInboundHandlerAdapter; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelPipeline; +import io.netty.handler.codec.json.JsonObjectDecoder; +import io.netty.handler.codec.string.StringDecoder; +import io.netty.handler.codec.string.StringEncoder; +import io.netty.util.CharsetUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component +@Qualifier("containerChannelInitializer") +public class ContainerChannelInitializer extends ChannelInitializer { + private static final StringDecoder STRING_DECODER = new StringDecoder(CharsetUtil.UTF_8); + private static final StringEncoder STRING_ENCODER = new StringEncoder(CharsetUtil.UTF_8); + + @Autowired + @Qualifier("containerJSONHandler") + private ChannelInboundHandlerAdapter containerJSONHandler; + + @Override + protected void initChannel(Channel channel) throws Exception { + ChannelPipeline channelPipeline = channel.pipeline(); + + channelPipeline + .addLast(new JsonObjectDecoder(Integer.MAX_VALUE)) + .addLast(STRING_DECODER) + .addLast(STRING_ENCODER) + .addLast(containerJSONHandler); + + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/server/ContainerConfiguration.java b/src/main/java/com/loafle/overflow/probe/container/server/ContainerConfiguration.java new file mode 100644 index 0000000..503834b --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/server/ContainerConfiguration.java @@ -0,0 +1,52 @@ +package com.loafle.overflow.probe.container.server; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.net.InetSocketAddress; + +@Configuration +public class ContainerConfiguration { + private int port = 19390; + + @Autowired + private ContainerChannelInitializer containerChannelInitializer; + + @Bean(destroyMethod = "shutdownGracefully") + public NioEventLoopGroup bossGroup() { + return new NioEventLoopGroup(); + } + + @Bean(destroyMethod = "shutdownGracefully") + public NioEventLoopGroup workerGroup() { + return new NioEventLoopGroup(); + + } + + @Bean + public InetSocketAddress socketAddress() { + return new InetSocketAddress("127.0.0.1", port); + } + + @Bean + public ServerBootstrap serverBootstrap() { + ServerBootstrap serverBootstrap = new ServerBootstrap(); + + serverBootstrap + .group(bossGroup(), workerGroup()) + .channel(NioServerSocketChannel.class) + .childHandler(containerChannelInitializer); + + return serverBootstrap; + } + + @Bean + public ObjectMapper objectMapper() { + return new ObjectMapper(); + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/server/ContainerJSONHandler.java b/src/main/java/com/loafle/overflow/probe/container/server/ContainerJSONHandler.java new file mode 100644 index 0000000..7b0f88b --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/server/ContainerJSONHandler.java @@ -0,0 +1,68 @@ +package com.loafle.overflow.probe.container.server; + + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.loafle.overflow.probe.container.rpc.invoker.Invoker; +import com.loafle.overflow.probe.container.rpc.protocol.json.ServerRequest; +import com.loafle.overflow.probe.container.rpc.protocol.json.ServerResponse; +import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import java.io.IOException; + +@Component +@Qualifier("containerJSONHandler") +@ChannelHandler.Sharable +public class ContainerJSONHandler extends SimpleChannelInboundHandler { + @Autowired + private ObjectMapper objectMapper; + @Autowired + private Invoker invoker; + + @Override + protected void channelRead0(ChannelHandlerContext ctx, String s) throws Exception { + ServerRequest req = objectMapper.readValue(s, ServerRequest.class); + ServerResponse res = null; + try { + Object result = invoker.invoke(req.getMethod(), req.getParams()); + if (null != req.getId()) { + res = new ServerResponse(); + res.setId(req.getId()); + res.setResult(result); + } + + } catch (Exception e) { + if (null != req.getId()) { + res = new ServerResponse(); + res.setId(req.getId()); + res.setError(e.getMessage()); + } + } + + if (null != res) { + String json = objectMapper.writeValueAsString(res); + System.out.println(json); + ctx.writeAndFlush(json); + } + } + + @Override + public void channelActive(ChannelHandlerContext ctx) throws Exception { + + } + + + @Override + public void channelInactive(ChannelHandlerContext ctx) throws Exception { + ctx.close(); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + super.exceptionCaught(ctx, cause); + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/server/ContainerServer.java b/src/main/java/com/loafle/overflow/probe/container/server/ContainerServer.java new file mode 100644 index 0000000..0a822b2 --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/server/ContainerServer.java @@ -0,0 +1,34 @@ +package com.loafle.overflow.probe.container.server; + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.Channel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import java.net.InetSocketAddress; + +@Component +public class ContainerServer { + @Autowired + private ServerBootstrap serverBootstrap; + + @Autowired + private InetSocketAddress socketAddress; + + private Channel channel; + + public ContainerServer() { + + } + + public void start() throws Exception { + channel = serverBootstrap.bind(socketAddress).sync().channel().closeFuture().sync().channel(); + } + + @PreDestroy + public void stop() throws Exception { + channel.close(); + channel.parent().close(); + } +} diff --git a/src/main/java/com/loafle/overflow/probe/container/util/Primitives.java b/src/main/java/com/loafle/overflow/probe/container/util/Primitives.java new file mode 100644 index 0000000..22804ae --- /dev/null +++ b/src/main/java/com/loafle/overflow/probe/container/util/Primitives.java @@ -0,0 +1,44 @@ +package com.loafle.overflow.probe.container.util; + +import java.lang.reflect.Type; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +public final class Primitives { + /** A map from primitive types to their corresponding wrapper types. */ + private static final Map, Class> PRIMITIVE_TO_WRAPPER_TYPE; + /** A map from wrapper types to their corresponding primitive types. */ + private static final Map, Class> WRAPPER_TO_PRIMITIVE_TYPE; + + static { + Map, Class> primToWrap = new HashMap, Class>(16); + Map, Class> wrapToPrim = new HashMap, Class>(16); + + add(primToWrap, wrapToPrim, boolean.class, Boolean.class); + add(primToWrap, wrapToPrim, byte.class, Byte.class); + add(primToWrap, wrapToPrim, char.class, Character.class); + add(primToWrap, wrapToPrim, double.class, Double.class); + add(primToWrap, wrapToPrim, float.class, Float.class); + add(primToWrap, wrapToPrim, int.class, Integer.class); + add(primToWrap, wrapToPrim, long.class, Long.class); + add(primToWrap, wrapToPrim, short.class, Short.class); + add(primToWrap, wrapToPrim, void.class, Void.class); + + PRIMITIVE_TO_WRAPPER_TYPE = Collections.unmodifiableMap(primToWrap); + WRAPPER_TO_PRIMITIVE_TYPE = Collections.unmodifiableMap(wrapToPrim); + } + + private static void add(Map, Class> forward, + Map, Class> backward, Class key, Class value) { + forward.put(key, value); + backward.put(value, key); + } + /** + * Returns true if this type is a primitive. + */ + public static boolean isPrimitive(Type type) { + return PRIMITIVE_TO_WRAPPER_TYPE.containsKey(type); + } + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..e69de29 diff --git a/src/test/java/com/loafle/overflow/probe/container/ApplicationTests.java b/src/test/java/com/loafle/overflow/probe/container/ApplicationTests.java new file mode 100644 index 0000000..01b85a0 --- /dev/null +++ b/src/test/java/com/loafle/overflow/probe/container/ApplicationTests.java @@ -0,0 +1,25 @@ +package com.loafle.overflow.probe.container; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = Application.class) +public class ApplicationTests { + + @Autowired + private ApplicationContext applicationContext; + + @Test + public void testStart() throws Exception { + + } + +} + + + diff --git a/src/test/resources/_ b/src/test/resources/_ new file mode 100644 index 0000000..e69de29