use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GodEyeRestService method noitifyEvent.
@POST
@Path("notify/q/event/hm")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void noitifyEvent(@Suspended AsyncResponse response) throws Exception {
HashMap<String, Object> requestParam = new HashMap<String, Object>();
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("distinct", "eventid");
requestParam.put("group", data);
List<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>();
// 过滤数据,只查询最近的指定数据 begin
HashMap<String, Object> sortMap = new HashMap<String, Object>();
HashMap<String, Object> sort = new HashMap<String, Object>();
sort.put("values", "time");
sort.put("sortorder", "-1");
sortMap.put("sort", sort);
list.add(sortMap);
// modify start : 只返回firstrecord为true的事件id
HashMap<String, Object> firstRecord = new HashMap<String, Object>();
HashMap<String, Object> firstRecordMatch = new HashMap<String, Object>();
firstRecord.put("firstrecord", "true");
firstRecordMatch.put("match", firstRecord);
list.add(firstRecordMatch);
// modify end
HashMap<String, Object> skipMap = new HashMap<String, Object>();
skipMap.put("skip", mongodbQueryRangeMap.get("skip"));
list.add(skipMap);
HashMap<String, Object> limitMap = new HashMap<String, Object>();
limitMap.put("limit", mongodbQueryRangeMap.get("limit"));
list.add(limitMap);
// 过滤数据,只查询最近的指定数据 end
list.add(requestParam);
// 封装http请求数据
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("mgo.sql", JSONHelper.toString(list));
message.putRequest("datastore.name", "MT_Notify");
message.putRequest("mgo.coll.name", "uav_notify");
NoitifyEventCB callback = new NoitifyEventCB();
callback.setResponse(response);
doHttpPost("uav.app.godeye.healthmanager.http.addr", "/hm/query", message, callback);
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GodEyeRestService method queryAppLog.
@Deprecated
protected void queryAppLog(String data, AsyncResponse response) {
UAVHttpMessage message = new UAVHttpMessage();
message.putRequest("hbase.query.json", data);
message.putRequest("datastore.name", MonitorDataFrame.MessageType.Log.toString());
QueryAppLogCB callback = new QueryAppLogCB();
callback.setResponse(response);
this.doHttpPost("uav.app.godeye.healthmanager.http.addr", "/hm/query", message, callback);
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class GodEyeRestService method searchNewLog.
// ---------------------------------------新日志服务接口 START-----------------------------------
/**
* searchNewLog
*
* @param data
* @param resp
*/
@POST
@Path("/newlog/q")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void searchNewLog(String data, @Suspended AsyncResponse resp) {
UAVHttpMessage msg = new UAVHttpMessage(data);
doHttpPost("uav.app.hm.newlog.http.addr", "/newlog/q", msg, new SearchNewLogCallback(resp));
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class ManageRestService method getRequestData.
// tools begin---------------------------------------------------------->
/**
* 打包请求数据
*
* @param type
* @param mapParam
* @return
*/
private byte[] getRequestData(String type, Map<String, Object> mapParam) {
Map<String, String> dbInfo = getDBInfo(type);
UAVHttpMessage request = new UAVHttpMessage();
request.putRequest("mrd.data", JSONHelper.toString(mapParam));
request.putRequest("datastore.name", dbInfo.get("dataStoreName"));
request.putRequest("mgo.coll.name", dbInfo.get("conllectionName"));
String jsonStr = JSONHelper.toString(request);
byte[] datab = null;
try {
datab = jsonStr.getBytes("utf-8");
} catch (Exception e) {
logger.err(this, "ManageBaseRestService getRequestData \n" + e.getMessage());
throw new ApphubException(e);
}
return datab;
}
use of com.creditease.agent.http.api.UAVHttpMessage in project uavstack by uavorg.
the class XRobotRestService method doCommand.
@POST
@Path("command")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void doCommand(String data, @Suspended AsyncResponse response) {
UAVHttpMessage msg = new UAVHttpMessage(data);
this.doHttpPost("uav.app.xrobot.http.addr", "/hit/xrobot", msg, new CmdCallback(response));
}
Aggregations