kerry
7 years ago
4 changed files with 0 additions and 208 deletions
@ -1,42 +0,0 @@
|
||||
package com.fr.design.extra.exe; |
||||
|
||||
import com.fr.design.extra.PluginHelper; |
||||
import com.fr.design.extra.Process; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.general.http.HttpClient; |
||||
|
||||
/** |
||||
* Created by vito on 16/5/16. |
||||
*/ |
||||
public class GetPluginCategoriesExecutor implements Executor { |
||||
private String result = "[]"; |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
String url = SiteCenter.getInstance().acquireUrlByKind("plugin.category"); |
||||
if (url != null) { |
||||
HttpClient httpClient = new HttpClient(url); |
||||
result = httpClient.getResponseText(); |
||||
} else { |
||||
result = PluginHelper.CONNECTION_404; |
||||
} |
||||
|
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -1,68 +0,0 @@
|
||||
package com.fr.design.extra.exe; |
||||
|
||||
import com.fr.design.extra.PluginHelper; |
||||
import com.fr.design.extra.Process; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.general.http.HttpClient; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* Created by vito on 16/4/18. |
||||
* 获取插件分类信息 |
||||
*/ |
||||
public class GetPluginFromStoreExecutor implements Executor { |
||||
private String result = "[]"; |
||||
private String category; |
||||
private String seller; |
||||
private String fee; |
||||
|
||||
public GetPluginFromStoreExecutor(String category, String seller, String fee) { |
||||
this.category = category; |
||||
this.seller = seller; |
||||
this.fee = fee; |
||||
} |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
String plistUrl = SiteCenter.getInstance().acquireUrlByKind("plugin.plist"); |
||||
if (StringUtils.isNotBlank(plistUrl)) { |
||||
StringBuilder url = new StringBuilder(); |
||||
url.append(plistUrl); |
||||
if (StringUtils.isNotBlank(category)) { |
||||
url.append("&cid=").append(category.split("-")[1]); |
||||
} |
||||
if (StringUtils.isNotBlank(seller)) { |
||||
url.append("&seller=").append(seller.split("-")[1]); |
||||
} |
||||
if (StringUtils.isNotBlank(fee)) { |
||||
url.append("&fee=").append(fee.split("-")[1]); |
||||
} |
||||
try { |
||||
HttpClient httpClient = new HttpClient(url.toString()); |
||||
result = httpClient.getResponseText(); |
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} else { |
||||
result = PluginHelper.CONNECTION_404; |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -1,51 +0,0 @@
|
||||
package com.fr.design.extra.exe; |
||||
|
||||
import com.fr.design.extra.PluginsReaderFromStore; |
||||
import com.fr.design.extra.Process; |
||||
import com.fr.general.FRLogger; |
||||
|
||||
import com.fr.plugin.Plugin; |
||||
import com.fr.stable.StringUtils; |
||||
import org.json.JSONArray; |
||||
import org.json.JSONObject; |
||||
|
||||
/** |
||||
* Created by vito on 16/4/19. |
||||
*/ |
||||
public class ReadUpdateOnlineExecutor implements Executor { |
||||
private Plugin[] plugins; |
||||
private String result; |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
try { |
||||
plugins = PluginsReaderFromStore.readPluginsForUpdate(); |
||||
JSONArray jsonArray = new JSONArray(); |
||||
for (Plugin plugin : plugins) { |
||||
JSONObject jsonObject = new JSONObject(); |
||||
jsonObject.put("pluginid", plugin.getId()); |
||||
jsonArray.put(jsonObject); |
||||
} |
||||
result = jsonArray.toString(); |
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -1,47 +0,0 @@
|
||||
package com.fr.design.extra.exe; |
||||
|
||||
import com.fr.design.extra.Process; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.SiteCenter; |
||||
import com.fr.general.http.HttpClient; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* Created by vito on 16/4/18. |
||||
*/ |
||||
public class SearchOnlineExecutor implements Executor { |
||||
private String result; |
||||
private String keyword; |
||||
|
||||
public SearchOnlineExecutor(String keyword) { |
||||
this.keyword = keyword; |
||||
} |
||||
|
||||
@Override |
||||
public String getTaskFinishMessage() { |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public Command[] getCommands() { |
||||
return new Command[]{ |
||||
new Command() { |
||||
@Override |
||||
public String getExecuteMessage() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public void run(Process<String> process) { |
||||
try { |
||||
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.plist") + "&keyword=" + keyword); |
||||
result = httpClient.getResponseText(); |
||||
|
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
} |
Loading…
Reference in new issue