use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class ServerManageResource method getServicesStatus.
@Path("server/status")
@GET
public DataVO<ServicesStatusVO> getServicesStatus(@QueryParam("machineIp") String machineIp) {
try {
Map<String, ServerManageService.ServiceStatus> status = serverManageService.serviceStatusRest(machineIp);
ServerManageService.ServiceStatus zkStatus = status.get("zookeeper");
ServerManageService.ServiceStatus stormStatus = status.get("storm");
return new DataVO<>(new ServicesStatusVO(zkStatus, stormStatus));
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class ServerManageResource method deleteServerInfo.
@Path("server/{machineName}")
@DELETE
public DataVO<ServerInfoVO> deleteServerInfo(@QueryParam("userCode") String userCode, @PathParam("machineName") String machineName) {
sessionDataStore.setCurrentUserCode(userCode);
try {
JSONObject json = serverManageService.deleteServerInfo(machineName);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(new ServerInfoVO(json));
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class TopologyManageResource method submitTopology.
/**
* 提交输入的拓扑配置信息到Storm集群中
*
* @param userCode 操作用户代码
* @param topologyId 拓扑关键字ID,如果是新增,则为null
* @param topologyConfigJsonStr 计算拓扑配置信息
* @return 提交成功返回提交的拓扑对象,否则返回错误信息。
*/
@Path("topology/submit")
@POST
public DataVO<TopologyVO> submitTopology(@QueryParam("userCode") String userCode, @QueryParam("topologyId") String topologyId, String topologyConfigJsonStr) {
sessionDataStore.setCurrentUserCode(userCode);
try {
Topology topology = topologyManageService.submit(topologyId, topologyConfigJsonStr);
TopologyVO topologyVO = new TopologyVO();
TopologyVO.transform(topology, topologyVO);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(topologyVO);
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class TopologyManageResource method submitTopology.
/**
* 提交指定关键字ID的计算拓扑到Storm集群中
*
* @param userCode 操作用户代码
* @param simulation 设置为true表示本地仿真,否则真正提交集群
* @param id 拓扑的关键字ID
* @return 提交成功返回提交的拓扑对象,否则返回错误信息。
*/
@Path("topology/submit/{id}")
@GET
public DataVO<TopologyVO> submitTopology(@QueryParam("userCode") String userCode, @QueryParam("simulation") boolean simulation, @PathParam("id") String id) {
sessionDataStore.setCurrentUserCode(userCode);
try {
Topology topology = topologyManageService.submit(id, simulation);
TopologyVO topologyVO = new TopologyVO();
TopologyVO.transform(topology, topologyVO);
return new DataVO<>(topologyVO);
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
use of com.ds.retl.exception.UserInterfaceErrorException in project main by JohnPeng739.
the class TopologyManageResource method getTopologyRealStatus.
@Path("topologies/realStatus")
@GET
public DataVO<List<TopologyRealStatusVO>> getTopologyRealStatus(@QueryParam("topologyIds") String topologyIds) {
if (StringUtils.isBlank(topologyIds)) {
return new DataVO<>(new UserInterfaceErrorException(UserInterfaceErrors.SYSTEM_ILLEGAL_PARAM));
}
try {
String[] ids = topologyIds.split(",");
JSONArray topologies = stormClient.getToptologies();
List<TopologyRealStatusVO> list = new ArrayList<>();
if (topologies != null && topologies.size() > 0) {
for (String id : ids) {
for (int index = 0; index < topologies.size(); index++) {
JSONObject item = topologies.getJSONObject(index);
if (item == null) {
continue;
}
if (id.equals(item.getString("id"))) {
list.add(new TopologyRealStatusVO(item));
}
}
}
}
return new DataVO<>(list);
} catch (UserInterfaceErrorException ex) {
return new DataVO<>(ex);
}
}
Aggregations