use of org.mx.rest.vo.DataVO in project main by JohnPeng739.
the class RetlStatisticResource method getRetlStatistic.
@Path("retl-statistic")
@GET
public DataVO<RetlStatisticVO> getRetlStatistic() {
// 尚未真正实现,这里模拟山东省的数据
String[] cities = { "济南市", "青岛市", "烟台市", "德州市", "泰安市", "临沂市", "威海市", "东营市", "济宁市", "日照市", "淄博市", "枣庄市", "潍坊市", "滨州市", "菏泽市", "莱芜市", "聊城市" };
RetlStatisticVO vo = new RetlStatisticVO();
Random random = new Random();
for (String city : cities) {
int total = random.nextInt(5000);
int error = random.nextInt(total);
vo.add(city, total, error);
}
return new DataVO<>(vo);
}
use of org.mx.rest.vo.DataVO 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 org.mx.rest.vo.DataVO 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 org.mx.rest.vo.DataVO 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 org.mx.rest.vo.DataVO in project main by JohnPeng739.
the class TopologyManageResource method getSupported.
/**
* 获取系统中相关的各种支持列表信息
*
* @return 支持信息列表
*/
@Path("topology/supported")
@GET
public DataVO<SupportedVO> getSupported() {
SupportedVO supportedVO = new SupportedVO();
// get JMS supported
List<LabelValueVO> supportedJms = new ArrayList<>();
for (JmsManager.Supported s : JmsManager.Supported.values()) {
supportedJms.add(new LabelValueVO(s.name(), s.name()));
}
Collections.sort(supportedJms);
supportedVO.setJmsTypes(supportedJms);
// get validate types
List<String> validateClasses = ClassUtils.scanPackage("com.ds.retl.validate");
List<LabelValueVO> validateTypes = this.transform(validateClasses);
Collections.sort(validateTypes);
supportedVO.setValidateTypes(validateTypes);
// get validate rule types
TypeValidateFunc.ValueType[] types = TypeValidateFunc.ValueType.values();
List<LabelValueVO> supportedValidateRules = new ArrayList<>();
for (TypeValidateFunc.ValueType type : types) {
switch(type) {
case STRING:
supportedValidateRules.add(new LabelValueVO("1. 字符串类型", type.name()));
break;
case DATE:
supportedValidateRules.add(new LabelValueVO("2. 时间类型", type.name()));
break;
case INT:
supportedValidateRules.add(new LabelValueVO("3. 整数", type.name()));
break;
case DECIMAL:
supportedValidateRules.add(new LabelValueVO("4. 小数类型", type.name()));
break;
case BOOL:
supportedValidateRules.add(new LabelValueVO("5. 布尔类型", type.name()));
break;
default:
if (logger.isWarnEnabled()) {
logger.warn(String.format("Unsupported type: %s.", type));
}
}
}
Collections.sort(supportedValidateRules);
supportedVO.setValidateRuleTypes(supportedValidateRules);
// get transform types
List<String> transformClasses = ClassUtils.scanPackage("com.ds.retl.transform");
List<LabelValueVO> transformTypes = this.transform(transformClasses);
Collections.sort(transformTypes);
supportedVO.setTransformTypes(transformTypes);
return new DataVO<>(supportedVO);
}
Aggregations