commit c66ba751a7087201066271c6d7caa8dffc4d5da2 Author: wu ming <569287825@qq.com> Date: Wed Sep 7 17:13:59 2016 +0800 汇总平台java后台V1版 diff --git a/.classpath b/.classpath new file mode 100644 index 00000000..7e729e64 --- /dev/null +++ b/.classpath @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 00000000..ded1f1a4 --- /dev/null +++ b/.project @@ -0,0 +1,36 @@ + + + data_manager_backend + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 00000000..3a28de0c --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..d1ff3f7e --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//WebContent/WEB-INF/config/config.properties=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..f42de363 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 00000000..d5dd44d5 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000..6f8fb94f --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 00000000..3bd5d0a4 --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 00000000..05bd71b6 --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/WebContent/META-INF/MANIFEST.MF b/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 00000000..254272e1 --- /dev/null +++ b/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/WebContent/WEB-INF/config/config.properties b/WebContent/WEB-INF/config/config.properties new file mode 100644 index 00000000..56b7bdea --- /dev/null +++ b/WebContent/WEB-INF/config/config.properties @@ -0,0 +1,50 @@ +#============================================================================================================= +# MySQL +#============================================================================================================= +# 驱动程序 +jdbc.mysql.driver=com.mysql.jdbc.Driver +# 连接url +jdbc.mysql.url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true +# 用户名 +jdbc.mysql.username=root +# 密码 +jdbc.mysql.password=root + +#============================================================================================================= +# Oracle 连接配置 +#============================================================================================================= +# hui用户名 +gather-user-name=system +# 密码 +gather-user-password=oracle +# +gather-port=1521 +# +gather-service-name=orcl +#============================================================================================================= +# 数据库公共配置 +#============================================================================================================= +jdbc.initialSize=5 +jdbc.minIdle=5 +jdbc.maxIdle=20 +jdbc.maxActive=100 +jdbc.maxWait=100000 +jdbc.defaultAutoCommit=false +jdbc.removeAbandoned=true +jdbc.removeAbandonedTimeout=600 +jdbc.testWhileIdle=true +jdbc.timeBetweenEvictionRunsMillis=60000 +jdbc.numTestsPerEvictionRun=20 +jdbc.minEvictableIdleTimeMillis=300000 +#============================================================================================================== +# +#============================================================================================================== +table-suffix=_20152016 +extract-log-localtion=/home/log/ +gather-tablespace-name=TS_TTSSS +gather-tablespace-path= +gather-table-user-password= +kubeMasterUrl=http://192.168.0.116:8080/ +collect-user-name=system +collect-password=oracle +collect-service-name=orcl diff --git a/WebContent/WEB-INF/config/log4j-config.xml b/WebContent/WEB-INF/config/log4j-config.xml new file mode 100644 index 00000000..0a2755c5 --- /dev/null +++ b/WebContent/WEB-INF/config/log4j-config.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/config/mybatis-applicationConfig.xml b/WebContent/WEB-INF/config/mybatis-applicationConfig.xml new file mode 100644 index 00000000..02e5011b --- /dev/null +++ b/WebContent/WEB-INF/config/mybatis-applicationConfig.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/config/spring-applicationContext.xml b/WebContent/WEB-INF/config/spring-applicationContext.xml new file mode 100644 index 00000000..33ffe0a4 --- /dev/null +++ b/WebContent/WEB-INF/config/spring-applicationContext.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/config/springmvc-applicationContext.xml b/WebContent/WEB-INF/config/springmvc-applicationContext.xml new file mode 100644 index 00000000..2d119a71 --- /dev/null +++ b/WebContent/WEB-INF/config/springmvc-applicationContext.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + application/json;charset=UTF-8 + text/html;charset=UTF-8 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/lib/aspectjweaver-1.8.9.jar b/WebContent/WEB-INF/lib/aspectjweaver-1.8.9.jar new file mode 100644 index 00000000..87f5c8f3 Binary files /dev/null and b/WebContent/WEB-INF/lib/aspectjweaver-1.8.9.jar differ diff --git a/WebContent/WEB-INF/lib/automaton-1.11-8.jar b/WebContent/WEB-INF/lib/automaton-1.11-8.jar new file mode 100644 index 00000000..60f6ce01 Binary files /dev/null and b/WebContent/WEB-INF/lib/automaton-1.11-8.jar differ diff --git a/WebContent/WEB-INF/lib/commons-lang-2.6.jar b/WebContent/WEB-INF/lib/commons-lang-2.6.jar new file mode 100644 index 00000000..98467d3a Binary files /dev/null and b/WebContent/WEB-INF/lib/commons-lang-2.6.jar differ diff --git a/WebContent/WEB-INF/lib/commons-logging-1.2.jar b/WebContent/WEB-INF/lib/commons-logging-1.2.jar new file mode 100644 index 00000000..93a3b9f6 Binary files /dev/null and b/WebContent/WEB-INF/lib/commons-logging-1.2.jar differ diff --git a/WebContent/WEB-INF/lib/generex-0.0.4.jar b/WebContent/WEB-INF/lib/generex-0.0.4.jar new file mode 100644 index 00000000..e4e64f24 Binary files /dev/null and b/WebContent/WEB-INF/lib/generex-0.0.4.jar differ diff --git a/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar b/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar new file mode 100644 index 00000000..9d5fe16e Binary files /dev/null and b/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-annotations-2.7.0.jar b/WebContent/WEB-INF/lib/jackson-annotations-2.7.0.jar new file mode 100644 index 00000000..96fb17cf Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-annotations-2.7.0.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-annotations-2.7.3.jar b/WebContent/WEB-INF/lib/jackson-annotations-2.7.3.jar new file mode 100644 index 00000000..ced6d103 Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-annotations-2.7.3.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-core-2.7.0.jar b/WebContent/WEB-INF/lib/jackson-core-2.7.0.jar new file mode 100644 index 00000000..a37cc5e2 Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-core-2.7.0.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-core-2.7.3.jar b/WebContent/WEB-INF/lib/jackson-core-2.7.3.jar new file mode 100644 index 00000000..9b20cee6 Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-core-2.7.3.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-databind-2.7.0.jar b/WebContent/WEB-INF/lib/jackson-databind-2.7.0.jar new file mode 100644 index 00000000..e7609d96 Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-databind-2.7.0.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-databind-2.7.3.jar b/WebContent/WEB-INF/lib/jackson-databind-2.7.3.jar new file mode 100644 index 00000000..29d90afe Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-databind-2.7.3.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-dataformat-yaml-2.7.0.jar b/WebContent/WEB-INF/lib/jackson-dataformat-yaml-2.7.0.jar new file mode 100644 index 00000000..a9ad923f Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-dataformat-yaml-2.7.0.jar differ diff --git a/WebContent/WEB-INF/lib/jackson-module-jaxb-annotations-2.6.3.jar b/WebContent/WEB-INF/lib/jackson-module-jaxb-annotations-2.6.3.jar new file mode 100644 index 00000000..b9e3ea44 Binary files /dev/null and b/WebContent/WEB-INF/lib/jackson-module-jaxb-annotations-2.6.3.jar differ diff --git a/WebContent/WEB-INF/lib/jul-to-slf4j-1.7.13.jar b/WebContent/WEB-INF/lib/jul-to-slf4j-1.7.13.jar new file mode 100644 index 00000000..75426bd5 Binary files /dev/null and b/WebContent/WEB-INF/lib/jul-to-slf4j-1.7.13.jar differ diff --git a/WebContent/WEB-INF/lib/junit-3.8.1.jar b/WebContent/WEB-INF/lib/junit-3.8.1.jar new file mode 100644 index 00000000..674d71e8 Binary files /dev/null and b/WebContent/WEB-INF/lib/junit-3.8.1.jar differ diff --git a/WebContent/WEB-INF/lib/junit-4.12.jar b/WebContent/WEB-INF/lib/junit-4.12.jar new file mode 100644 index 00000000..3a7fc266 Binary files /dev/null and b/WebContent/WEB-INF/lib/junit-4.12.jar differ diff --git a/WebContent/WEB-INF/lib/kubernetes-client-1.3.74.jar b/WebContent/WEB-INF/lib/kubernetes-client-1.3.74.jar new file mode 100644 index 00000000..d6702eac Binary files /dev/null and b/WebContent/WEB-INF/lib/kubernetes-client-1.3.74.jar differ diff --git a/WebContent/WEB-INF/lib/kubernetes-model-1.0.43.jar b/WebContent/WEB-INF/lib/kubernetes-model-1.0.43.jar new file mode 100644 index 00000000..4b7ce158 Binary files /dev/null and b/WebContent/WEB-INF/lib/kubernetes-model-1.0.43.jar differ diff --git a/WebContent/WEB-INF/lib/log4j-1.2.17.jar b/WebContent/WEB-INF/lib/log4j-1.2.17.jar new file mode 100644 index 00000000..1d425cf7 Binary files /dev/null and b/WebContent/WEB-INF/lib/log4j-1.2.17.jar differ diff --git a/WebContent/WEB-INF/lib/logging-interceptor-2.7.2.jar b/WebContent/WEB-INF/lib/logging-interceptor-2.7.2.jar new file mode 100644 index 00000000..5d404500 Binary files /dev/null and b/WebContent/WEB-INF/lib/logging-interceptor-2.7.2.jar differ diff --git a/WebContent/WEB-INF/lib/mybatis-3.2.8.jar b/WebContent/WEB-INF/lib/mybatis-3.2.8.jar new file mode 100644 index 00000000..99cdd68b Binary files /dev/null and b/WebContent/WEB-INF/lib/mybatis-3.2.8.jar differ diff --git a/WebContent/WEB-INF/lib/mybatis-spring-1.2.1.jar b/WebContent/WEB-INF/lib/mybatis-spring-1.2.1.jar new file mode 100644 index 00000000..95c031f7 Binary files /dev/null and b/WebContent/WEB-INF/lib/mybatis-spring-1.2.1.jar differ diff --git a/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar new file mode 100644 index 00000000..be09493c Binary files /dev/null and b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar differ diff --git a/WebContent/WEB-INF/lib/okhttp-2.7.2.jar b/WebContent/WEB-INF/lib/okhttp-2.7.2.jar new file mode 100644 index 00000000..9150647d Binary files /dev/null and b/WebContent/WEB-INF/lib/okhttp-2.7.2.jar differ diff --git a/WebContent/WEB-INF/lib/okhttp-ws-2.7.2.jar b/WebContent/WEB-INF/lib/okhttp-ws-2.7.2.jar new file mode 100644 index 00000000..de4d0bfb Binary files /dev/null and b/WebContent/WEB-INF/lib/okhttp-ws-2.7.2.jar differ diff --git a/WebContent/WEB-INF/lib/okio-1.6.0.jar b/WebContent/WEB-INF/lib/okio-1.6.0.jar new file mode 100644 index 00000000..c87be599 Binary files /dev/null and b/WebContent/WEB-INF/lib/okio-1.6.0.jar differ diff --git a/WebContent/WEB-INF/lib/slf4j-api-1.7.13.jar b/WebContent/WEB-INF/lib/slf4j-api-1.7.13.jar new file mode 100644 index 00000000..f07884ee Binary files /dev/null and b/WebContent/WEB-INF/lib/slf4j-api-1.7.13.jar differ diff --git a/WebContent/WEB-INF/lib/snakeyaml-1.15.jar b/WebContent/WEB-INF/lib/snakeyaml-1.15.jar new file mode 100644 index 00000000..34084e33 Binary files /dev/null and b/WebContent/WEB-INF/lib/snakeyaml-1.15.jar differ diff --git a/WebContent/WEB-INF/lib/spring-aop-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-aop-4.3.1.RELEASE.jar new file mode 100644 index 00000000..d4903262 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-aop-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-aspects-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-aspects-4.3.1.RELEASE.jar new file mode 100644 index 00000000..b92dc264 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-aspects-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-beans-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-beans-4.3.1.RELEASE.jar new file mode 100644 index 00000000..062a39c9 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-beans-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-context-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-context-4.3.1.RELEASE.jar new file mode 100644 index 00000000..8c3f5f49 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-context-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-context-support-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-context-support-4.3.1.RELEASE.jar new file mode 100644 index 00000000..a0509dbb Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-context-support-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-core-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-core-4.3.1.RELEASE.jar new file mode 100644 index 00000000..fe9bd597 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-core-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-expression-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-expression-4.3.1.RELEASE.jar new file mode 100644 index 00000000..67076961 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-expression-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar b/WebContent/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar new file mode 100644 index 00000000..5fda62e8 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-jdbc-4.2.5.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-oxm-3.0.5.RELEASE.jar b/WebContent/WEB-INF/lib/spring-oxm-3.0.5.RELEASE.jar new file mode 100644 index 00000000..1688cf74 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-oxm-3.0.5.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-test-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-test-4.3.1.RELEASE.jar new file mode 100644 index 00000000..dba50419 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-test-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar b/WebContent/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar new file mode 100644 index 00000000..47542e4e Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-tx-4.2.5.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-web-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-web-4.3.1.RELEASE.jar new file mode 100644 index 00000000..26273ec9 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-web-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/spring-webmvc-4.3.1.RELEASE.jar b/WebContent/WEB-INF/lib/spring-webmvc-4.3.1.RELEASE.jar new file mode 100644 index 00000000..1bec7712 Binary files /dev/null and b/WebContent/WEB-INF/lib/spring-webmvc-4.3.1.RELEASE.jar differ diff --git a/WebContent/WEB-INF/lib/validation-api-1.1.0.Final.jar b/WebContent/WEB-INF/lib/validation-api-1.1.0.Final.jar new file mode 100644 index 00000000..de854038 Binary files /dev/null and b/WebContent/WEB-INF/lib/validation-api-1.1.0.Final.jar differ diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml new file mode 100644 index 00000000..99cc03de --- /dev/null +++ b/WebContent/WEB-INF/web.xml @@ -0,0 +1,65 @@ + + + javaBackend + + /index.html + + + + CharacterEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + + CharacterEncodingFilter + /* + + + + contextConfigLocation + WEB-INF/config/spring-applicationContext.xml + + + org.springframework.web.context.ContextLoaderListener + + + + com.platform.utils.ConfigsLoader + + + + + springmvc + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + /WEB-INF/config/springmvc-applicationContext.xml + + 1 + true + + + springmvc + /* + + + + + log4jConfigLocation + /WEB-INF/config/log4j-config.xml + + + org.springframework.web.util.Log4jConfigListener + + + + + org.springframework.web.util.IntrospectorCleanupListener + + \ No newline at end of file diff --git a/build/classes/com/dao/mapper/data-detaisl-mapper.xml b/build/classes/com/dao/mapper/data-detaisl-mapper.xml new file mode 100644 index 00000000..52b98767 --- /dev/null +++ b/build/classes/com/dao/mapper/data-detaisl-mapper.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + and data_details.data_type=#{PagerOptions.dataType} + + + and + data_details.submitted_batch=#{PagerOptions.submittedBatch} + + + and data_details.city_name=#{PagerOptions.cityName} + + + and + data_details.district_name=#{PagerOptions.districtName} + + + and data_details.data_version=#{PagerOptions.dataVersion} + + + and data_details=#{PagerOptions.systemName} + + + and data_details.data_year=#{PagerOptions.dataYear} + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/classes/com/platform/controller/DataModelController.class b/build/classes/com/platform/controller/DataModelController.class new file mode 100644 index 00000000..837dcfde Binary files /dev/null and b/build/classes/com/platform/controller/DataModelController.class differ diff --git a/build/classes/com/platform/controller/DefaultController.class b/build/classes/com/platform/controller/DefaultController.class new file mode 100644 index 00000000..91940503 Binary files /dev/null and b/build/classes/com/platform/controller/DefaultController.class differ diff --git a/build/classes/com/platform/dao/DataInfoDao.class b/build/classes/com/platform/dao/DataInfoDao.class new file mode 100644 index 00000000..b2c3bfed Binary files /dev/null and b/build/classes/com/platform/dao/DataInfoDao.class differ diff --git a/build/classes/com/platform/dao/EncodeInfoDao.class b/build/classes/com/platform/dao/EncodeInfoDao.class new file mode 100644 index 00000000..f6b44c7b Binary files /dev/null and b/build/classes/com/platform/dao/EncodeInfoDao.class differ diff --git a/build/classes/com/platform/entities/BasedType.class b/build/classes/com/platform/entities/BasedType.class new file mode 100644 index 00000000..30ba1020 Binary files /dev/null and b/build/classes/com/platform/entities/BasedType.class differ diff --git a/build/classes/com/platform/entities/DataInfoEntity.class b/build/classes/com/platform/entities/DataInfoEntity.class new file mode 100644 index 00000000..0bc0b835 Binary files /dev/null and b/build/classes/com/platform/entities/DataInfoEntity.class differ diff --git a/build/classes/com/platform/entities/EncodedInfoEntity.class b/build/classes/com/platform/entities/EncodedInfoEntity.class new file mode 100644 index 00000000..ca2439bd Binary files /dev/null and b/build/classes/com/platform/entities/EncodedInfoEntity.class differ diff --git a/build/classes/com/platform/entities/FolderNode.class b/build/classes/com/platform/entities/FolderNode.class new file mode 100644 index 00000000..27432bbb Binary files /dev/null and b/build/classes/com/platform/entities/FolderNode.class differ diff --git a/build/classes/com/platform/entities/OracleConnectorParams.class b/build/classes/com/platform/entities/OracleConnectorParams.class new file mode 100644 index 00000000..2d57408c Binary files /dev/null and b/build/classes/com/platform/entities/OracleConnectorParams.class differ diff --git a/build/classes/com/platform/entities/PagerOptions.class b/build/classes/com/platform/entities/PagerOptions.class new file mode 100644 index 00000000..0f0a2176 Binary files /dev/null and b/build/classes/com/platform/entities/PagerOptions.class differ diff --git a/build/classes/com/platform/entities/SimpleConfigParamsBean.class b/build/classes/com/platform/entities/SimpleConfigParamsBean.class new file mode 100644 index 00000000..8e274e5f Binary files /dev/null and b/build/classes/com/platform/entities/SimpleConfigParamsBean.class differ diff --git a/build/classes/com/platform/kubernetes/SimpleKubeClient.class b/build/classes/com/platform/kubernetes/SimpleKubeClient.class new file mode 100644 index 00000000..78331ee3 Binary files /dev/null and b/build/classes/com/platform/kubernetes/SimpleKubeClient.class differ diff --git a/build/classes/com/platform/oracle/OracleConnector.class b/build/classes/com/platform/oracle/OracleConnector.class new file mode 100644 index 00000000..04a516c4 Binary files /dev/null and b/build/classes/com/platform/oracle/OracleConnector.class differ diff --git a/build/classes/com/platform/service/DataInfoService.class b/build/classes/com/platform/service/DataInfoService.class new file mode 100644 index 00000000..95758eba Binary files /dev/null and b/build/classes/com/platform/service/DataInfoService.class differ diff --git a/build/classes/com/platform/service/DataInfoServiceImp.class b/build/classes/com/platform/service/DataInfoServiceImp.class new file mode 100644 index 00000000..2b8ecde7 Binary files /dev/null and b/build/classes/com/platform/service/DataInfoServiceImp.class differ diff --git a/build/classes/com/platform/service/EncodeInfoService.class b/build/classes/com/platform/service/EncodeInfoService.class new file mode 100644 index 00000000..4e7ea229 Binary files /dev/null and b/build/classes/com/platform/service/EncodeInfoService.class differ diff --git a/build/classes/com/platform/service/EncodeInfoServiceImpl.class b/build/classes/com/platform/service/EncodeInfoServiceImpl.class new file mode 100644 index 00000000..56590e83 Binary files /dev/null and b/build/classes/com/platform/service/EncodeInfoServiceImpl.class differ diff --git a/build/classes/com/platform/service/OracleExtractHelper.class b/build/classes/com/platform/service/OracleExtractHelper.class new file mode 100644 index 00000000..cd929b15 Binary files /dev/null and b/build/classes/com/platform/service/OracleExtractHelper.class differ diff --git a/build/classes/com/platform/service/OracleExtractService.class b/build/classes/com/platform/service/OracleExtractService.class new file mode 100644 index 00000000..90711c2e Binary files /dev/null and b/build/classes/com/platform/service/OracleExtractService.class differ diff --git a/build/classes/com/platform/service/OracleStatusService$connectTask.class b/build/classes/com/platform/service/OracleStatusService$connectTask.class new file mode 100644 index 00000000..84eef078 Binary files /dev/null and b/build/classes/com/platform/service/OracleStatusService$connectTask.class differ diff --git a/build/classes/com/platform/service/OracleStatusService.class b/build/classes/com/platform/service/OracleStatusService.class new file mode 100644 index 00000000..b61344b5 Binary files /dev/null and b/build/classes/com/platform/service/OracleStatusService.class differ diff --git a/build/classes/com/platform/service/SimplePropertyReader.class b/build/classes/com/platform/service/SimplePropertyReader.class new file mode 100644 index 00000000..d54c4934 Binary files /dev/null and b/build/classes/com/platform/service/SimplePropertyReader.class differ diff --git a/build/classes/com/platform/test/SMBasedTest.class b/build/classes/com/platform/test/SMBasedTest.class new file mode 100644 index 00000000..e64ea7a7 Binary files /dev/null and b/build/classes/com/platform/test/SMBasedTest.class differ diff --git a/build/classes/com/platform/test/TestController.class b/build/classes/com/platform/test/TestController.class new file mode 100644 index 00000000..3abc9c41 Binary files /dev/null and b/build/classes/com/platform/test/TestController.class differ diff --git a/build/classes/com/platform/test/TestEncodeInfoDao.class b/build/classes/com/platform/test/TestEncodeInfoDao.class new file mode 100644 index 00000000..bdfb87d9 Binary files /dev/null and b/build/classes/com/platform/test/TestEncodeInfoDao.class differ diff --git a/build/classes/com/platform/test/TestEncodeService.class b/build/classes/com/platform/test/TestEncodeService.class new file mode 100644 index 00000000..c4656f12 Binary files /dev/null and b/build/classes/com/platform/test/TestEncodeService.class differ diff --git a/build/classes/com/platform/test/User.class b/build/classes/com/platform/test/User.class new file mode 100644 index 00000000..a38adbfb Binary files /dev/null and b/build/classes/com/platform/test/User.class differ diff --git a/build/classes/com/platform/test/testSystemInfoDao.class b/build/classes/com/platform/test/testSystemInfoDao.class new file mode 100644 index 00000000..f86a419c Binary files /dev/null and b/build/classes/com/platform/test/testSystemInfoDao.class differ diff --git a/build/classes/com/platform/utils/ConfigLoder.class b/build/classes/com/platform/utils/ConfigLoder.class new file mode 100644 index 00000000..9c600c3d Binary files /dev/null and b/build/classes/com/platform/utils/ConfigLoder.class differ diff --git a/build/classes/com/platform/utils/ConfigPropertyReader.class b/build/classes/com/platform/utils/ConfigPropertyReader.class new file mode 100644 index 00000000..81d2b1c3 Binary files /dev/null and b/build/classes/com/platform/utils/ConfigPropertyReader.class differ diff --git a/build/classes/com/platform/utils/Configs.class b/build/classes/com/platform/utils/Configs.class new file mode 100644 index 00000000..6bc46bf3 Binary files /dev/null and b/build/classes/com/platform/utils/Configs.class differ diff --git a/build/classes/com/platform/utils/ConfigsLoader.class b/build/classes/com/platform/utils/ConfigsLoader.class new file mode 100644 index 00000000..c37ec21a Binary files /dev/null and b/build/classes/com/platform/utils/ConfigsLoader.class differ diff --git a/build/classes/com/platform/utils/FileOperateHelper.class b/build/classes/com/platform/utils/FileOperateHelper.class new file mode 100644 index 00000000..40db4e3d Binary files /dev/null and b/build/classes/com/platform/utils/FileOperateHelper.class differ diff --git a/build/classes/com/platform/utils/UtilsHelper.class b/build/classes/com/platform/utils/UtilsHelper.class new file mode 100644 index 00000000..e06cff03 Binary files /dev/null and b/build/classes/com/platform/utils/UtilsHelper.class differ diff --git a/build/classes/spring-applicationContext-test.xml b/build/classes/spring-applicationContext-test.xml new file mode 100644 index 00000000..27b1248b --- /dev/null +++ b/build/classes/spring-applicationContext-test.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/dao/mapper/data-detaisl-mapper.xml b/src/com/dao/mapper/data-detaisl-mapper.xml new file mode 100644 index 00000000..52b98767 --- /dev/null +++ b/src/com/dao/mapper/data-detaisl-mapper.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + and data_details.data_type=#{PagerOptions.dataType} + + + and + data_details.submitted_batch=#{PagerOptions.submittedBatch} + + + and data_details.city_name=#{PagerOptions.cityName} + + + and + data_details.district_name=#{PagerOptions.districtName} + + + and data_details.data_version=#{PagerOptions.dataVersion} + + + and data_details=#{PagerOptions.systemName} + + + and data_details.data_year=#{PagerOptions.dataYear} + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/com/platform/controller/DataModelController.java b/src/com/platform/controller/DataModelController.java new file mode 100644 index 00000000..eb29d94f --- /dev/null +++ b/src/com/platform/controller/DataModelController.java @@ -0,0 +1,99 @@ +package com.platform.controller; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringUtils; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.platform.entities.PagerOptions; +import com.platform.service.DataInfoService; +import com.platform.service.OracleStatusService; +import com.platform.utils.Configs; +import com.platform.utils.UtilsHelper; + +@Controller +public class DataModelController { + @Resource(name = "dataInfoService") + private DataInfoService dfs; + + public void setDfsImp(DataInfoService dfs) { + this.dfs = dfs; + } + + @RequestMapping("/data.json") + @ResponseBody + public ModelMap getAllDataToJson(HttpServletRequest res, + HttpServletResponse req) { + Map paramMap = res.getParameterMap(); + Set keySet = paramMap.keySet(); + Map params = new HashMap(); + StringBuffer sb = new StringBuffer().append("ǰ:{"); + for (String str : keySet) { + String value = paramMap.get(str)[0]; + if (StringUtils.isNotEmpty(value)){ + params.put(str, value); + sb.append(str).append(":").append(value).append(","); + }else { + sb.append(str).append(":").append("null").append(","); + } + } + Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1) + .append("}").toString()); + PagerOptions pagerOptions = (PagerOptions) UtilsHelper + .newObjAndSetAttrsByClass(PagerOptions.class, params); + + return dfs.getPagerTableData(pagerOptions); + } + + @RequestMapping("/delete/data") + public void deleteData(HttpServletRequest res, HttpServletResponse req) { + Map paramMap = res.getParameterMap(); + String[] data = paramMap.get("data"); + dfs.deleteData(data); + } + + @RequestMapping("/connectOracle") + public void connectOracle(HttpServletRequest res, HttpServletResponse req) { + Map paramMap = res.getParameterMap(); + String[] oraclesName = paramMap.get("oracleName"); + if (oraclesName != null) + for (String rcName : oraclesName) { + Configs.CONSOLE_LOGGER.info("ִк̨ݿ\t" + rcName); + new OracleStatusService().connectToOracle(rcName); + } + } + + @RequestMapping("/cancelOracleConection") + public void cancelOracleConnection(HttpServletRequest res, + HttpServletResponse req) { + Map paramMap = res.getParameterMap(); + String[] oraclesName = paramMap.get("oracleName"); + String operate = paramMap.get("operation")[0]; + if (null != oraclesName) { + for (String rcName : oraclesName) { + Configs.CONSOLE_LOGGER.info("ȡ̨ݿ:\t" + rcName); + new OracleStatusService().cancelToOracle(rcName, operate); + } + } + } + + @RequestMapping("/extractOracleData") + public void extractOracleData(HttpServletRequest res, + HttpServletResponse req) { + + } + + @RequestMapping("/getFolder") + public void getFolder(HttpServletRequest res, HttpServletResponse req) { + System.out.println("ooooooooo"); + } +} diff --git a/src/com/platform/controller/DefaultController.java b/src/com/platform/controller/DefaultController.java new file mode 100644 index 00000000..4722c5d6 --- /dev/null +++ b/src/com/platform/controller/DefaultController.java @@ -0,0 +1,28 @@ +package com.platform.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import com.platform.utils.Configs; + +@Controller +public class DefaultController { + @RequestMapping("/") + public ModelAndView defaultHandler(HttpServletRequest req, HttpServletResponse res){ + //ƥ + System.out.println("index"); + return new ModelAndView("index"); + + } + + @RequestMapping("/test") + public void test(HttpServletRequest req, HttpServletResponse res){ + //System.out.println(Class.class.getClass().getResource("/").getPath()); + System.out.println(Configs.EXTRACT_LOG_LOCALTION); + } + +} diff --git a/src/com/platform/dao/DataInfoDao.java b/src/com/platform/dao/DataInfoDao.java new file mode 100644 index 00000000..f42b9f8f --- /dev/null +++ b/src/com/platform/dao/DataInfoDao.java @@ -0,0 +1,20 @@ +package com.platform.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; + +import com.platform.entities.DataInfoEntity; +import com.platform.entities.PagerOptions; + +public interface DataInfoDao { + + int getLimitedDataCount(@Param("PagerOptions")PagerOptions pagerOptions); + + int getLimitedBeginId(@Param("PagerOptions")PagerOptions pagerOptions); + + List getLimitedDataInfoEntities(@Param("PagerOptions")PagerOptions pagerOptions); + + List getIdIsExist(int parseInt); + +} diff --git a/src/com/platform/dao/EncodeInfoDao.java b/src/com/platform/dao/EncodeInfoDao.java new file mode 100644 index 00000000..69bfd819 --- /dev/null +++ b/src/com/platform/dao/EncodeInfoDao.java @@ -0,0 +1,99 @@ +package com.platform.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Insert; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.springframework.stereotype.Repository; + +import com.platform.entities.EncodedInfoEntity; + +/** + * ݿ: ʵɾġ + * + * @author wuming + * + */ +@Repository(value = "encodeInfoDao") +public interface EncodeInfoDao { + + /** + * ȡѯµʵ壨/ϵͳϢ + * + * @param tableName + * ѯı + * @return ʵϢ:ƺͱ + */ + @Select("SELECT code, name FROM ${tableName}") + public List getAllEntityInfo( + @Param("tableName") String tableName); + + /** + * ʵ壨/ϵͳƲѯ + * + * @param code + * ʵ + * @param tableName + * ѯı + * @return ѯֻһ¼ + */ + @Select("SELECT name FROM ${tableName} WHERE code = #{code}") + public String getEncodeNameByCode(@Param("code") String code, + @Param("tableName") String tableName); + + /** + * ʵ壨/ϵͳıѯ + * + * @param name + * ʵ + * @param tableName + * ѯı + * @return Ʋѯܻж + */ + @Select("SELECT code FROM ${tableName} WHERE name = #{name}") + public List getEncodeCodeByName(@Param("name") String name, + @Param("tableName") String tableName); + + /** + * ʵ壨/ϵͳı룬ʵ + * + * @param code + * ϵͳ + * @param tableName + * ѯı + * @return + */ + @Update("UPDATE ${tableName} SET name = #{name} WHERE code = #{code}") + public int updateEncodeNameByCode(@Param("code") String code, + @Param("name") String name, @Param("tableName") String tableName); + + /** + * вʵ壨/ϵͳϢ + * + * @param efe + * ʵϢ + * @param tableName + * + * @return + */ + @Insert("INSERT INTO ${tableName} (code, name) VALUES (#{efe.code}, #{efe.name})") + public int insertEncodeEntity(@Param("efe") EncodedInfoEntity efe, + @Param("tableName") String tableName); + + /** + * ɾеʵ壨/ϵͳ + * + * @param code + * ʵı + * @param tableName + * + * @return + */ + @Delete("DELETE FROM ${tableName} WHERE code = #{code}") + public int deleteEncodeByCode(@Param("code") String code, + @Param("tableName") String tableName); + +} \ No newline at end of file diff --git a/src/com/platform/entities/BasedType.java b/src/com/platform/entities/BasedType.java new file mode 100644 index 00000000..d133a0eb --- /dev/null +++ b/src/com/platform/entities/BasedType.java @@ -0,0 +1,48 @@ +package com.platform.entities; + +import java.util.Date; + +public enum BasedType { + + STRING("java.lang.String", String.class), INTEGER("java.lang.Integer", + Integer.class), SHORT("java.lang.Short", Short.class), LONG( + "java.lang.Long", Long.class), DATE("java.util.Date", Date.class); + + private String type; + private Class clazz; + + private BasedType(String type, Class clazz) { + this.type = type; + this.clazz = clazz; + } + + public static Class getTypeClass(String type) { + for (BasedType bt : BasedType.values()) { + if (bt.equals(type)) + return bt.clazz; + } + return null; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + @Override + public String toString() { + return this.type; + } + +} diff --git a/src/com/platform/entities/DataInfoEntity.java b/src/com/platform/entities/DataInfoEntity.java new file mode 100644 index 00000000..d3581c89 --- /dev/null +++ b/src/com/platform/entities/DataInfoEntity.java @@ -0,0 +1,186 @@ +package com.platform.entities; + +/** + * Ϣʵ + * + * @author wuming + * + */ +public class DataInfoEntity { + private int id; + private String regionalismCode; // + private String cityName; // + private String districtName; // + private int systemCode; // ϵͳ + private String systemName; // ϵͳ + private String dataType; // ͣ\籣\... + private int dataVersion; // ݰ汾 + private String submittedBatch; // ϱ + private String dataPath; // · + private String collectingTime; // ɼʱ + private String collectorContacts; // ɼ˵ϵ + private String charset; // ݵַ + private String collectorName; // ɼ + private String year; // + + public DataInfoEntity() { + } + + public DataInfoEntity(int id, String regionalismCode, String cityName, + String districtName, int systemCode, String systemName, + String dataType, int dataVersion, String submittedBatch, + String dataPath, String collectingTime, String collectorContacts, + String charset, String collectorName, String year) { + super(); + this.id = id; + this.regionalismCode = regionalismCode; + this.cityName = cityName; + this.districtName = districtName; + this.systemCode = systemCode; + this.systemName = systemName; + this.dataType = dataType; + this.dataVersion = dataVersion; + this.submittedBatch = submittedBatch; + this.dataPath = dataPath; + this.collectingTime = collectingTime; + this.collectorContacts = collectorContacts; + this.charset = charset; + this.collectorName = collectorName; + this.year = year; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getRegionalismCode() { + return regionalismCode; + } + + public void setRegionalismCode(String regionalismCode) { + this.regionalismCode = regionalismCode; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public String getDistrictName() { + return districtName; + } + + public void setDistrictName(String districtName) { + this.districtName = districtName; + } + + public int getSystemCode() { + return systemCode; + } + + public void setSystemCode(int systemCode) { + this.systemCode = systemCode; + } + + public String getSystemName() { + return systemName; + } + + public void setSystemName(String systemName) { + this.systemName = systemName; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public int getDataVersion() { + return dataVersion; + } + + public void setDataVersion(int dataVersion) { + this.dataVersion = dataVersion; + } + + public String getSubmittedBatch() { + return submittedBatch; + } + + public void setSubmittedBatch(String submittedBatch) { + this.submittedBatch = submittedBatch; + } + + public String getDataPath() { + return dataPath; + } + + public void setDataPath(String dataPath) { + this.dataPath = dataPath; + } + + public String getCollectingTime() { + return collectingTime; + } + + public void setCollectingTime(String collectingTime) { + this.collectingTime = collectingTime; + } + + public String getCollectorContacts() { + return collectorContacts; + } + + public void setCollectorContacts(String collectorContacts) { + this.collectorContacts = collectorContacts; + } + + public String getCharset() { + return charset; + } + + public void setCharset(String charset) { + this.charset = charset; + } + + public String getCollectorName() { + return collectorName; + } + + public void setCollectorName(String collectorName) { + this.collectorName = collectorName; + } + + public String getYear() { + return year; + } + + public void setYear(String year) { + this.year = year; + } + + @Override + public String toString() { + return "id=" + this.id + " ,regionalismCode=" + this.regionalismCode + + " ,cityName=" + this.cityName + " ,districtName=" + + this.districtName + " ,systemCode=" + this.systemCode + + " ,systemName" + this.systemName + " ,dataType=" + + this.dataType + " ,dataVersion=" + this.dataVersion + + " ,submittedBatch=" + this.submittedBatch + " ,dataPath=" + + this.dataPath + " ,collectingTime=" + this.collectingTime + + " ,collectorContacts=" + this.collectorContacts + + " ,charset=" + this.charset + " ,collectorName=" + + this.collectorName + " ,year=" + this.year + ""; + } + +} diff --git a/src/com/platform/entities/EncodedInfoEntity.java b/src/com/platform/entities/EncodedInfoEntity.java new file mode 100644 index 00000000..fa6b934c --- /dev/null +++ b/src/com/platform/entities/EncodedInfoEntity.java @@ -0,0 +1,41 @@ +package com.platform.entities; + +/** + * + * Ϣʵ + * /ϵͳϢ + * @author wuming + * + */ +public class EncodedInfoEntity { + private String name; // + private String code; // + + public EncodedInfoEntity() {} + + public EncodedInfoEntity(String name, String code) { + this.name = name; + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + @Override + public String toString(){ + return "code=" + this.code + ", name=" + this.name; + } +} diff --git a/src/com/platform/entities/FolderNode.java b/src/com/platform/entities/FolderNode.java new file mode 100644 index 00000000..84c2057a --- /dev/null +++ b/src/com/platform/entities/FolderNode.java @@ -0,0 +1,34 @@ +package com.platform.entities; + +import java.util.List; + +public class FolderNode { + private String name; + private String path; + private List childNodes; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public List getChildNodes() { + return childNodes; + } + + public void setChildNodes(List childNodes) { + this.childNodes = childNodes; + } + +} diff --git a/src/com/platform/entities/OracleConnectorParams.java b/src/com/platform/entities/OracleConnectorParams.java new file mode 100644 index 00000000..b265f407 --- /dev/null +++ b/src/com/platform/entities/OracleConnectorParams.java @@ -0,0 +1,89 @@ +package com.platform.entities; + +import java.util.Properties; + +import com.platform.utils.ConfigPropertyReader; +import com.platform.utils.Configs; + +public class OracleConnectorParams { + private String port; + private String ip; + private String name; + private String user; + private String password; + private String database; + + public OracleConnectorParams(String port, String ip, String name) { + maybeInit(); + this.port = port; + this.ip = ip; + this.name = name; + } + + public OracleConnectorParams(String port, String ip, String name, + String user, String password, String database) { + this.port = port; + this.ip = ip; + this.name = name; + this.user = user; + this.password = password; + this.database = database; + } + + private void maybeInit() { + Properties properties = ConfigPropertyReader.Builder( + Configs.CONFIG_LOCALTION).getProperties(); + this.user = properties.getProperty("collect-user"); + this.password = properties.getProperty("collect-password"); + this.database = properties.getProperty("collect-database"); + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getDatabase() { + return database; + } + + public void setDatabase(String database) { + this.database = database; + } + +} diff --git a/src/com/platform/entities/PagerOptions.java b/src/com/platform/entities/PagerOptions.java new file mode 100644 index 00000000..046a90cd --- /dev/null +++ b/src/com/platform/entities/PagerOptions.java @@ -0,0 +1,124 @@ +package com.platform.entities; + +public class PagerOptions { + private Integer currentPageNum; //ǰҳ + + private String dataType; // + + private String submittedBatch; // + + private String cityName; // + + private String districtName; // + + private Integer dataVersion; //ݰ汾 + + private String systemName; //ϵͳ + + private String dataYear; // + + private Integer limit; //һβѯؼ¼ + + private Integer offset; // ѯƫʼid + + private Integer totalLimit; //ǰҳǰж + + private Integer priorTableSize; //ǰһβһҳʾ + + public Integer getCurrentPageNum() { + return currentPageNum; + } + + public void setCurrentPageNum(Integer currentPageNum) { + this.currentPageNum = currentPageNum; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public String getSubmittedBatch() { + return submittedBatch; + } + + public void setSubmittedBatch(String submittedBatch) { + this.submittedBatch = submittedBatch; + } + + public String getCityName() { + return cityName; + } + + public void setCityName(String cityName) { + this.cityName = cityName; + } + + public String getDistrictName() { + return districtName; + } + + public void setDistrictName(String districtName) { + this.districtName = districtName; + } + + public Integer getDataVersion() { + return dataVersion; + } + + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + public String getSystemName() { + return systemName; + } + + public void setSystemName(String systemName) { + this.systemName = systemName; + } + + public String getDataYear() { + return dataYear; + } + + public void setDataYear(String dataYear) { + this.dataYear = dataYear; + } + + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getOffset() { + return offset; + } + + public void setOffset(Integer offset) { + this.offset = offset; + } + + public Integer getTotalLimit() { + return totalLimit; + } + + public void setTotalLimit(Integer totalLimit) { + this.totalLimit = totalLimit; + } + + public Integer getPriorTableSize() { + return priorTableSize; + } + + public void setPriorTableSize(Integer priorTableSize) { + this.priorTableSize = priorTableSize; + } + +} diff --git a/src/com/platform/entities/SimpleConfigParamsBean.java b/src/com/platform/entities/SimpleConfigParamsBean.java new file mode 100644 index 00000000..520d5ee7 --- /dev/null +++ b/src/com/platform/entities/SimpleConfigParamsBean.java @@ -0,0 +1,44 @@ +package com.platform.entities; + +public class SimpleConfigParamsBean { + private String masterUrl; + + private String oracleUserName; + + private String oraclePassword; + + private String oracleDBName; + + public String getMasterUrl() { + return masterUrl; + } + + public void setMasterUrl(String masterUrl) { + this.masterUrl = masterUrl; + } + + public String getOracleUserName() { + return oracleUserName; + } + + public void setOracleUserName(String oracleUserName) { + this.oracleUserName = oracleUserName; + } + + public String getOraclePassword() { + return oraclePassword; + } + + public void setOraclePassword(String oraclePassword) { + this.oraclePassword = oraclePassword; + } + + public String getOracleDBName() { + return oracleDBName; + } + + public void setOracleDBName(String oracleDBName) { + this.oracleDBName = oracleDBName; + } + +} diff --git a/src/com/platform/kubernetes/SimpleKubeClient.java b/src/com/platform/kubernetes/SimpleKubeClient.java new file mode 100644 index 00000000..743623f2 --- /dev/null +++ b/src/com/platform/kubernetes/SimpleKubeClient.java @@ -0,0 +1,154 @@ +package com.platform.kubernetes; + +import io.fabric8.kubernetes.api.model.Container; +import io.fabric8.kubernetes.api.model.ContainerPort; +import io.fabric8.kubernetes.api.model.Pod; +import io.fabric8.kubernetes.api.model.ReplicationController; +import io.fabric8.kubernetes.client.Config; +import io.fabric8.kubernetes.client.ConfigBuilder; +import io.fabric8.kubernetes.client.DefaultKubernetesClient; +import io.fabric8.kubernetes.client.KubernetesClient; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.platform.utils.Configs; +import com.platform.utils.UtilsHelper; + +public class SimpleKubeClient { + private KubernetesClient client; + private final static String DEFAULT_NAMESPACE = "default"; + + public SimpleKubeClient() { + this.client = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL); + } + + public SimpleKubeClient(String masterUrl) { + this.client = new DefaultKubernetesClient(masterUrl); + } + + public SimpleKubeClient(Config config) { + Config cf = config; + if (null == config) { + cf = new ConfigBuilder().withMasterUrl(Configs.KUBE_MASTER_URL).build(); + } + this.client = new DefaultKubernetesClient(cf); + } + + public void updateOrAddReplicasLabelById(String namespace, + String resourceId, String key, String value) { + KubernetesClient kubeClient = client; + if (checkClientNull()) + kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL); + kubeClient.replicationControllers().inNamespace(namespace) + .withName(resourceId).edit().editMetadata() + .addToLabels(key, value).endMetadata().done(); + } + + public void updateOrAddReplicasLabelByEntity(String namespace, + ReplicationController replicas, String key, String value) { + updateOrAddReplicasLabelById(namespace, replicas.getMetadata() + .getName(), key, value); + } + + public void updateOrAddReplicasLabelById(String resourceId, String key, + String value) { + updateOrAddReplicasLabelById(DEFAULT_NAMESPACE, resourceId, key, value); + } + + public void updateOrAddReplicasLabelByEntity( + ReplicationController replicas, String key, String value) { + updateOrAddReplicasLabelByEntity(DEFAULT_NAMESPACE, replicas, key, + value); + } + + @SuppressWarnings("resource") + public ReplicationController getReplicationController(String namespace, + String replicasName) { + KubernetesClient kubeClient = client; + if (checkClientNull()) + kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL); + return kubeClient.replicationControllers().inNamespace(namespace) + .withName(replicasName).get(); + } + + public ReplicationController getReplicationController(String replicasName) { + return getReplicationController(DEFAULT_NAMESPACE, replicasName); + } + + @SuppressWarnings("resource") + public List getPodsForApplicaList(ReplicationController rc) { + Map selector = rc.getSpec().getSelector(); + KubernetesClient kubeClient = client; + if (checkClientNull()) + kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL); + List podList = kubeClient.pods() + .inNamespace(rc.getMetadata().getNamespace()).list().getItems(); + return getPods(podList, selector); + } + + private boolean checkClientNull() { + return null == client; + } + + public List getPods(List pods, Map selector) { + List result = new ArrayList(); + for (int i = 0; i < pods.size(); i++) + if (UtilsHelper.isSubMap(getLabels(pods.get(i)), selector)) + result.add(pods.get(i)); + return result; + } + + private Map getLabels(Pod pod) { + return pod.getMetadata().getLabels(); + } + + public KubernetesClient getClient() { + // TODO Auto-generated method stub + return client; + } + + public int getPodContainerport(Pod pod) { + int port = Configs.ORACLE_DEFAULT_PORT; + List containers = pod.getSpec().getContainers(); + if (null != containers && containers.size() > 0) { + List ports = containers.get(0).getPorts(); + if (null != ports && ports.size() > 0) + port = ports.get(0).getHostPort(); + } + return port; + } + + public String getPodHostIp(Pod pod) { + return pod.getSpec().getNodeName(); + } + + @SuppressWarnings("resource") + public Map getReplicationControllerList( + String namespace) { + KubernetesClient kubeClient = client; + Map rcMap = new HashMap(); + if (checkClientNull()) + kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL); + List replicasList = kubeClient + .replicationControllers().list().getItems(); + if (replicasList != null) + for (int i = 0; i < replicasList.size(); i++) { + ReplicationController rController = replicasList.get(i); + rcMap.put(rController.getMetadata().getName(), rController); + } + return rcMap; + } + + public Map getReplicationControllerList() { + return getReplicationControllerList(DEFAULT_NAMESPACE); + } + + public void close() { + if (!checkClientNull()) + client.close(); + } + +} diff --git a/src/com/platform/oracle/OracleConnector.java b/src/com/platform/oracle/OracleConnector.java new file mode 100644 index 00000000..28d24135 --- /dev/null +++ b/src/com/platform/oracle/OracleConnector.java @@ -0,0 +1,79 @@ +package com.platform.oracle; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import javax.validation.constraints.Pattern.Flag; + +import com.platform.utils.Configs; + +public class OracleConnector { + static { + try { + Class.forName("oracle.jdbc.driver.OracleDriver"); + Configs.CONSOLE_LOGGER.info("Oracleسɹ"); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static Connection ConnectionBuilder(String url, String user, + String password) { + Connection conn = null; + try { + + conn = DriverManager.getConnection(url, user, password); + } catch (SQLException e) { + return conn; + } + + return conn; + } + + public static boolean canConnect(String url, String user, String password) { + return (null != ConnectionBuilder(url, user, password)); + } + + public ResultSet getSQLExecResultSet(Connection conn, String sql) { + ResultSet resultSet = null; + try { + Statement statement = conn + .createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, + ResultSet.CONCUR_UPDATABLE); + resultSet = statement.executeQuery(sql); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return resultSet; + } + + public ResultSet getSQLExecResultSet(String url, String user, + String password, String sql) { + return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql); + } + + /** + * ִжoracleݿɾ + * @param conn + * @param sql + * @return Ƿִгɹ + */ + public boolean execOracleSQL(Connection conn, String sql) { + boolean flag = false; + try { + Statement statement = conn.createStatement(); + if (statement.executeUpdate(sql) > 0) + flag = true; + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return flag; + } +} diff --git a/src/com/platform/service/DataInfoService.java b/src/com/platform/service/DataInfoService.java new file mode 100644 index 00000000..be0ca7f7 --- /dev/null +++ b/src/com/platform/service/DataInfoService.java @@ -0,0 +1,11 @@ +package com.platform.service; + +import org.springframework.ui.ModelMap; + +import com.platform.entities.PagerOptions; + +public interface DataInfoService { + public ModelMap getPagerTableData(PagerOptions pagerOptions); + + void deleteData(String[] id); +} diff --git a/src/com/platform/service/DataInfoServiceImp.java b/src/com/platform/service/DataInfoServiceImp.java new file mode 100644 index 00000000..3c89b60e --- /dev/null +++ b/src/com/platform/service/DataInfoServiceImp.java @@ -0,0 +1,58 @@ +package com.platform.service; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; +import org.springframework.ui.ModelMap; + +import com.platform.dao.DataInfoDao; +import com.platform.entities.DataInfoEntity; +import com.platform.entities.PagerOptions; + +@Service(value = "dataInfoService") +public class DataInfoServiceImp implements DataInfoService { + @Resource(name = "dataInfoDao") + private DataInfoDao dfdDao; + + public void setDfdDao(DataInfoDao dfdDao) { + this.dfdDao = dfdDao; + } + + @Override + public ModelMap getPagerTableData(PagerOptions pagerOptions) { + // TODO Auto-generated method stub + ModelMap modelMap = new ModelMap(); + int count = dfdDao.getLimitedDataCount(pagerOptions); //ȡܼ¼ + int offset = 0; + if (pagerOptions.getCurrentPageNum() > 1) { + pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1) + * pagerOptions.getPriorTableSize()); + offset = dfdDao.getLimitedBeginId(pagerOptions); //ȡʼѯid + System.out.println(offset); + } + pagerOptions.setOffset(offset + 1); + List result = dfdDao + .getLimitedDataInfoEntities(pagerOptions); + modelMap.addAttribute("data", result); + modelMap.addAttribute("length", count); + return modelMap; + } + + @Override + public void deleteData(String[] id) { + // TODO Auto-generated method stub + for(String idx: id){ + List paths = dfdDao.getIdIsExist(Integer.parseInt(idx)); + if(paths.size()>0){ + //ɾļ + for (int i = 0; i < paths.size(); i++) { + System.out.println(paths.get(i)); + } + //ɾݿ¼ + //dfdDao.deleteRow(idx); + } + } + } +} diff --git a/src/com/platform/service/EncodeInfoService.java b/src/com/platform/service/EncodeInfoService.java new file mode 100644 index 00000000..8ef13844 --- /dev/null +++ b/src/com/platform/service/EncodeInfoService.java @@ -0,0 +1,20 @@ +package com.platform.service; + +import java.util.List; + +import com.platform.entities.EncodedInfoEntity; + +/** + * ݿҵ߼ӿ + * + * @author wuming + * + */ +public interface EncodeInfoService { + + public List getAllEncodeInfo(String tableName); + + public int deleteEncodeByCode(String code, String tableName); + + public String getEncodeNameByCode(String code, String name); +} diff --git a/src/com/platform/service/EncodeInfoServiceImpl.java b/src/com/platform/service/EncodeInfoServiceImpl.java new file mode 100644 index 00000000..3e5fe735 --- /dev/null +++ b/src/com/platform/service/EncodeInfoServiceImpl.java @@ -0,0 +1,52 @@ +package com.platform.service; + +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import com.platform.dao.EncodeInfoDao; +import com.platform.entities.EncodedInfoEntity; + +/** + * ҵ߼ľʵ + * + * @author wuming + * + */ +@Service("encodeInfoService") +public class EncodeInfoServiceImpl implements EncodeInfoService { + + @Resource(name = "encodeInfoDao") + private EncodeInfoDao eiDao; + + public void setEiDao(EncodeInfoDao eiDao) { + this.eiDao = eiDao; + } + + /** + * ݴݵtableNameȡӦʵϢ/ϵͳ + */ + @Override + public List getAllEncodeInfo(String tableName) { + return eiDao.getAllEntityInfo(tableName); + + } + + /** + * + */ + @Override + public int deleteEncodeByCode(String code, String tableName) { + // TODO Auto-generated method stub + int cursor = eiDao.deleteEncodeByCode(code, tableName); + //cursor = cursor / 0; + return cursor; + } + + @Override + public String getEncodeNameByCode(String code, String tableName) { + return eiDao.getEncodeNameByCode(code, tableName); + } +} diff --git a/src/com/platform/service/OracleExtractHelper.java b/src/com/platform/service/OracleExtractHelper.java new file mode 100644 index 00000000..dd8eb368 --- /dev/null +++ b/src/com/platform/service/OracleExtractHelper.java @@ -0,0 +1,151 @@ +package com.platform.service; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import com.mysql.jdbc.Connection; +import com.platform.entities.OracleConnectorParams; +import com.platform.oracle.OracleConnector; +import com.platform.utils.Configs; +import com.platform.utils.FileOperateHelper; + +public class OracleExtractHelper { + + private OracleConnector oConnector; + + /** + * жdblinkǷѾ + * + * @param conn + * @param linkName + * dblink + * @return + */ + private boolean hasSameNameDBLink(Connection conn, String linkName) { + boolean flag = false; + String sql = "SELECT * FROM ALL_DB_LINKS WHERE DB_LINK=" + linkName; + ResultSet rSet = oConnector.getSQLExecResultSet(conn, sql); + try { + rSet.last(); + if (rSet.getRow() > 0) + flag = true; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return flag; + } + + /** + * dblink + * + * @param conn + * @param oc + * dblinkӲʵ + */ + public void createDBLink(Connection conn, OracleConnectorParams oc) { + String linkName = "LinkTo" + oc.getName(); + String sql = "CREATE PUBLIC DATABASE LINK LinkTo" + + linkName + + " CONNECT TO " + + "IDENTIFIED BY " + + oc.getPassword() + + " USING '(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = " + + oc.getIp() + ")(PORT = " + oc.getPort() + + ")))(CONNECT_DATA =(SERVICE_NAME =" + oc.getDatabase() + + ")))';"; + if (null != oc) { + if (hasSameNameDBLink(conn, linkName)) { // dblinkѾ,ɾdblinkڴdblink + String deleteSql = "DROP PUBLIC DATABASE LINK LinkTo" + + linkName; + FileOperateHelper + .fileWrite( + Configs.EXTRACT_LOG_LOCALTION + oc.getName(), + deleteSql); + if (oConnector.execOracleSQL(conn, deleteSql)) { + FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + + oc.getName(), sql); + oConnector.execOracleSQL(conn, sql); + } else { + Configs.CONSOLE_LOGGER.error("ɾеDBLinkʧ,޷µDBLink!"); + FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION + + oc.getName(), "ɾеDBLinkʧ,޷µDBLink!"); + } + + } else { + // 򣬴dblink + oConnector.execOracleSQL(conn, sql); + FileOperateHelper.fileWrite( + Configs.EXTRACT_LOG_LOCALTION + oc.getName(), sql); + } + } + } + + /** + * ռ + * + * @param conn + * @param oc + * @return + */ + public boolean createTableSpace(Connection conn, OracleConnectorParams oc) { + String tmpSql = "select TABLESPACE_NAME from dba_tablespaces where TABLESPACE_NAME = '" + + Configs.GATHER_TABLESPACE_NAME + "'"; + if (oConnector.execOracleSQL(conn, tmpSql)) { + return true; + } else { + String sql = "create tablespace " + Configs.GATHER_TABLESPACE_NAME + + " datafile '" + Configs.GATHER_TABLESPACE_PATH + + Configs.GATHER_TABLESPACE_NAME + ".dbf" + + "' size 512M autoextend on next 512M maxsize unlimited"; + return oConnector.execOracleSQL(conn, sql); + } + } + + /** + * ûȨ + * + * @param conn + * @param oc + */ + public void createUser(Connection conn, OracleConnectorParams oc) { + String strTUser = oc.getName() + Configs.TABLE_SUFFIX; + String sql = "Create user " + strTUser + " default tablespace " + + Configs.GATHER_TABLESPACE_NAME + " identified by " + + Configs.GATHER_TABLE_PASSWORD; + String grantSql = "grant connect, resource, dba to " + strTUser; + oConnector.execOracleSQL(conn, sql); + oConnector.execOracleSQL(conn, grantSql); + } + + /** + * ִлܲ + * + * @param conn + * @param oc + */ + public void extractColleDB(Connection conn, OracleConnectorParams oc) { + String strTUser = oc.getName() + Configs.TABLE_SUFFIX; + String sql = "SELECT 'create table " + + strTUser + + ".J'|| substr(t.OWNER||'_'||t.TABLE_NAME,0,29)||' as select * from '||t.OWNER||'.'||t.TABLE_NAME||" + + "'@linkTo" + + oc.getName() + + ";' FROM dba_tables@linkTo" + + oc.getName() + + " t WHERE t.TABLESPACE_NAME NOT IN ('SYSTEM','SYSAUX')" + + " and t.owner||t.table_name not in (select owner||table_name from dba_tables@linkTo" + + oc.getName() + " where 'data_type'='CLOB')"; + ResultSet rsSet = oConnector.getSQLExecResultSet(conn, sql); + try { + while (rsSet.next()) { + String resultSql = rsSet.getString(0); + oConnector.execOracleSQL(conn, resultSql); + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } +} diff --git a/src/com/platform/service/OracleExtractService.java b/src/com/platform/service/OracleExtractService.java new file mode 100644 index 00000000..cd64be1f --- /dev/null +++ b/src/com/platform/service/OracleExtractService.java @@ -0,0 +1,25 @@ +package com.platform.service; + + + +import com.platform.entities.OracleConnectorParams; +import com.platform.oracle.OracleConnector; +import com.platform.utils.Configs; + +public class OracleExtractService implements Runnable { + private OracleConnectorParams ocp; + private java.sql.Connection conn; + + public OracleExtractService(OracleConnectorParams ocp){ + this.ocp=ocp; + String url = ""; + this.conn=OracleConnector.ConnectionBuilder(url, Configs.GATHER_USER_NAME, Configs.GATHER_USER_PASSWORD); + } + + @Override + public void run() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/com/platform/service/OracleStatusService.java b/src/com/platform/service/OracleStatusService.java new file mode 100644 index 00000000..158eaf3f --- /dev/null +++ b/src/com/platform/service/OracleStatusService.java @@ -0,0 +1,149 @@ +package com.platform.service; + +import io.fabric8.kubernetes.api.model.Pod; +import io.fabric8.kubernetes.api.model.ReplicationController; + +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import com.platform.entities.OracleConnectorParams; +import com.platform.kubernetes.SimpleKubeClient; +import com.platform.oracle.OracleConnector; +import com.platform.utils.Configs; + +public class OracleStatusService { + private static Map alliveTask = new Hashtable(); + public final static int EXEC_TIME = 10;// Ӷٴκ󲻳ɹȡ + public final static long INTERVAL_TIME = 60 * 1000;// ÿٺִһ + public final static long DELAY_TIME = 0; // ӳٶִ + + public void connectToOracle(String replicasName) { + SimpleKubeClient sKubeClient = new SimpleKubeClient(); + ReplicationController replicationController = sKubeClient + .getReplicationController(replicasName); + if (alliveTask.containsKey(replicasName)) { + killAlliveTask(replicasName); + } + if (null != replicationController) { + List filterPods = sKubeClient + .getPodsForApplicaList(replicationController); + if (filterPods != null && filterPods.size() > 0) { + Pod pod = filterPods.get(0); + OracleConnectorParams orp = new OracleConnectorParams( + String.valueOf(sKubeClient.getPodContainerport(pod)), + sKubeClient.getPodHostIp(pod), replicasName); + Timer timer = new Timer(); + alliveTask.put(replicasName, timer); + timer.schedule(new connectTask(orp, sKubeClient), DELAY_TIME, + INTERVAL_TIME); + } + } + + } + + public void cancelToOracle(String replicasName, String operate) { + if (operate.equals("stop")) { + SimpleKubeClient sKubeClient = new SimpleKubeClient(); + sKubeClient.updateOrAddReplicasLabelById(replicasName, "status", + "0"); + } + killAlliveTask(replicasName); + } + + /** + * ȡƳָʱ + * + * + * @param taskName + */ + public void killAlliveTask(String taskName) { + if (alliveTask.containsKey(taskName)) { + alliveTask.get(taskName).cancel(); + alliveTask.remove(taskName); + } + } + + public void killAlliveTasks(String... tasksName) { + for (String taskName : tasksName) + killAlliveTask(taskName); + } + + /** + * նʱ + */ + public void cleanUpAlliveTask() { + Iterator> iterator = alliveTask.entrySet() + .iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + entry.getValue().cancel(); + } + alliveTask.clear(); + } + + /** + * oracle + * + * @author wuming + * + */ + class connectTask extends TimerTask { + private String taskName; + private int count; + private OracleConnectorParams ocp; + private SimpleKubeClient client; + + public connectTask(OracleConnectorParams ocp, SimpleKubeClient client) { + this.taskName = ocp.getName(); + this.ocp = ocp; + this.count = 0; + this.client = client; + } + + @Override + public void run() { + if (count == EXEC_TIME && alliveTask.containsKey(taskName)) { + killAlliveTask(taskName); + client.updateOrAddReplicasLabelById(taskName, "status", "1"); + } else { + String url = "jdbc:oracle:thin:@" + ocp.getIp() + ":" + + ocp.getPort() + ":" + ocp.getDatabase(); + boolean flag = OracleConnector.canConnect(url, ocp.getUser(), + ocp.getPassword()); + String message = "ʧ"; + if (flag && alliveTask.containsKey(taskName)) { + client.updateOrAddReplicasLabelById(taskName, "status", "2"); + message = "ɹ"; + killAlliveTask(taskName); // ӳɹȡ + } + Configs.CONSOLE_LOGGER.info("ӵݿ " + taskName + + "\t[ӽ " + message + "]"); + } + count++; + } + + @Override + public boolean cancel() { + System.out.println("aaaaaaa"); + if (client != null) + this.client.close(); + return super.cancel(); + } + + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + + public int getCount() { + return count; + } + } +} diff --git a/src/com/platform/service/SimplePropertyReader.java b/src/com/platform/service/SimplePropertyReader.java new file mode 100644 index 00000000..51862917 --- /dev/null +++ b/src/com/platform/service/SimplePropertyReader.java @@ -0,0 +1,20 @@ +package com.platform.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; + +import com.platform.entities.SimpleConfigParamsBean; + +public class SimplePropertyReader { + @Autowired @Qualifier("simpeConfig") + private SimpleConfigParamsBean configParamsBean; + + public void setConfigParamsBean(SimpleConfigParamsBean configParamsBean) { + this.configParamsBean = configParamsBean; + } + + public SimpleConfigParamsBean getConfigParamsBean() { + return configParamsBean; + } + +} diff --git a/src/com/platform/utils/ConfigLoder.java b/src/com/platform/utils/ConfigLoder.java new file mode 100644 index 00000000..fe3ef0f9 --- /dev/null +++ b/src/com/platform/utils/ConfigLoder.java @@ -0,0 +1,84 @@ +package com.platform.utils; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; + +public class ConfigLoder { + private String configPath; + private volatile static ConfigLoder configLoder; + + private ConfigLoder(String configPath) { + this.configPath = configPath; + } + + public static ConfigLoder Builder(String configPtah) { + if (null == configLoder) { + synchronized (ConfigLoder.class) { + if (null == configLoder) + configLoder = new ConfigLoder(configPtah); + } + } + return configLoder; + } + + /** + * ȡPropertyеֵ + * + * @param key + * @return + */ + public String getProperty(String key) { + String value = null; + if (StringUtils.isEmpty(key)) + return value; + + try { + InputStream is = new BufferedInputStream(new FileInputStream( + new File(configPath))); + Properties properties = new Properties(); + properties.load(is); + value = properties.getProperty(key); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return value; + } + + public Properties getProperties() { + Properties properties = null; + try { + InputStream is; + properties = new Properties(); + is = new BufferedInputStream(new FileInputStream(new File( + configPath))); + properties.load(is); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return properties; + } + + public String getConfigPath() { + return configPath; + } + + public void setConfigPath(String configPath) { + this.configPath = configPath; + } + +} diff --git a/src/com/platform/utils/ConfigPropertyReader.java b/src/com/platform/utils/ConfigPropertyReader.java new file mode 100644 index 00000000..7f9df866 --- /dev/null +++ b/src/com/platform/utils/ConfigPropertyReader.java @@ -0,0 +1,84 @@ +package com.platform.utils; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; + +public class ConfigPropertyReader { + private String configPath; + private volatile static ConfigPropertyReader configLoder; + + private ConfigPropertyReader(String configPath) { + this.configPath = configPath; + } + + public static ConfigPropertyReader Builder(String configPtah) { + if (null == configLoder) { + synchronized (ConfigPropertyReader.class) { + if (null == configLoder) + configLoder = new ConfigPropertyReader(configPtah); + } + } + return configLoder; + } + + /** + * ȡPropertyеֵ + * + * @param key + * @return + */ + public synchronized String getProperty(String key) { + String value = null; + if (StringUtils.isEmpty(key)) + return value; + + try { + InputStream is = new BufferedInputStream(new FileInputStream( + new File(configPath))); + Properties properties = new Properties(); + properties.load(is); + value = properties.getProperty(key); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return value; + } + + public Properties getProperties() { + Properties properties = null; + try { + InputStream is; + properties = new Properties(); + is = new BufferedInputStream(new FileInputStream(new File( + configPath))); + properties.load(is); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return properties; + } + + public String getConfigPath() { + return configPath; + } + + public void setConfigPath(String configPath) { + this.configPath = configPath; + } + +} diff --git a/src/com/platform/utils/Configs.java b/src/com/platform/utils/Configs.java new file mode 100644 index 00000000..87ee6c2e --- /dev/null +++ b/src/com/platform/utils/Configs.java @@ -0,0 +1,45 @@ +package com.platform.utils; + +import org.apache.log4j.Logger; + +public class Configs { + public static final String CONFIG_LOCALTION = "WebContent/WEB-INF/config/config.properties"; + + public static final Logger CONSOLE_LOGGER = Logger.getLogger("console"); + + public static final Logger DAILY_ROLLING_LOGGER = Logger + .getLogger("dailyRollingFile"); + + public static final Logger DAILY_LOGGER = Logger.getLogger("railyFile"); + + public static final Logger LOGGER = Logger.getLogger(Configs.class); + + public static String KUBE_MASTER_URL = "http://192.168.0.113:8080/"; // kubernetesȺmaser + // URl + + public static int ORACLE_DEFAULT_PORT = 1521; // oracleĬ϶˿ں + + public static String COLLECT_USER_NAME = "system"; //ɼͳһĵû + + public static String COLLECT_PASSWORD = "oracle"; //ɼͳһĵ + + public static String COLLECT_SERVICE_NAME = "orcl"; //ɼͳһķ + + public static String GATHER_PORT ="1521"; //ܿĶ˿ں + + public static String GATHER_USER_NAME = "system"; //ܿĵû + + public static String GATHER_USER_PASSWORD = "1"; //ܿĵ + + public static String GATHER_SERVICE_NAME = "orcl"; //ܿķ + + public static String TABLE_SUFFIX = "_20152016"; //ܱܿĺ׺ + + public static String EXTRACT_LOG_LOCALTION = "/home/log"; //ݻ־λ + + public static String GATHER_TABLESPACE_NAME=""; //ռ + + public static String GATHER_TABLESPACE_PATH=""; //ռ· + + public static String GATHER_TABLE_PASSWORD=""; // +} diff --git a/src/com/platform/utils/ConfigsLoader.java b/src/com/platform/utils/ConfigsLoader.java new file mode 100644 index 00000000..1b1c1959 --- /dev/null +++ b/src/com/platform/utils/ConfigsLoader.java @@ -0,0 +1,73 @@ +package com.platform.utils; + +import java.util.Properties; + +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +public class ConfigsLoader implements ServletContextListener { + private static ConfigPropertyReader cReader = null; + + @Override + public void contextDestroyed(ServletContextEvent sEvent) { + // TODO Auto-generated method stub + Configs.CONSOLE_LOGGER.info("ϵͳֹͣ.."); + } + + @SuppressWarnings("static-access") + @Override + public void contextInitialized(ServletContextEvent sEvent) { + // TODO Auto-generated method stub + Configs.CONSOLE_LOGGER.info("ϵͳʼ.."); + String contextPath = sEvent.getServletContext().getRealPath("/") + + "WEB-INF/config/config.properties"; + this.cReader = ConfigPropertyReader.Builder(contextPath); + init(); + } + + public static void init() { + Properties properties = cReader.getProperties(); + + Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl"); + + Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name"); + + Configs.COLLECT_PASSWORD = properties.getProperty("collect-password"); + + Configs.COLLECT_SERVICE_NAME = properties + .getProperty("collect-service-name"); + + Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name"); + + Configs.GATHER_USER_PASSWORD = properties + .getProperty("gather-user-password"); + + Configs.GATHER_PORT = properties.getProperty("gather-port"); + + Configs.GATHER_SERVICE_NAME = properties + .getProperty("gather-service-name"); + + Configs.TABLE_SUFFIX = properties.getProperty("table-suffix"); + + Configs.EXTRACT_LOG_LOCALTION = properties + .getProperty("extract-log-localtion"); + + Configs.GATHER_TABLESPACE_NAME = properties + .getProperty("gather-tablespace-name"); + + Configs.GATHER_TABLESPACE_PATH = properties + .getProperty("gather-tablespace-path"); + + Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password"); + } + + public ConfigPropertyReader getcReader() { + return cReader; + } + + @SuppressWarnings("static-access") + public void setcReader(ConfigPropertyReader cReader) { + this.cReader = cReader; + } + +} diff --git a/src/com/platform/utils/FileOperateHelper.java b/src/com/platform/utils/FileOperateHelper.java new file mode 100644 index 00000000..31827547 --- /dev/null +++ b/src/com/platform/utils/FileOperateHelper.java @@ -0,0 +1,62 @@ +package com.platform.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; + +/** + * ļд + * + * @author wuming + * + */ +public class FileOperateHelper { + + /** + * ׷ӵķʽϢдļ + * + * @param path + * @param message + */ + @SuppressWarnings("resource") + public static void fileWrite(String path, String message) { + try { + File file = new File(path); + if (file.exists()) + file.createNewFile(); + FileOutputStream out = new FileOutputStream(file, true); // ׷ӷʽtrue + StringBuffer sb = new StringBuffer(); + sb.append(message).append("\n"); + out.write(sb.toString().getBytes("utf-8")); + } catch (IOException e) { + // TODO: handle exception + } + } + + /** + * ļȡ + * @param path + * @return + */ + @SuppressWarnings("resource") + public static String fileReader(String path) { + StringBuffer sb = new StringBuffer(); + String tempString = ""; + try { + File file = new File(path); + if (!file.exists()) + return ""; + FileInputStream fis = new FileInputStream(file); + BufferedReader br = new BufferedReader(new InputStreamReader(fis)); + while ((tempString = br.readLine()) != null) { + sb.append(tempString); + } + } catch (Exception e) { + // TODO: handle exception + } + return sb.toString(); + } +} diff --git a/src/com/platform/utils/UtilsHelper.java b/src/com/platform/utils/UtilsHelper.java new file mode 100644 index 00000000..348f7a54 --- /dev/null +++ b/src/com/platform/utils/UtilsHelper.java @@ -0,0 +1,113 @@ +package com.platform.utils; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +public class UtilsHelper { + /** + * + * @param clazz + * @param req + * @return + */ + public static Object newObjAndSetAttrsByClass(Class clazz, + Map paramMap) { + Object object = null; + try { + object = clazz.newInstance(); + Field[] fileds = clazz.getDeclaredFields(); + for (Field fs : fileds) { + String fieldName = fs.getName(); + String fieldType = fs.getGenericType().toString() + .replace("class ", ""); // typeͣǰ"class " + if (paramMap.containsKey(fieldName)) { + Method method = clazz.getDeclaredMethod( + getAttributeSetName(fs), Class.forName(fieldType)); + String value = paramMap.get(fieldName); + if ("java.lang.Integer".equals(fieldType)) { + method.invoke(object, Integer.valueOf(value)); + } else { + method.invoke(object, value); + } + } + } + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch blockAQA + e.printStackTrace(); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return object; + }; + + /** + * + * @param object + * @param req + * @return + */ + public static Object newObjAndSetAttrsByInstance(Object object, + Map mapParam) { + return newObjAndSetAttrsByClass(object.getClass(), mapParam); + } + + /** + * {@fs}set + * + * @param fs + * Զ + * @return set + */ + private static String getAttributeSetName(Field fs) { + String fieldName = fs.getName(); + char[] cs = fieldName.toCharArray(); + cs[0] -= 32; + return "set" + String.valueOf(cs); + } + + public static Map updateMap(Map map1, Map map2) { + if (null == map1 || map1.size() <= 0) + return map2; + Iterator> iterator = map2.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + map1.put(entry.getKey(), entry.getValue()); + } + return map1; + } + + public static boolean isSubMap(Map map1, Map map2) { + boolean flag = true; + if (null == map2 || map2.size() <= 0 || null == map1) + return false; + Iterator> iterator = map1.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + if (!map2.containsKey(entry.getKey()) + || !map2.containsValue(entry.getValue())) + return false; + } + return flag; + } + +} diff --git a/test/com/platform/test/SMBasedTest.java b/test/com/platform/test/SMBasedTest.java new file mode 100644 index 00000000..b0a77f9f --- /dev/null +++ b/test/com/platform/test/SMBasedTest.java @@ -0,0 +1,15 @@ +package com.platform.test; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; + +public class SMBasedTest { + + public ApplicationContext applicationContext; + + public SMBasedTest() { + applicationContext = new FileSystemXmlApplicationContext( + "test/spring-applicationContext-test.xml"); + } + +} diff --git a/test/com/platform/test/TestController.java b/test/com/platform/test/TestController.java new file mode 100644 index 00000000..662ee505 --- /dev/null +++ b/test/com/platform/test/TestController.java @@ -0,0 +1,53 @@ +package com.platform.test; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.platform.entities.EncodedInfoEntity; +import com.platform.service.EncodeInfoService; + +@Controller +public class TestController { + // private static Logger logger = Logger.getLogger(TestController.class); + @Resource(name = "encodeInfoService") + private EncodeInfoService eis; + + public void setEis(EncodeInfoService eis) { + this.eis = eis; + } + + @RequestMapping("/hello") + @ResponseBody + public List hello(String name, HttpServletResponse res) { + System.out.println(name); + return eis.getAllEncodeInfo("system_info"); + } + + @RequestMapping("/json") + @ResponseBody + public List getJson(HttpServletRequest res, HttpServletResponse req) { + List list = new ArrayList(); + list.add(new User("lisi", 1, "")); + list.add(new User("zhansan", 2, "")); + return list; + } + + @RequestMapping("log") + public void testLog(HttpServletResponse res) { + System.out.println(eis.getEncodeNameByCode("1", "system_info")); + } + + @RequestMapping("/data111.json") + public void test(String name, HttpServletResponse res){ + + + } +} diff --git a/test/com/platform/test/TestEncodeInfoDao.java b/test/com/platform/test/TestEncodeInfoDao.java new file mode 100644 index 00000000..8e729bf5 --- /dev/null +++ b/test/com/platform/test/TestEncodeInfoDao.java @@ -0,0 +1,64 @@ +package com.platform.test; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import com.platform.dao.EncodeInfoDao; +import com.platform.entities.EncodedInfoEntity; + +public class TestEncodeInfoDao extends SMBasedTest { + + private EncodeInfoDao eiDao; + private String testTableName; + + @Before + public void initBeforeFunction() { + eiDao = (EncodeInfoDao) this.applicationContext + .getBean("encodeInfoDao"); + testTableName = "system_info"; + } + + @Test + public void testGetAllEntityInfo() { + List allEntities = eiDao + .getAllEntityInfo(testTableName); + System.out.println(allEntities); + Assert.assertTrue(allEntities.size() > 0); + } + + @Test + public void testGetEncodeNameByCode() { + String result = eiDao.getEncodeNameByCode("1", testTableName); + Assert.assertTrue(result.equals("Ԥִϵͳ")); + } + + @Test + public void testGetEncodeCodeByName() { + List result = eiDao + .getEncodeCodeByName("Ԥִϵͳ", testTableName); + Assert.assertTrue(result.size() > 0); + } + + @Test + public void testUpdateEncodeNameByCode() { + int result = eiDao + .updateEncodeNameByCode("3", "һ廯ƽ̨", testTableName); + Assert.assertTrue(result > 0); + } + + @Test + public void testInsertEncodeEntity() { + int result = eiDao.insertEncodeEntity(new EncodedInfoEntity("˰ϵͳ", + "4"), testTableName); + Assert.assertTrue(result == 1); + } + + @Test + public void testDeleteEncodeByCode() { + int result = eiDao.deleteEncodeByCode("5", testTableName); + Assert.assertTrue(result >= 1); + } +} diff --git a/test/com/platform/test/TestEncodeService.java b/test/com/platform/test/TestEncodeService.java new file mode 100644 index 00000000..3b4f40c6 --- /dev/null +++ b/test/com/platform/test/TestEncodeService.java @@ -0,0 +1,45 @@ +package com.platform.test; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import com.platform.entities.EncodedInfoEntity; +import com.platform.service.EncodeInfoService; + +public class TestEncodeService extends SMBasedTest { + + private EncodeInfoService eis; + private String testTableName; + + @Before + public void initBeforeFunction() { + eis = (EncodeInfoService) this.applicationContext + .getBean("encodeInfoService"); + testTableName = "system_info"; + } + + @Test + public void testGetEncodeNameByCode() { + String result = eis.getEncodeNameByCode("2", testTableName); + Assert.assertTrue(result.equals("Ԥ")); + } + + /** + * + */ + @Test + public void testDeleteEncodeByCode() { + eis.deleteEncodeByCode("4", testTableName); + } + + @Test + public void testGetAllEncodeInfo() { + List allEntities = eis + .getAllEncodeInfo(testTableName); + System.out.println(allEntities); + Assert.assertTrue(allEntities.size() >= 1); + } +} diff --git a/test/com/platform/test/User.java b/test/com/platform/test/User.java new file mode 100644 index 00000000..e96fbc11 --- /dev/null +++ b/test/com/platform/test/User.java @@ -0,0 +1,42 @@ +package com.platform.test; + +public class User { + private String name; + private int id; + private String sex; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public User(String name, int id, String sex) { + super(); + this.name = name; + this.id = id; + this.sex = sex; + } + + public User(){ + + } +} diff --git a/test/com/platform/test/testSystemInfoDao.java b/test/com/platform/test/testSystemInfoDao.java new file mode 100644 index 00000000..95be6ef6 --- /dev/null +++ b/test/com/platform/test/testSystemInfoDao.java @@ -0,0 +1,19 @@ +package com.platform.test; + +import org.junit.Before; + +import com.platform.dao.DataInfoDao; + +public class testSystemInfoDao extends SMBasedTest { + private DataInfoDao dfDao; + + @Before + public void initBeforeFunction() { + dfDao = (DataInfoDao) this.applicationContext.getBean("dataInfoDao"); + } + + // @Test @Test + public void test() { + //System.out.println(dfDao.getCount()); + } +} diff --git a/test/spring-applicationContext-test.xml b/test/spring-applicationContext-test.xml new file mode 100644 index 00000000..27b1248b --- /dev/null +++ b/test/spring-applicationContext-test.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file