Search in sources :

Example 1 with TopologyVO

use of com.ds.retl.rest.vo.topology.TopologyVO 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);
    }
}
Also used : PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException) Topology(com.ds.retl.dal.entity.Topology) TopologyVO(com.ds.retl.rest.vo.topology.TopologyVO)

Example 2 with TopologyVO

use of com.ds.retl.rest.vo.topology.TopologyVO 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);
    }
}
Also used : PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException) Topology(com.ds.retl.dal.entity.Topology) TopologyVO(com.ds.retl.rest.vo.topology.TopologyVO)

Example 3 with TopologyVO

use of com.ds.retl.rest.vo.topology.TopologyVO in project main by JohnPeng739.

the class TopologyManageResource method saveTopology.

/**
 * 保存输入的拓扑配置信息
 *
 * @param userCode              操作用户代码
 * @param topologyId            拓扑关键字ID,如果是新增,则为null
 * @param topologyConfigJsonStr 计算拓扑配置信息
 * @return 保存成功返回提交的拓扑对象,否则返回错误信息。
 */
@Path("topology/save")
@POST
public DataVO<TopologyVO> saveTopology(@QueryParam("userCode") String userCode, @QueryParam("topologyId") String topologyId, String topologyConfigJsonStr) {
    sessionDataStore.setCurrentUserCode(userCode);
    try {
        Topology topology = topologyManageService.save(topologyId, topologyConfigJsonStr);
        TopologyVO topologyVO = new TopologyVO();
        TopologyVO.transform(topology, topologyVO);
        sessionDataStore.removeCurrentUserCode();
        return new DataVO<>(topologyVO);
    } catch (UserInterfaceErrorException ex) {
        return new DataVO<>(ex);
    }
}
Also used : PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException) Topology(com.ds.retl.dal.entity.Topology) TopologyVO(com.ds.retl.rest.vo.topology.TopologyVO)

Example 4 with TopologyVO

use of com.ds.retl.rest.vo.topology.TopologyVO in project main by JohnPeng739.

the class TopologyManageResource method killTopology.

/**
 * 杀死集群中的计算拓扑
 *
 * @param userCode   操作用户代码
 * @param topologyId 拓扑关键字ID
 * @return 操作成功后的拓扑对象
 */
@Path("topology/kill")
@GET
public DataVO<TopologyVO> killTopology(@QueryParam("userCode") String userCode, @QueryParam("topologyId") String topologyId) {
    sessionDataStore.setCurrentUserCode(userCode);
    try {
        Topology topology = topologyManageService.kill(topologyId);
        TopologyVO topologyVO = new TopologyVO();
        TopologyVO.transform(topology, topologyVO);
        sessionDataStore.removeCurrentUserCode();
        return new DataVO<>(topologyVO);
    } catch (UserInterfaceErrorException ex) {
        return new DataVO<>(ex);
    }
}
Also used : PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException) Topology(com.ds.retl.dal.entity.Topology) TopologyVO(com.ds.retl.rest.vo.topology.TopologyVO)

Example 5 with TopologyVO

use of com.ds.retl.rest.vo.topology.TopologyVO in project main by JohnPeng739.

the class TopologyManageResource method getTopology.

/**
 * 根据拓扑数据库ID获取拓扑信息
 *
 * @param topologyId 关键字ID,不是集群中的ID
 * @return 拓扑值对象
 */
@Path("topology")
@GET
public DataVO<TopologyVO> getTopology(@QueryParam("topologyId") String topologyId) {
    try {
        Topology topology = accessor.getById(topologyId, Topology.class);
        TopologyVO vo = new TopologyVO();
        TopologyVO.transform(topology, vo);
        return new DataVO<>(vo);
    } catch (EntityAccessException ex) {
        if (logger.isErrorEnabled()) {
            logger.error(ex);
        }
        return new DataVO<>(new UserInterfaceErrorException(UserInterfaceErrors.DB_OPERATE_FAIL));
    }
}
Also used : PaginationDataVO(org.mx.rest.vo.PaginationDataVO) DataVO(org.mx.rest.vo.DataVO) UserInterfaceErrorException(com.ds.retl.exception.UserInterfaceErrorException) EntityAccessException(org.mx.dal.exception.EntityAccessException) Topology(com.ds.retl.dal.entity.Topology) TopologyVO(com.ds.retl.rest.vo.topology.TopologyVO)

Aggregations

Topology (com.ds.retl.dal.entity.Topology)5 UserInterfaceErrorException (com.ds.retl.exception.UserInterfaceErrorException)5 TopologyVO (com.ds.retl.rest.vo.topology.TopologyVO)5 DataVO (org.mx.rest.vo.DataVO)5 PaginationDataVO (org.mx.rest.vo.PaginationDataVO)5 EntityAccessException (org.mx.dal.exception.EntityAccessException)1