ESBCamelController.java 5.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.yihu.hos.controllers;
  2. import com.yihu.ehr.framework.model.Result;
  3. import com.yihu.hos.services.ESBCamelService;
  4. import io.swagger.annotations.ApiOperation;
  5. import io.swagger.annotations.ApiParam;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RequestMethod;
  9. import org.springframework.web.bind.annotation.RequestParam;
  10. import org.springframework.web.bind.annotation.ResponseBody;
  11. import javax.annotation.Resource;
  12. /**
  13. * Created by lingfeng on 2016/8/4.
  14. */
  15. @Controller
  16. @RequestMapping("/esb")
  17. public class ESBCamelController {
  18. @Resource(name= ESBCamelService.BEAN_ID)
  19. ESBCamelService esbCamelService;
  20. @RequestMapping(value = "/processor", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
  21. @ResponseBody
  22. @ApiOperation(value = "新增Processor处理器", produces = "application/json", notes = "当外界组件通知一个新的processor处理器被定义时,该事件被触发")
  23. public Result onProcessorAdded(
  24. @ApiParam(name = "serviceFlow", value = "服务名称", required = true)
  25. @RequestParam(value = "serviceFlow") String serviceFlow,
  26. @ApiParam(name = "packageName", value = "包名", required = true)
  27. @RequestParam(value = "packageName") String packageName,
  28. @ApiParam(name = "className", value = "类名", required = true)
  29. @RequestParam(value = "className") String className,
  30. @ApiParam(name = "path", value = "class文件路径", required = true)
  31. @RequestParam(value = "path") String path) {
  32. return Result.success("成功!");
  33. // return esbCamelService.onProcessorAdded(serviceFlow, packageName, className, path);
  34. }
  35. @RequestMapping(value = "/processor", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
  36. @ResponseBody
  37. @ApiOperation(value = "修改Processor处理器", produces = "application/json", notes = "当外界组件通知一个已有的processor处理器data部分发生变化时,该事件被触发")
  38. public Result onProcessorDataChanged(
  39. @ApiParam(name = "serviceFlow", value = "服务名称", required = true)
  40. @RequestParam(value = "serviceFlow") String serviceFlow,
  41. @ApiParam(name = "packageName", value = "包名", required = true)
  42. @RequestParam(value = "packageName") String packageName,
  43. @ApiParam(name = "className", value = "类名", required = true)
  44. @RequestParam(value = "className") String className,
  45. @ApiParam(name = "path", value = "class文件路径", required = true)
  46. @RequestParam(value = "path") String path) {
  47. return esbCamelService.onProcessorDataChanged(serviceFlow, packageName, className, path);
  48. }
  49. @RequestMapping(value = "/route", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
  50. @ResponseBody
  51. @ApiOperation(value = "新增Route路由", produces = "application/json", notes = "当外界组件通知一个新的RouteDefine路由被定义时,该事件被触发")
  52. public Result onRouteDefineAdded(
  53. @ApiParam(name = "serviceFlow", value = "服务名称", required = true)
  54. @RequestParam(value = "serviceFlow") String serviceFlow,
  55. @ApiParam(name = "packageName", value = "包名", required = true)
  56. @RequestParam(value = "packageName") String packageName,
  57. @ApiParam(name = "className", value = "类名", required = true)
  58. @RequestParam(value = "className") String className,
  59. @ApiParam(name = "path", value = "class文件路径", required = true)
  60. @RequestParam(value = "path") String path) {
  61. return esbCamelService.onRouteDefineAdded(serviceFlow, packageName, className, path);
  62. }
  63. @RequestMapping(value = "/route", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
  64. @ResponseBody
  65. @ApiOperation(value = "修改Route路由", produces = "application/json", notes = "当外界组件通知一个已有的RouteDefine路由定义被改变时,主要就是路由定义内容被改变时,该事件被触发")
  66. public Result onRouteDefineChanged(
  67. @ApiParam(name = "serviceFlow", value = "服务名称", required = true)
  68. @RequestParam(value = "serviceFlow") String serviceFlow,
  69. @ApiParam(name = "packageName", value = "包名", required = true)
  70. @RequestParam(value = "packageName") String packageName,
  71. @ApiParam(name = "className", value = "类名", required = true)
  72. @RequestParam(value = "className") String className,
  73. @ApiParam(name = "path", value = "class文件路径", required = true)
  74. @RequestParam(value = "path") String path) {
  75. return esbCamelService.onRouteDefineChanged(serviceFlow, packageName, className, path);
  76. }
  77. @RequestMapping(value = "/route", produces = "application/json;charset=UTF-8", method = RequestMethod.DELETE)
  78. @ResponseBody
  79. @ApiOperation(value = "删除Route路由", produces = "application/json", notes = "当外界组件通知一个已有的RouteDefine路由定义被删除时,该事件被触发")
  80. public Result onRouteDefineDelete(
  81. @ApiParam(name = "serviceFlow", value = "服务名称", required = true)
  82. @RequestParam(value = "serviceFlow") String serviceFlow,
  83. @ApiParam(name = "packageName", value = "包名", required = true)
  84. @RequestParam(value = "packageName") String packageName,
  85. @ApiParam(name = "className", value = "类名", required = true)
  86. @RequestParam(value = "className") String className) {
  87. return esbCamelService.onRouteDefineDelete(serviceFlow, packageName, className);
  88. }
  89. }