|
|
|
@ -54,6 +54,7 @@ public class PluginWebBridge {
|
|
|
|
|
private static final String THREAD_NAME_TEMPLATE = "pluginbridge-thread-%s"; |
|
|
|
|
private static final String ACTION = "action"; |
|
|
|
|
private static final String KEYWORD = "keyword"; |
|
|
|
|
private static final String PLUGIN_INFO = "pluginInfo"; |
|
|
|
|
private static final int COREPOOLSIZE = 3; |
|
|
|
|
private static final int MAXPOOLSIZE = 5; |
|
|
|
|
|
|
|
|
@ -72,20 +73,7 @@ public class PluginWebBridge {
|
|
|
|
|
new LinkedBlockingQueue<Runnable>(COREPOOLSIZE), |
|
|
|
|
new ThreadFactoryBuilder().setNameFormat(THREAD_NAME_TEMPLATE).build()); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 动作枚举 |
|
|
|
|
*/ |
|
|
|
|
public enum ACTIONS { |
|
|
|
|
SEARCH("search"); |
|
|
|
|
private String context; |
|
|
|
|
|
|
|
|
|
ACTIONS(String context) { |
|
|
|
|
this.context = context; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getContext() { |
|
|
|
|
return context; |
|
|
|
|
} |
|
|
|
|
private PluginWebBridge() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static PluginWebBridge getHelper() { |
|
|
|
@ -106,9 +94,6 @@ public class PluginWebBridge {
|
|
|
|
|
return helper; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private PluginWebBridge() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取打开动作配置 |
|
|
|
|
* |
|
|
|
@ -155,12 +140,26 @@ public class PluginWebBridge {
|
|
|
|
|
* |
|
|
|
|
* @param keyword 关键词 |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
public void openWithSearch(String keyword) { |
|
|
|
|
HashMap<String, Object> map = new HashMap<String, Object>(2); |
|
|
|
|
map.put(KEYWORD, keyword); |
|
|
|
|
setRunConfig(ACTIONS.SEARCH, map); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据插件信息跳转到应用中心 |
|
|
|
|
* |
|
|
|
|
* @param keyword |
|
|
|
|
* @param pluginInfo |
|
|
|
|
*/ |
|
|
|
|
public void showResultInStore(String keyword, String pluginInfo) { |
|
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
|
map.put(KEYWORD, keyword); |
|
|
|
|
map.put(PLUGIN_INFO, pluginInfo); |
|
|
|
|
setRunConfig(ACTIONS.SHOW_RESULT, map); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setEngine(WebEngine webEngine) { |
|
|
|
|
this.webEngine = webEngine; |
|
|
|
|
} |
|
|
|
@ -182,7 +181,6 @@ public class PluginWebBridge {
|
|
|
|
|
PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从磁盘上选择插件安装包进行安装 |
|
|
|
|
* |
|
|
|
@ -204,7 +202,6 @@ public class PluginWebBridge {
|
|
|
|
|
PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 从插件服务器上更新选中的插件 |
|
|
|
|
* |
|
|
|
@ -342,17 +339,31 @@ public class PluginWebBridge {
|
|
|
|
|
* @param callback 回调函数 |
|
|
|
|
*/ |
|
|
|
|
public void getPluginFromStore(String category, String seller, String fee, final JSObject callback) { |
|
|
|
|
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee)); |
|
|
|
|
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(category, seller, fee, "")); |
|
|
|
|
threadPoolExecutor.submit(task); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据条件获取在线插件 |
|
|
|
|
* |
|
|
|
|
* @param info 插件信息 |
|
|
|
|
* @param callback 回调函数 |
|
|
|
|
*/ |
|
|
|
|
public void getPluginFromStoreNew(String info, final JSObject callback) { |
|
|
|
|
try { |
|
|
|
|
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginFromStoreExecutor(new JSONObject(info))); |
|
|
|
|
threadPoolExecutor.submit(task); |
|
|
|
|
} catch (JSONException e) { |
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void getPluginPrefix(final JSObject callback) { |
|
|
|
|
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginPrefixExecutor()); |
|
|
|
|
threadPoolExecutor.submit(task); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 在线获取插件分类 |
|
|
|
|
* |
|
|
|
@ -487,9 +498,6 @@ public class PluginWebBridge {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------登录部分的处理----------------------------------*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 注册页面 |
|
|
|
|
*/ |
|
|
|
@ -501,6 +509,9 @@ public class PluginWebBridge {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------登录部分的处理----------------------------------*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 忘记密码 |
|
|
|
|
*/ |
|
|
|
@ -577,4 +588,20 @@ public class PluginWebBridge {
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 动作枚举 |
|
|
|
|
*/ |
|
|
|
|
public enum ACTIONS { |
|
|
|
|
SEARCH("search"), SHOW_RESULT("showResult"); |
|
|
|
|
private String context; |
|
|
|
|
|
|
|
|
|
ACTIONS(String context) { |
|
|
|
|
this.context = context; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getContext() { |
|
|
|
|
return context; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|