24
	<div class="c_title">文件上传</div>
25 25
	<div class="c_list">
26 26
		<ul>
27 27
			<li>
28 28
				<div class="content">
29 29
					<div class="main">
30 30
						<div class="title">文件路径</div>
31
						<div class="info" id="fileLocation">请选择上传文件路径</div>
31
						<div class="info" id="fileUpload">请选择上传文件路径</div>
32 32
					</div>
33
					<div class="fn fn-2" id="location">文件路径</div>
33
					<div class="fn fn-2" id="upload">文件上传</div>
34 34
				</div>
35 35
			</li>
36 36
		</ul>
37 37
	</div>
38 38
</div>
39
<div>
40
	<div class="c_title">文件下载</div>
41
	<div class="c_list">
42
		<ul>
43
			<li>
44
				<div class="content">
45
					<div class="main">
46
						<div class="title">文件路径</div>
47
						<div class="info" id="fileDownload">请选择下载文件路径</div>
48
					</div>
49
					<div class="fn fn-2" id="download">文件下载</div>
50
				</div>
51
			</li>
52
		</ul>
53
	</div>
54
</div>
55

39 56
</div>
40 57
</body>
41 58
</html>

+ 41 - 0
display-server/web/template/webapp/plugin/Video.html

@ -0,0 +1,41 @@
1
<!DOCTYPE HTML>
2
<html class="s_bs">
3
<head>
4
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
	<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
6
	<title>视频</title>
7
	{%>template/common/Head.html%}
8
	<script type="text/javascript" src="biz/js/plugin/video.js"></script>
9
	<link href="biz/css/project.css" rel="stylesheet" type="text/css" />
10
</head>
11
<body>
12

13
<div class="c_navBar">
14
	<div class="left">
15
		<div class="back">
16
			<span class="e_ico-back"></span>
17
			<span class="text">文件上传</span>
18
		</div>
19
	</div>
20
</div>
21

22
<div class="m_content m_content-nofooter" id="content" >
23
<div>
24
	<div class="c_title">视频</div>
25
	<div class="c_list">
26
		<ul>
27
			<li>
28
				<div class="content">
29
					<div class="main">
30
						<div class="title">视频录制</div>
31
						<div class="info" id="fileLocation">视频录制</div>
32
					</div>
33
					<div class="fn fn-2" id="location">视频录制</div>
34
				</div>
35
			</li>
36
		</ul>
37
	</div>
38
</div>
39
</div>
40
</body>
41
</html>

BIN
display-server/web/upload/default/20151013151525.png


+ 9 - 9
ipu-client/.classpath

@ -1,9 +1,9 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="gen"/>
5
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
8
	<classpathentry kind="output" path="bin/classes"/>
9
</classpath>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="gen"/>
5
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
6
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
7
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
8
	<classpathentry kind="output" path="bin/classes"/>
9
</classpath>

+ 18 - 18
ipu-client/project.properties

@ -1,18 +1,18 @@
1
# This file is automatically generated by Android Tools.
2
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
#
4
# This file must be checked in Version Control Systems.
5
#
6
# To customize properties used by the Ant build system edit
7
# "ant.properties", and override values to adapt the script to your
8
# project structure.
9
#
10
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12
13
# Project target.
14
target=android-15
15
android.library.reference.1=../wade-mobile-lib
16
android.library.reference.2=../wade-mobile-common
17
18
proguard.config=proguard-project.txt
1
# This file is automatically generated by Android Tools.
2
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
#
4
# This file must be checked in Version Control Systems.
5
#
6
# To customize properties used by the Ant build system edit
7
# "ant.properties", and override values to adapt the script to your
8
# project structure.
9
#
10
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12

13
# Project target.
14
target=android-15
15
android.library.reference.1=../wade-mobile-lib
16
android.library.reference.2=../wade-mobile-common
17

18
proguard.config=proguard-project.txt

+ 22 - 22
ipu-client/src/com/ipu/func/Util.java

@ -1,22 +1,22 @@
1
package com.ipu.func;
2
3
import org.json.JSONArray;
4
5
import android.content.Intent;
6
import android.net.Uri;
7
8
import com.wade.mobile.frame.IWadeMobile;
9
import com.wade.mobile.frame.plugin.Plugin;
10
11
public class Util extends Plugin {
12
	public Util(IWadeMobile wademobile) {
13
		super(wademobile);
14
	}
15
16
	public void openBrowser(JSONArray param) throws Exception {
17
		String url = param.getString(0);
18
		Uri uri = Uri.parse(url);
19
		Intent intent = new Intent(Intent.ACTION_VIEW, uri);
20
		context.startActivity(intent);
21
	}
22
}
1
package com.ipu.func;
2

3
import org.json.JSONArray;
4

5
import android.content.Intent;
6
import android.net.Uri;
7

8
import com.wade.mobile.frame.IWadeMobile;
9
import com.wade.mobile.frame.plugin.Plugin;
10

11
public class Util extends Plugin {
12
	public Util(IWadeMobile wademobile) {
13
		super(wademobile);
14
	}
15

16
	public void openBrowser(JSONArray param) throws Exception {
17
		String url = param.getString(0);
18
		Uri uri = Uri.parse(url);
19
		Intent intent = new Intent(Intent.ACTION_VIEW, uri);
20
		context.startActivity(intent);
21
	}
22
}

+ 50 - 50
ipu-server/.classpath

@ -1,50 +1,50 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="etc"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6
	<classpathentry kind="lib" path="/wade-mobile-library/common/bcprov-jdk16-140.jar"/>
7
	<classpathentry kind="lib" path="/wade-mobile-library/common/beetl-core-2.2.3.jar"/>
8
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-beanutils-1.7.0.jar"/>
9
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-codec-1.3.jar"/>
10
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-collections-3.2.jar"/>
11
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-dbcp-1.4.jar"/>
12
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-digester1.6.jar"/>
13
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-fileupload-1.2.2.jar"/>
14
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-httpclient-3.0.jar"/>
15
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-lang-2.4.jar"/>
16
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-logging-1.1.1.jar"/>
17
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-net-2.0.jar"/>
18
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-pool-1.6.jar"/>
19
	<classpathentry kind="lib" path="/wade-mobile-library/common/dom4j-1.6.1.jar"/>
20
	<classpathentry kind="lib" path="/wade-mobile-library/common/http-unirest-1.3.8.jar"/>
21
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpasyncclient-4.0.1.jar"/>
22
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpclient-4.3.2.jar"/>
23
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpcore-4.4.3.jar"/>
24
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpcore-ab-4.4.3.jar"/>
25
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpcore-nio-4.4.3.jar"/>
26
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpmime-4.3.2.jar"/>
27
	<classpathentry kind="lib" path="/wade-mobile-library/common/java_memcached-release_2.5.3.jar"/>
28
	<classpathentry kind="lib" path="/wade-mobile-library/common/jaxen-1.1.1.jar"/>
29
	<classpathentry kind="lib" path="/wade-mobile-library/common/jedis-2.0.0.jar"/>
30
	<classpathentry kind="lib" path="/wade-mobile-library/common/json-20131018.jar"/>
31
	<classpathentry kind="lib" path="/wade-mobile-library/common/jta.jar"/>
32
	<classpathentry kind="lib" path="/wade-mobile-library/common/junit-4.8.jar"/>
33
	<classpathentry kind="lib" path="/wade-mobile-library/common/log4j-1.2.8.jar"/>
34
	<classpathentry kind="lib" path="/wade-mobile-library/common/mysql-connector-java-5.1.6-bin.jar"/>
35
	<classpathentry kind="lib" path="/wade-mobile-library/common/ojdbc14.jar"/>
36
	<classpathentry kind="lib" path="/wade-mobile-library/common/pinyin4j-2.5.0.jar"/>
37
	<classpathentry kind="lib" path="/wade-mobile-library/common/poi-3.8.jar"/>
38
	<classpathentry kind="lib" path="/wade-mobile-library/common/poi-ooxml-3.8.jar"/>
39
	<classpathentry kind="lib" path="/wade-mobile-library/common/poi-ooxml-schemas-3.8.jar"/>
40
	<classpathentry kind="lib" path="/wade-mobile-library/common/servlet-api2.5.jar"/>
41
	<classpathentry kind="lib" path="/wade-mobile-library/common/sqlite-jdbc-3.8.7.jar"/>
42
	<classpathentry kind="lib" path="/wade-mobile-library/common/velocity-1.7.jar"/>
43
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-apache.jar"/>
44
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-common.jar"/>
45
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-database.jar"/>
46
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-mobile-data.jar"/>
47
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-mobile-server.jar"/>
48
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-sqlite-jdbc.jar"/>
49
	<classpathentry kind="output" path="web/WEB-INF/classes"/>
50
</classpath>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="etc"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6
	<classpathentry kind="lib" path="/wade-mobile-library/common/bcprov-jdk16-140.jar"/>
7
	<classpathentry kind="lib" path="/wade-mobile-library/common/beetl-core-2.2.3.jar"/>
8
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-beanutils-1.7.0.jar"/>
9
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-codec-1.3.jar"/>
10
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-collections-3.2.jar"/>
11
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-dbcp-1.4.jar"/>
12
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-digester1.6.jar"/>
13
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-fileupload-1.2.2.jar"/>
14
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-httpclient-3.0.jar"/>
15
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-lang-2.4.jar"/>
16
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-logging-1.1.1.jar"/>
17
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-net-2.0.jar"/>
18
	<classpathentry kind="lib" path="/wade-mobile-library/common/commons-pool-1.6.jar"/>
19
	<classpathentry kind="lib" path="/wade-mobile-library/common/dom4j-1.6.1.jar"/>
20
	<classpathentry kind="lib" path="/wade-mobile-library/common/http-unirest-1.3.8.jar"/>
21
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpasyncclient-4.0.1.jar"/>
22
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpclient-4.3.2.jar"/>
23
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpcore-4.4.3.jar"/>
24
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpcore-ab-4.4.3.jar"/>
25
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpcore-nio-4.4.3.jar"/>
26
	<classpathentry kind="lib" path="/wade-mobile-library/common/httpmime-4.3.2.jar"/>
27
	<classpathentry kind="lib" path="/wade-mobile-library/common/java_memcached-release_2.5.3.jar"/>
28
	<classpathentry kind="lib" path="/wade-mobile-library/common/jaxen-1.1.1.jar"/>
29
	<classpathentry kind="lib" path="/wade-mobile-library/common/jedis-2.0.0.jar"/>
30
	<classpathentry kind="lib" path="/wade-mobile-library/common/json-20131018.jar"/>
31
	<classpathentry kind="lib" path="/wade-mobile-library/common/jta.jar"/>
32
	<classpathentry kind="lib" path="/wade-mobile-library/common/junit-4.8.jar"/>
33
	<classpathentry kind="lib" path="/wade-mobile-library/common/log4j-1.2.8.jar"/>
34
	<classpathentry kind="lib" path="/wade-mobile-library/common/mysql-connector-java-5.1.6-bin.jar"/>
35
	<classpathentry kind="lib" path="/wade-mobile-library/common/ojdbc14.jar"/>
36
	<classpathentry kind="lib" path="/wade-mobile-library/common/pinyin4j-2.5.0.jar"/>
37
	<classpathentry kind="lib" path="/wade-mobile-library/common/poi-3.8.jar"/>
38
	<classpathentry kind="lib" path="/wade-mobile-library/common/poi-ooxml-3.8.jar"/>
39
	<classpathentry kind="lib" path="/wade-mobile-library/common/poi-ooxml-schemas-3.8.jar"/>
40
	<classpathentry kind="lib" path="/wade-mobile-library/common/servlet-api2.5.jar"/>
41
	<classpathentry kind="lib" path="/wade-mobile-library/common/sqlite-jdbc-3.8.7.jar"/>
42
	<classpathentry kind="lib" path="/wade-mobile-library/common/velocity-1.7.jar"/>
43
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-apache.jar"/>
44
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-common.jar"/>
45
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-database.jar"/>
46
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-mobile-data.jar"/>
47
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-mobile-server.jar"/>
48
	<classpathentry kind="lib" path="/wade-mobile-library/common/wade-sqlite-jdbc.jar"/>
49
	<classpathentry kind="output" path="web/WEB-INF/classes"/>
50
</classpath>

+ 1 - 0
multiple-client/.gitignore

@ -4,3 +4,4 @@
4 4
/.classpath
5 5
/proguard
6 6
/bin/
7
/project.properties

+ 1 - 0
multiple-client/assets/mobile-action.xml

@ -7,6 +7,7 @@
7 7
	<action name="shock" class="com.wade.mobile.func.MobileBasic" method="shock"/>
8 8
	<!-- MobileApp -->
9 9
	<action name="close" class="com.wade.mobile.func.MobileApp" method="close"/>
10
	<action name="openIpuApp" class="com.wade.mobile.func.MobileApp" method="openIpuApp"/>
10 11
	<!-- MobileNetWork -->
11 12
	<action name="httpGet" class="com.wade.mobile.func.MobileNetWork" method="httpGet"></action>
12 13
	<action name="dataRequest" class="com.wade.mobile.func.MobileNetWork" method="dataRequest"/>

+ 1 - 1
multiple-client/assets/mobile-config.xml

@ -3,7 +3,7 @@
3 3
    <!-- 请求主机名或请求地址。包括服务器的ip地址和端口 -->
4 4
	<!-- <config name="request_host" value="http://192.168.1.102:8080"/> -->
5 5
	<!-- 必须。10.0.2.2为Android模拟器的保留ip地址。访问到本机电脑时使用 -->
6
	<config name="request_host" value="http://192.168.57.1:8080"/>
6
	<config name="request_host" value="http://10.0.2.2:8080"/>
7 7
	<!-- 必须。容器应用名或请求根路径 -->
8 8
	<config name="request_path" value="/mult"/>
9 9
	<!-- 必须。数据接口的servlet路径 -->

+ 1 - 2
multiple-client/project.properties

@ -12,5 +12,4 @@
12 12
13 13
# Project target.
14 14
target=android-15
15
android.library.reference.1=../wade-mobile-common
16
android.library.reference.2=../wade-mobile-lib
15
android.library.reference.1=..\\wade-mobile-lib

+ 38 - 0
multiple-client/src/com/ai/mobile/multiple/func/AppManagePlugin.java

@ -1,12 +1,18 @@
1 1
package com.ai.mobile.multiple.func;
2 2

3
import java.util.HashMap;
4
import java.util.Map;
5

3 6
import org.json.JSONArray;
4 7

5 8
import android.content.ComponentName;
6 9
import android.content.Intent;
7 10

8 11
import com.wade.mobile.frame.IWadeMobile;
12
import com.wade.mobile.frame.multiple.MultipleAppConfig;
9 13
import com.wade.mobile.frame.plugin.Plugin;
14
import com.wade.mobile.frame.template.TemplateManager;
15
import com.wade.mobile.func.MobileUI;
10 16

11 17
public class AppManagePlugin extends Plugin{
12 18

@ -32,4 +38,36 @@ public class AppManagePlugin extends Plugin{
32 38
			/*如果应用不存在则需要下载,配置需要提供下载的url*/
33 39
		}
34 40
	}
41
	
42
	public void openIpuApp(JSONArray param) throws Exception{
43
		Map<String,Map> multipleAppConfigs = new HashMap<String,Map>();
44
		Map multipleAppConfig = new HashMap();
45
		multipleAppConfig.put("requestHost", "10.0.2.2");
46
		multipleAppConfig.put("requestPath", "display");
47
		multipleAppConfig.put("requestServlet", "mobiledata");
48
		multipleAppConfig.put("appPath", "display-client");
49
		multipleAppConfigs.put("display", multipleAppConfig);
50
		
51
		multipleAppConfig = new HashMap();
52
		multipleAppConfig.put("requestHost", "10.0.2.2");
53
		multipleAppConfig.put("requestPath", "ioo");
54
		multipleAppConfig.put("requestServlet", "mobiledata");
55
		multipleAppConfig.put("appPath", "ioo-client");
56
		multipleAppConfigs.put("ioo", multipleAppConfig);
57
		
58
		String appName = param.getString(0);
59
		String requestHost = multipleAppConfigs.get(appName).get("requestHost").toString();
60
		String requestPath = multipleAppConfigs.get(appName).get("requestPath").toString();
61
		String requestServlet = multipleAppConfigs.get(appName).get("requestServlet").toString();
62
		String appPath = multipleAppConfigs.get(appName).get("appPath").toString();
63
		
64
		MultipleAppConfig.setRequestHost(requestHost);
65
		MultipleAppConfig.setRequestPath(requestPath);
66
		MultipleAppConfig.setRequestServlet(requestServlet);
67
		MultipleAppConfig.setAppPath(appPath);
68
		
69
		TemplateManager.downloadResource();
70
		
71
		wademobile.getPluginManager().getPlugin(MobileUI.class).openPage("", null);
72
	}
35 73
}

+ 7 - 1
multiple-server/src/com/ai/server/multiple/bean/IndexBean.java

@ -27,12 +27,18 @@ public class IndexBean extends MultipleBean {
27 27
	private IDataset getAppDatas(){
28 28
		IDataset appDatas = new DatasetList();
29 29
		IData appData = new DataMap();
30
		appData.put("APP_NAME", "IPU应用");
30
		appData.put("APP_NAME", "Display");
31 31
		appData.put("APP_TYPE", "I");
32 32
		appData.put("APP_ID", "display");
33 33
		appDatas.add(appData);
34 34
		
35 35
		appData = new DataMap();
36
		appData.put("APP_NAME", "Ioo");
37
		appData.put("APP_TYPE", "I");
38
		appData.put("APP_ID", "ioo");
39
		appDatas.add(appData);
40
		
41
		appData = new DataMap();
36 42
		appData.put("APP_NAME", "原生应用1");
37 43
		appData.put("APP_TYPE", "N");
38 44
		appData.put("APP_ID", "APP1");

+ 3 - 2
multiple-server/web/biz/js/index.js

@ -1,4 +1,4 @@
1
require(["wmTabbar","common","mobile","util"], function(WmTabbar,Common,Mobile) {
1
require(["wmTabbar","common","mobile","wademobile","util"], function(WmTabbar,Common,Mobile,WadeMobile) {
2 2
	var wmTabbar = new WmTabbar("tabbar");
3 3
	wmTabbar.create();
4 4
	
@ -20,7 +20,8 @@ require(["wmTabbar","common","mobile","util"], function(WmTabbar,Common,Mobile)
20 20
			Common.callSvc("LoginBean.loginApp",loginData,function(result){
21 21
				alert(result)
22 22
				if(appType=="I"){
23
					alert("打开IPU应用"+appId);
23
					//alert("打开IPU应用"+appId);
24
					WadeMobile.openIpuApp(appId);
24 25
				}else if(appType=="N"){
25 26
					var param = new Wade.DataMap();
26 27
					param.put("TOKEN_ID",result.get("TOKEN_ID"));

+ 2 - 0
multiple-server/web/res/js/mobile/wade-mobile.js

@ -92,6 +92,8 @@ define(["jcl","base64","util","res/js/mobile/expand-mobile.js","biz/js/common/bi
92 92
				execute("openSlidingMenu", [action,param,width,height,leftMargin,topMargin,isEscape],err);
93 93
			},closeSlidingMenu:function(result,state,err){
94 94
				execute("closeSlidingMenu", [result,state],err);
95
			},openIpuApp(callback,appName){
96
				execute("openIpuApp", [appName],err);
95 97
			}
96 98
		};
97 99
	})();

+ 4 - 4
push-server/.settings/gradle/org.springsource.ide.eclipse.gradle.core.prefs

@ -1,4 +1,4 @@
1
#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences
2
#Fri Sep 18 14:22:21 CST 2015
3
build.family.org.gradle.tooling.model.eclipse.HierarchicalEclipseProject=;
4
org.springsource.ide.eclipse.gradle.rootprojectloc=
1
#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences
2
#Fri Sep 18 14:22:21 CST 2015
3
build.family.org.gradle.tooling.model.eclipse.HierarchicalEclipseProject=;
4
org.springsource.ide.eclipse.gradle.rootprojectloc=

+ 8 - 8
wade-mobile-common/.classpath

@ -1,8 +1,8 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="gen"/>
4
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
7
	<classpathentry kind="output" path="bin/classes"/>
8
</classpath>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="gen"/>
4
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
7
	<classpathentry kind="output" path="bin/classes"/>
8
</classpath>

+ 8 - 8
wade-mobile-lib/.classpath

@ -1,8 +1,8 @@
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="gen"/>
4
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
7
	<classpathentry kind="output" path="bin/classes"/>
8
</classpath>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="gen"/>
4
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
5
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
6
	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
7
	<classpathentry kind="output" path="bin/classes"/>
8
</classpath>

BIN
wade-mobile-lib/libs/android-support-v4.jar


BIN
wade-mobile-library/common/wade-mobile-server.jar


sprigboot热部署、引入nacos配置中心 · 793fc5807d - Nuosi Git Service
瀏覽代碼

sprigboot热部署、引入nacos配置中心

weihf 5 年之前
父節點
當前提交
793fc5807d

+ 13 - 0
ipu-rest-scaffold/pom.xml

@ -79,6 +79,19 @@
79 79
			<groupId>org.springframework.boot</groupId>
80 80
			<artifactId>spring-boot-starter-actuator</artifactId>
81 81
		</dependency>
82
		<!--devtools热部署-->
83
        <dependency>
84
            <groupId>org.springframework.boot</groupId>
85
            <artifactId>spring-boot-devtools</artifactId>
86
            <optional>true</optional>
87
            <scope>true</scope>
88
        </dependency>
89
        <!-- 引入nacos服务注册及配置中心 -->
90
        <dependency>
91
            <groupId>com.alibaba.boot</groupId>
92
            <artifactId>nacos-config-spring-boot-starter</artifactId>
93
            <version>${nacos-config.version}</version>
94
        </dependency>
82 95
83 96
	</dependencies>
84 97

+ 40 - 0
ipu-rest-scaffold/readme.md

@ -22,6 +22,7 @@ webapp下可存放静态页面,便于前后端开发联调。
22 22
###三、SQL统一管理
23 23
SQL被统一存放在classpath的sql路径下,如:sql.ipu.demo。
24 24
使用命名空间+id的方式定位SQL配置,DbSqlMgmtController有代码使用范例。
25

25 26
###四、ipu-nosql组件
26 27
- 1.ipu-nosql组件的引入
27 28
    - 以maven为例,请在pom.xml中引入ipu-nosql组件和mongodb驱动包。如果使用的springboot为2.2.1.RELEASE或更高版本时,则不再需要添加mongodb驱动包。因为该版本已支持3.11.2的mongodb驱动包。
@ -49,6 +50,7 @@ SQL被统一存放在classpath的sql路径下,如:sql.ipu.demo。
49 50
        <config name="needTranscation" value="true"/>
50 51
        ```
51 52
- 该组件使用案例在:MongoDbController中
53

52 54
###五、springboot优雅停止服务
53 55
- 1.组件的引入
54 56
    - 以maven为例,请在pom.xml中引入spring-boot-starter-actuator组件。
@ -74,6 +76,44 @@ SQL被统一存放在classpath的sql路径下,如:sql.ipu.demo。
74 76
- 3.停止springboot应用的http接口只支持POST。在linux下使用命令curl -X POST http://127.0.0.1:12581/MyActuator/shutdown;在windows下使用工具,选择POST方式。
75 77
- 4.测试案例见GracefulTestController.java。在浏览器里输入http://服务ip:port/ipu/graceful/hello
76 78

79
###六、springboot热部署
80
- 1.组件的引入
81
    - 以maven为例,请在pom.xml中引入spring-boot-devtools组件。
82
        ```xml
83
        <dependency>
84
            <groupId>org.springframework.boot</groupId>
85
            <artifactId>spring-boot-devtools</artifactId>
86
        </dependency>
87
        ```
88
- 2.在application.properties配置:
89
        ```properties
90
        #设置开启热部署
91
        spring.devtools.restart.enabled=true
92
        #重启目录
93
        spring.devtools.restart.additional-paths=src/main/java
94
        spring.devtools.restart.exclude=WEB-INF/**
95
        #页面热加载
96
        spring.freemarker.cache=false 
97
        ```
98
- 3.测试案例见NacosConfigController.java。
99

100
###七、nacos配置中心和注册中心
101
- 1.nacos配置中心组件的引入
102
    - 以maven为例,请在pom.xml中引入nacos组件。如果使用的springboot为2.x或更高版本时,需要使用0.2.1的nacos组件;使用的springboot为1.x,需要使用0.1.1的nacos组件。
103
        ```xml
104
        <dependency>
105
            <groupId>com.alibaba.boot</groupId>
106
            <artifactId>nacos-config-spring-boot-starter</artifactId>
107
            <version>0.1.1</version>
108
        </dependency>
109
        ```
110
- 2.nacos配置中心的配置文件为:application.properties
111
        ```properties
112
        nacos.config.server-addr=192.168.1.101:8848
113
        ```
114

115
- 3.nacos配置中心使用案例在NacosConfigController中。此案例只支持springboot,springcloud的示例不在当前工程。
116

77 117
###打包运行
78 118
java -Dipu.lic.path=ipu.lic -jar ipu-rest-scaffold.jar --server.port=8080
79 119


+ 4 - 1
ipu-rest-scaffold/src/main/java/com/ai/ipu/server/RestScaffoldStart.java

@ -18,7 +18,10 @@ public class RestScaffoldStart {
18 18
	    /*自定义Handler*/
19 19
	    defineHandler();
20 20
		/*注册异常信息编码配置*/
21
		IpuBaseException.registerCode(EXCEPTION_MESSAGES_CONFIG);
21
	    //热部署会多次加载,因此需要捕获并忽略异常
22
		try{
23
			IpuBaseException.registerCode(EXCEPTION_MESSAGES_CONFIG);
24
		}catch(Exception e) {}
22 25
		/*启动*/
23 26
	    IpuRestApplication.start(args);
24 27
	}

+ 89 - 0
ipu-rest-scaffold/src/main/java/com/ai/ipu/server/config/NacosListenerConfiguration.java

@ -0,0 +1,89 @@
1
package com.ai.ipu.server.config;
2

3
import static com.alibaba.nacos.api.common.Constants.DEFAULT_GROUP;
4

5
import javax.annotation.PostConstruct;
6

7
import org.slf4j.Logger;
8
import org.slf4j.LoggerFactory;
9
import org.springframework.context.ApplicationListener;
10
import org.springframework.context.annotation.Bean;
11
import org.springframework.context.annotation.Configuration;
12

13
import com.alibaba.nacos.api.annotation.NacosInjected;
14
import com.alibaba.nacos.api.config.ConfigService;
15
import com.alibaba.nacos.api.config.listener.AbstractListener;
16
import com.alibaba.nacos.api.config.listener.Listener;
17
import com.alibaba.nacos.api.exception.NacosException;
18
import com.alibaba.nacos.spring.context.event.config.NacosConfigListenerRegisteredEvent;
19
import com.alibaba.nacos.spring.context.event.config.NacosConfigPublishedEvent;
20
import com.alibaba.nacos.spring.context.event.config.NacosConfigReceivedEvent;
21
import com.alibaba.nacos.spring.context.event.config.NacosConfigRemovedEvent;
22

23
@Configuration
24
public class NacosListenerConfiguration {
25
	private static final Logger logger = LoggerFactory.getLogger(NacosListenerConfiguration.class);
26
	@NacosInjected
27
    private ConfigService configService;
28
	
29
	@PostConstruct
30
    public void init() throws NacosException {
31

32
        Listener listener = new AbstractListener() {
33
//            @Override
34
            public void receiveConfigInfo(String configInfo) {
35
            }
36
        };
37

38
        //添加事件监听
39
        configService.addListener("com.ai.ipu.nacos", DEFAULT_GROUP, listener);
40
        
41
        //取消事件监听
42
        //configService.removeListener("com.ai.ipu.nacos", DEFAULT_GROUP, listener);
43
    }
44

45

46
    @Bean
47
    public ApplicationListener<NacosConfigReceivedEvent> nacosConfigReceivedEventListener() {
48
        return new ApplicationListener<NacosConfigReceivedEvent>() {
49
//            @Override
50
            public void onApplicationEvent(NacosConfigReceivedEvent event) {
51
                logger.info("Listening on NacosConfigReceivedEvent -  dataId : {} , groupId : {} , " + "content : {} , "
52
                        + "source : {}", event.getDataId(), event.getGroupId(), event.getContent(), event.getSource());
53
            }
54
        };
55
    }
56

57
    @Bean
58
    public ApplicationListener<NacosConfigRemovedEvent> nacosConfigRemovedEventListener() {
59
        return new ApplicationListener<NacosConfigRemovedEvent>() {
60
//            @Override
61
            public void onApplicationEvent(NacosConfigRemovedEvent event) {
62
                logger.info("Listening on NacosConfigRemovedEvent -  dataId : {} , groupId : {} , " + "removed : {} , "
63
                        + "source : {}", event.getDataId(), event.getGroupId(), event.isRemoved(), event.getSource());
64
            }
65
        };
66
    }
67

68
    @Bean
69
    public ApplicationListener<NacosConfigListenerRegisteredEvent> nacosConfigListenerRegisteredEventListener() {
70
        return new ApplicationListener<NacosConfigListenerRegisteredEvent>() {
71
//            @Override
72
            public void onApplicationEvent(NacosConfigListenerRegisteredEvent event) {
73
                logger.info("Listening on NacosConfigListenerRegisteredEvent -  dataId : {} , groupId : {} , " + "registered : {} , "
74
                        + "source : {}", event.getDataId(), event.getGroupId(), event.isRegistered(), event.getSource());
75
            }
76
        };
77
    }
78

79
    @Bean
80
    public ApplicationListener<NacosConfigPublishedEvent> nacosConfigPublishedEvent() {
81
        return new ApplicationListener<NacosConfigPublishedEvent>() {
82
//            @Override
83
            public void onApplicationEvent(NacosConfigPublishedEvent event) {
84
                logger.info("Listening on NacosConfigPublishedEvent -  dataId : {} , groupId : {} , " + "published : {} , "
85
                        + "source : {}", event.getDataId(), event.getGroupId(), event.isPublished(), event.getSource());
86
            }
87
        };
88
    }
89
}

+ 65 - 0
ipu-rest-scaffold/src/main/java/com/ai/ipu/server/control/NacosConfigController.java

@ -0,0 +1,65 @@
1
package com.ai.ipu.server.control;
2

3
import static com.alibaba.nacos.api.common.Constants.DEFAULT_GROUP;
4

5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
7
import org.springframework.stereotype.Controller;
8
import org.springframework.web.bind.annotation.RequestMapping;
9
import org.springframework.web.bind.annotation.ResponseBody;
10

11
import com.ai.ipu.data.JMap;
12
import com.alibaba.nacos.api.annotation.NacosInjected;
13
import com.alibaba.nacos.api.config.ConfigService;
14
import com.alibaba.nacos.api.config.annotation.NacosValue;
15
import com.alibaba.nacos.api.exception.NacosException;
16
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
17

18
@Controller
19
@RequestMapping("/nacos/config")
20
@NacosPropertySource(dataId = "com.ai.ipu.nacos", autoRefreshed = true)
21
public class NacosConfigController {
22
	private static final Logger logger = LoggerFactory.getLogger(NacosConfigController.class);
23
	
24
	//用于发布消息到配置中心
25
	@NacosInjected
26
    private ConfigService configService;
27
	
28
	//如果配置中心没有dataId以及sql的配置,则取defaultValue
29
	//autoRefreshed:是否动态刷新。如果是动态刷新,则配置中心dataId以及sql的配置发生变动,则取配置中心的数据;
30
	//如果不是动态刷新,则在应用启动时去配置中心获取一次dataId以及sql的配置
31
	@NacosValue(value = "${sql:defaultValue}", autoRefreshed = true)
32
    private String sql;
33
	
34
	 @ResponseBody
35
	 @RequestMapping("/getSql")
36
	 public String getSql(JMap params) throws Exception {
37
		 return sql;
38
	 }
39
	 
40
	 @ResponseBody
41
	 @RequestMapping("/setSql")
42
	 public boolean setSql(JMap params) throws Exception {
43
		 try {
44
			    //将select * from display.tab_page_info发布到配置中心,dataId=com.ai.ipu.nacos,变量名=sql
45
	            configService.publishConfig("com.ai.ipu.nacos", DEFAULT_GROUP, "sql = select * from display.tab_page_info");
46
	            return true;
47
	        } catch (NacosException e) {
48
	            e.printStackTrace();
49
	            return false;
50
	        }
51
	 }
52
	 /* 用于测试热加载 */
53
	 @ResponseBody
54
	 @RequestMapping("/removeSql")
55
	 public boolean removeSql(JMap params) throws Exception {
56
		 try {
57
			    //从配置中心删除配置,dataId=com.ai.ipu.nacos
58
	            configService.removeConfig("com.ai.ipu.nacos", DEFAULT_GROUP);
59
	            return true;
60
	        } catch (NacosException e) {
61
	            e.printStackTrace();
62
	            return false;
63
	        }
64
	 }
65
}

+ 11 - 0
ipu-rest-scaffold/src/main/resources/dev/application.properties

@ -32,3 +32,14 @@ management.context-path=/MyActuator
32 32
management.port=12581
33 33
# 不允许远程管理连接(不允许外部调用保证安全)
34 34
management.address=127.0.0.1
35

36
#设置开启热部署
37
spring.devtools.restart.enabled=true
38
#重启目录
39
spring.devtools.restart.additional-paths=src/main/java
40
spring.devtools.restart.exclude=WEB-INF/**
41
#页面热加载
42
spring.freemarker.cache=false 
43

44
###配置nacos
45
nacos.config.server-addr=10.1.234.70:8848