From d2e00336e824c6fe34d33f2e7b8f18f956e1cdf8 Mon Sep 17 00:00:00 2001 From: 6092002067 Date: Mon, 13 Mar 2017 16:47:53 +0800 Subject: Change the method returns the result Change-Id: I2847f9b81d2b96214c56fe7188b4d6d94af60672 Issue-ID: HOLMES-47 Signed-off-by: youbowu --- .../org/openo/holmes/engine/resources/EngineResources.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'engine-d/src') diff --git a/engine-d/src/main/java/org/openo/holmes/engine/resources/EngineResources.java b/engine-d/src/main/java/org/openo/holmes/engine/resources/EngineResources.java index c125d07..0025695 100644 --- a/engine-d/src/main/java/org/openo/holmes/engine/resources/EngineResources.java +++ b/engine-d/src/main/java/org/openo/holmes/engine/resources/EngineResources.java @@ -33,7 +33,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import lombok.extern.slf4j.Slf4j; -import net.sf.json.JSONObject; import org.jvnet.hk2.annotations.Service; import org.openo.holmes.common.api.entity.ServiceRegisterEntity; import org.openo.holmes.common.config.MicroServiceConfig; @@ -72,8 +71,8 @@ public class EngineResources { @ApiOperation(value = "Add rule to Engine and Cache", response = CorrelationRuleResponse.class) @Produces(MediaType.APPLICATION_JSON) @Timed - public String deployRule(DeployRuleRequest deployRuleRequest, - @Context HttpServletRequest httpRequest) { + public CorrelationRuleResponse deployRule(DeployRuleRequest deployRuleRequest, + @Context HttpServletRequest httpRequest) { CorrelationRuleResponse crResponse = new CorrelationRuleResponse(); Locale locale = LanguageUtil.getLocale(httpRequest); @@ -88,7 +87,7 @@ public class EngineResources { throw ExceptionUtil.buildExceptionResponse(correlationException.getMessage()); } - return JSONObject.fromObject(crResponse).toString(); + return crResponse; } @DELETE @@ -97,7 +96,7 @@ public class EngineResources { @Timed @Path("/{packageName}") public boolean undeployRule(@PathParam("packageName") String packageName, - @Context HttpServletRequest httpRequest) { + @Context HttpServletRequest httpRequest) { Locale locale = LanguageUtil.getLocale(httpRequest); @@ -118,7 +117,7 @@ public class EngineResources { @Produces(MediaType.APPLICATION_JSON) @Timed public boolean compileRule(CompileRuleRequest compileRuleRequest, - @Context HttpServletRequest httpRequest) { + @Context HttpServletRequest httpRequest) { Locale locale = LanguageUtil.getLocale(httpRequest); @@ -138,7 +137,7 @@ public class EngineResources { serviceRegisterEntity.setVersion("v1"); serviceRegisterEntity.setUrl("/api/holmes-engine/v1"); serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9102", 0); - serviceRegisterEntity.setVisualRange("1"); + serviceRegisterEntity.setVisualRange("1|0"); return serviceRegisterEntity; } } -- cgit 1.2.3-korg