Explorar el Código

Merge branch 'master' of http://114.215.100.48:3000/ipu/android-share.git

yangbiao %!s(int64=9) %!d(string=hace) años
padre
commit
27663f1084

+ 2 - 0
display-server/etc/server-config.xml

@ -20,6 +20,8 @@
20 20
	<config name="exceptionHandler" value="com.ai.server.core.handle.DisplayExceptionHandler"/>
21 21
	<!-- 自定义Session管理器 -->
22 22
	<config name="sessionManager" value="com.ai.server.core.session.DisplaySessionManager"/>
23
	<!-- 自定义安全管理器 -->
24
	<config name="securityHandler" value="com.ai.server.core.security.DisplaySecurityHandler"/>
23 25
	<!-- 是否运行标签引擎 -->
24 26
	<config name="isUseTag" value="true"/>
25 27
</configs>

+ 12 - 0
display-server/src/com/ai/server/core/security/DisplaySecurityHandler.java

@ -0,0 +1,12 @@
1
package com.ai.server.core.security;
2

3
import com.ailk.mobile.frame.handle.impl.DefaultSecurityHandler;
4

5
public class DisplaySecurityHandler extends DefaultSecurityHandler{
6
	
7
	@Override
8
	public String getResKey() throws Exception {
9
		// TODO Auto-generated method stub
10
		return "77777777";
11
	}
12
}

+ 3 - 0
multiple-client/clean-res.cmd

@ -0,0 +1,3 @@
1
adb shell rm -r /mnt/sdcard/multiple-client
2
adb shell ls /mnt/sdcard/
3
pause

+ 50 - 8
multiple-client/src/com/ai/mobile/multiple/SubAppActivity.java

@ -1,19 +1,29 @@
1 1
package com.ai.mobile.multiple;
2 2

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

3 6
import android.content.pm.PackageManager.NameNotFoundException;
4 7
import android.os.Bundle;
5 8
import android.view.View;
6 9

10
import com.ailk.common.data.IData;
11
import com.ailk.common.data.impl.DataMap;
7 12
import com.wade.mobile.app.AppRecord;
8 13
import com.wade.mobile.app.MobileOperation;
9 14
import com.wade.mobile.app.MobileUtil;
10 15
import com.wade.mobile.frame.activity.TemplateMainActivity;
11
import com.wade.mobile.frame.config.MobileConfig;
16
import com.wade.mobile.frame.config.ServerConfig;
17
import com.wade.mobile.frame.multiple.MultipleManager;
12 18
import com.wade.mobile.frame.template.TemplateWebView;
19
import com.wade.mobile.func.MobileStorage;
20
import com.wade.mobile.func.MobileUI;
13 21
import com.wade.mobile.ui.comp.dialog.ConfirmBlockDialog;
14 22
import com.wade.mobile.ui.view.FlipperLayout;
15 23

16 24
public class SubAppActivity extends TemplateMainActivity{
25
	private static Map<String,Boolean> firstStatus = new HashMap<String,Boolean>();//判断子应用第一次开启状态
26
	
17 27
	@Override
18 28
	public void onCreate(Bundle savedInstanceState) {
19 29
		setTheme(R.style.Theme_Sherlock_Light);
@ -49,30 +59,62 @@ public class SubAppActivity extends TemplateMainActivity{
49 59
		finish();
50 60
	}
51 61
	
62
	@Override
63
	protected void initActivity() throws Exception {
64
		// TODO Auto-generated method stub
65
		firstStatus.put(MultipleManager.getCurrAppId(), false);
66
		IData param = new DataMap();
67
		MobileStorage mobileStorage = getPluginManager().getPlugin(MobileStorage.class);
68
		param.put("SESSION_ID", mobileStorage.getMemoryCache("SESSION_ID", ""));
69
		param.put("ACCOUNT", mobileStorage.getMemoryCache("ACCOUNT", ""));
70
		
71
		String indexPage = getIntent().getStringExtra("INDEX_PAGE");
72
		indexPage = indexPage == null ? ServerConfig.getInstance().getValue("indexPage") : indexPage;
73
		MobileUI mobileUI = getPluginManager().getPlugin(MobileUI.class);
74
		mobileUI.openPage(indexPage, param);
75
	}
76
	
52 77
	/**
53
	 * 不再更新客户端
78
	 * 第二次进入则不做资源更新客户端更新
54 79
	 */
55
	@Override
56
	protected boolean isUpdateClient(String clientVersion) throws NameNotFoundException {
80
	protected boolean isUpdate() {
57 81
		// TODO Auto-generated method stub
58
		return false;
82
		return firstStatus.get(MultipleManager.getCurrAppId()) == null;
59 83
	}
60 84
	
61 85
	/**
62
	 * 不使用欢迎页
86
	 * 不做客户端更新
63 87
	 */
64 88
	@Override
65
	protected boolean isLoadingPage() {
89
	protected boolean isUpdateClient(String clientVersion) throws NameNotFoundException {
66 90
		// TODO Auto-generated method stub
67 91
		return false;
68 92
	}
69 93
	
70 94
	/**
95
	 * 第二次进入则不使用欢迎页的延时配置
96
	 *//*
97
	@Override
98
	protected boolean isUseLoadingTime() {
99
		// TODO Auto-generated method stub
100
		return firstStatus.get(MultipleManager.getCurrAppId()) == null;
101
	}*/
102
	
103
	/**
71 104
	 * 重写指定欢迎页,不同应用使用不同的欢迎页
72 105
	 */
73 106
	@Override
74 107
	protected boolean setLoadingPage() {
75 108
		// TODO Auto-generated method stub
76
		return super.setLoadingPage();
109
		String welcomePage = getIntent().getStringExtra("WELCOME_PAGE");
110
		if (welcomePage != null) {
111
			TemplateWebView templateWebView = new TemplateWebView(this);
112
			templateWebView.loadUrl(welcomePage);
113
			templateWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);//解决2.3版本中 welcome界面右边空白
114
			setContentView(templateWebView);
115
			return true;
116
		} else {
117
			return false;
118
		}
77 119
	}
78 120
}

+ 59 - 35
multiple-client/src/com/ai/mobile/multiple/func/AppManagePlugin.java

@ -19,15 +19,73 @@ import com.wade.mobile.frame.IWadeMobile;
19 19
import com.wade.mobile.frame.multiple.MultipleAppConfig;
20 20
import com.wade.mobile.frame.multiple.MultipleManager;
21 21
import com.wade.mobile.frame.plugin.Plugin;
22
import com.wade.mobile.frame.template.TemplateManager;
23
import com.wade.mobile.util.Constant;
24
import com.wade.mobile.util.FileUtil;
22 25

23 26
public class AppManagePlugin extends Plugin {
24 27
	private Map<String, NativeAppConfig> nativeAppConfigs = new HashMap<String, NativeAppConfig>();
25 28
	private int OPEN_IPU_APP = 1;
29
	private int OPEN_NATIVE_APP = 1;
26 30

27 31
	public AppManagePlugin(IWadeMobile wademobile) {
28 32
		super(wademobile);
29 33
	}
34
	
35
	/**
36
	 * 初始化IPU应用的配置
37
	 */
38
	public void initAppConfig(JSONArray params) throws Exception {
39
		String apps = params.getString(0);
40
		if(isNull(apps)){
41
			error("App配置信息初始化异常!");
42
			return;
43
		}
44
		IDataset appDatas = new DatasetList(apps);
45
		IData appData;
46
		for(Object app : appDatas){
47
			appData = (IData)app;
48
			if("I".equals(appData.getString("appType"))){
49
				MultipleAppConfig appConfig = new MultipleAppConfig(appData.getString("requestHost"),
50
						appData.getString("requestPath"), 
51
						appData.getString("requestServlet"), 
52
						appData.getString("appPath"));
53
				appConfig.putDefine("appWelcomePage", appData.getString("appWelcomePage"));
54
				appConfig.putDefine("appIndexPage", appData.getString("appIndexPage"));
55
				MultipleManager.putAppConfig(appData.getString("appId"), appConfig);
56
			}else if("N".equals(appData.getString("appType"))){
57
				nativeAppConfigs.put(appData.getString("appId"), 
58
						new NativeAppConfig(appData.getString("packageName"), 
59
						appData.getString("className"), 
60
						appData.getString("downloadUrl")));
61
			}
62
		}
63
	}
64
	
65
	/**
66
	 * 打开IPU应用
67
	 */
68
	public void openIpuApp(JSONArray params) throws Exception {
69
		String basePath = TemplateManager.getBasePath();//欢迎页存储在multiple的应用中,所以需要放在setCurrAppId之前
70
		String appId = params.getString(0);
71
		MultipleManager.setCurrAppId(appId);
72
		MultipleManager.setMultiple(true);
73
		Intent intent = new Intent(wademobile.getActivity(), SubAppActivity.class);
74
		
75
		MultipleAppConfig appConfig = MultipleManager.getAppConfig(appId);
76
		
77
		String indexPage = appConfig.getDefine("appIndexPage");
78
		String appWelcomePage = appConfig.getDefine("appWelcomePage");
79
		String welcomePage = Constant.START_FILE + FileUtil.connectFilePath(basePath, appWelcomePage);
80
		
81
		intent.putExtra("INDEX_PAGE", indexPage);//IPU的初始页
82
		intent.putExtra("WELCOME_PAGE", welcomePage);//IPU的欢迎页
83
		startActivityForResult(intent, OPEN_IPU_APP);
84
	}
30 85

86
	/**
87
	 * 打开原生应用
88
	 */
31 89
	public void openNativeApp(JSONArray params) throws Exception {
32 90
		String appId = params.getString(0);
33 91
		NativeAppConfig appConfig = nativeAppConfigs.get(appId);
@ -46,7 +104,7 @@ public class AppManagePlugin extends Plugin {
46 104
			intent.putExtra("STAFF_ID", ipuData.getString("STAFF_ID"));//IPU的sessionId
47 105
			intent.putExtra("ACCOUNT", ipuData.getString("ACCOUNT"));//IPU的登陆账号
48 106
			intent.setComponent(cn);
49
			startActivityForResult(intent, 2);
107
			startActivityForResult(intent, OPEN_NATIVE_APP);
50 108
		}else{
51 109
			String downloadUrl = appConfig.getDownloadUrl();
52 110
			/* 如果应用不存在则需要下载,配置需要下载应用 */
@ -55,39 +113,6 @@ public class AppManagePlugin extends Plugin {
55 113
		}
56 114
	}
57 115

58
	public void initAppConfig(JSONArray params) throws Exception {
59
		String apps = params.getString(0);
60
		if(isNull(apps)){
61
			error("App配置信息初始化异常!");
62
			return;
63
		}
64
		IDataset appDatas = new DatasetList(apps);
65
		IData appData;
66
		for(Object app : appDatas){
67
			appData = (IData)app;
68
			if("I".equals(appData.getString("appType"))){
69
				MultipleManager.putAppConfig(appData.getString("appId"),
70
						new MultipleAppConfig(appData.getString("requestHost"),
71
								appData.getString("requestPath"), 
72
								appData.getString("requestServlet"), 
73
								appData.getString("appPath")));
74
			}else if("N".equals(appData.getString("appType"))){
75
				nativeAppConfigs.put(appData.getString("appId"), 
76
						new NativeAppConfig(appData.getString("packageName"), 
77
						appData.getString("className"), 
78
						appData.getString("downloadUrl")));
79
			}
80
		}
81
	}
82

83
	public void openIpuApp(JSONArray params) throws Exception {
84
		String appId = params.getString(0);
85
		MultipleManager.setCurrAppName(appId);
86
		MultipleManager.setMultiple(true);
87
		Intent intent = new Intent(wademobile.getActivity(), SubAppActivity.class);
88
		startActivityForResult(intent, OPEN_IPU_APP);
89
	}
90

91 116
	@Override
92 117
	public void onActivityResult(int requestCode, int resultCode, Intent intent) {
93 118
		// TODO Auto-generated method stub
@ -96,7 +121,6 @@ public class AppManagePlugin extends Plugin {
96 121
		}
97 122
	}
98 123
	
99
	
100 124
	/**
101 125
	 * @author huangbo
102 126
	 * 平台级应用中原生应用的配置对象

+ 1 - 0
multiple-server/build/build.properties

@ -13,6 +13,7 @@ encrypt=${web}/encrypt
13 13
version_class=com.ailk.mobile.tool.VersionTool
14 14
encrypt_class=com.ailk.mobile.tool.FileEncryptTool
15 15
version_filter=setup|.gitignore
16
encrypt_filter=welcome
16 17
is_debug=false
17 18

18 19
encode=UTF-8

+ 5 - 5
multiple-server/etc/app-config.xml

@ -1,15 +1,15 @@
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<apps>
3 3
	<app appId="display" appName="IPU展示" appType="I" appIcon="e_ico-qr"
4
		appWelcomePage="WelcomeDisplay" requestHost="http://114.215.100.48:8080"
4
		appWelcomePage="welcome/WelcomeDisplay.htm" requestHost="http://10.0.2.2:8080"
5 5
		requestPath="/display" requestServlet="/mobiledata" appPath="display-client" />
6 6

7
	<app appId="ioo" appName="广东统一平台" appType="I" appIcon="e_ico-audio"
8
		appWelcomePage="WelcomeIoo" requestHost="http://114.215.100.48:8080"
7
	<app appId="ioo" appName="广东统一平台" appType="I" appIcon="e_ico-audio" appIndexPage="Home"
8
		appWelcomePage="welcome/WelcomeIoo.htm" requestHost="http://114.215.100.48:8080"
9 9
		requestPath="/ioo" requestServlet="/mobiledata" appPath="ioo-client" />
10 10
	
11
	<app appId="mutl" appName="1vsN平台" appType="I" appIcon="e_ico-file"
12
		appWelcomePage="WelcomeDisplay" requestHost="http://10.0.2.2:8080"
11
	<app appId="mutl" appName="1vsN平台" appType="I" appIcon="e_ico-file" appIndexPage="Index"
12
		appWelcomePage="welcome/WelcomeDisplay.htm" requestHost="http://10.0.2.2:8080"
13 13
		requestPath="/mutl" requestServlet="/mobiledata" appPath="mutl-client" />
14 14

15 15
	<app appId="native" appName="原生案例" appType="N" appIcon="e_ico-storage"

+ 0 - 3
multiple-server/etc/server-page.xml

@ -3,7 +3,4 @@
3 3
    <!-- 工作台 -->
4 4
    <action name="Login" template="template/webapp/Login.html" data="LoginBean.init"></action>
5 5
 	<action name="Index" template="template/webapp/Index.html" data="IndexBean.getAppDatas"></action>
6
 	
7
 	<action name="WelcomeDisplay" template="template/webapp/welcome/welcome-display.html"></action>
8
 	<action name="IooDisplay" template="template/webapp/welcome/welcome-ioo.html"></action>
9 6
</pages>

+ 3 - 0
multiple-server/src/com/ai/server/multiple/core/config/AppConfig.java

@ -67,6 +67,9 @@ public class AppConfig extends AbstractConfig {
67 67
			if(((Element) node).attributeValue(Constant.AppConfig.DOWNLOAD_URL)!=null)
68 68
				appMap.put(Constant.AppConfig.DOWNLOAD_URL, 
69 69
						((Element) node).attributeValue(Constant.AppConfig.DOWNLOAD_URL));
70
			if(((Element) node).attributeValue(Constant.AppConfig.APP_INDEX_PAGE)!=null)
71
				appMap.put(Constant.AppConfig.APP_INDEX_PAGE, 
72
						((Element) node).attributeValue(Constant.AppConfig.APP_INDEX_PAGE));
70 73
			
71 74
			results.add(appMap);
72 75
		}

+ 2 - 0
multiple-server/src/com/ai/server/multiple/util/Constant.java

@ -36,6 +36,8 @@ public class Constant {
36 36
		public static final String APP_TYPE = "appType";
37 37
		public static final String APP_ICON = "appIcon";
38 38
		public static final String APP_WELCOME_PAGE = "appWelcomePage";
39
		public static final String APP_INDEX_PAGE = "appIndexPage";
40
		
39 41
		public static final String REQUEST_HOST = "requestHost";
40 42
		public static final String REQUEST_PATH = "requestPath";
41 43
		public static final String REQUEST_SERVLET = "requestServlet";

+ 10 - 0
multiple-server/web/welcome/WelcomeDisplay.htm

@ -0,0 +1,10 @@
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
<html>
3
<head>
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Insert title here</title>
6
</head>
7
<body>
8
<center>Display欢迎页面</center>
9
</body>
10
</html>

+ 10 - 0
multiple-server/web/welcome/WelcomeIoo.htm

@ -0,0 +1,10 @@
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
<html>
3
<head>
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Insert title here</title>
6
</head>
7
<body>
8
<center>Ioo欢迎页面</center>
9
</body>
10
</html>

BIN
wade-mobile-common/libs/wade-mobile-com.jar


BIN
wade-mobile-common/libs/wade-mobile-func.jar


BIN
wade-mobile-common/libs/wade-mobile.jar


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