X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=rulemgt%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fholmes%2Frulemgt%2Fbolt%2Fenginebolt%2FEngineWrapper.java;fp=rulemgt%2Fsrc%2Fmain%2Fjava%2Forg%2Fopeno%2Fholmes%2Frulemgt%2Fbolt%2Fenginebolt%2FEngineWrapper.java;h=733cae0982e0a38bc2fb99157532c27f9074ae0f;hb=20a1514bf93035472d4f940f00a357106d4bec1f;hp=8e9055b560b04244d81afe95fa498cd25ccb2887;hpb=40f54b8acefce59ecbd9e9fde60e062373243982;p=holmes%2Frule-management.git diff --git a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java similarity index 61% rename from rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java rename to rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java index 8e9055b..733cae0 100644 --- a/rulemgt/src/main/java/org/openo/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/bolt/enginebolt/EngineWrapper.java @@ -13,18 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openo.holmes.rulemgt.bolt.enginebolt; +package org.onap.holmes.rulemgt.bolt.enginebolt; import javax.inject.Inject; import javax.ws.rs.core.Response; import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONObject; import org.jvnet.hk2.annotations.Service; -import org.openo.holmes.common.exception.CorrelationException; -import org.openo.holmes.common.utils.I18nProxy; -import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; -import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; -import org.openo.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine; +import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine; +import org.onap.holmes.rulemgt.constant.RuleMgtConstant; +import org.onap.holmes.common.exception.CorrelationException; @Service @Slf4j @@ -38,18 +37,18 @@ public class EngineWrapper { try { response = engineService.deploy(correlationRule); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED, e); + throw new CorrelationException("Failed to call the rule deployment RESTful API.", e); } if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) { - log.info("Call deploy rule rest interface in engine successfully."); + log.info("Succeeded in calling the rule deployment RESTful API from the engine management service."); try { JSONObject json = JSONObject.fromObject(response.readEntity(String.class)); return json.get(RuleMgtConstant.PACKAGE).toString(); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR, e); + throw new CorrelationException("Failed to parse the value returned by the engine management service.", e); } } else { - throw new CorrelationException(I18nProxy.ENGINE_DEPLOY_RULE_FAILED); + throw new CorrelationException("Failed to deploy the rule!"); } } @@ -58,31 +57,31 @@ public class EngineWrapper { try { response = engineService.delete(packageName); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED, e); + throw new CorrelationException("Failed to call the rule deleting RESTful API.", e); } if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) { - log.info("Call delete rule rest interface in engine successfully."); + log.info("Succeeded in calling the rule deleting RESTful API from the engine management service."); return true; } else { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DELETE_RULE_FAILED); + throw new CorrelationException("Failed to delete the rule!"); } } public boolean checkRuleFromEngine(CorrelationCheckRule4Engine correlationCheckRule4Engine) throws CorrelationException { - log.info("content:" + correlationCheckRule4Engine.getContent()); + log.info("Rule Contents: " + correlationCheckRule4Engine.getContent()); Response response; try { response = engineService.check(correlationCheckRule4Engine); } catch (Exception e) { - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED, e); + throw new CorrelationException("Failed to call the rule verification RESTful API.", e); } if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) { - log.info("Call check rule rest interface in engine successfully."); + log.info("Succeeded in calling the rule verification RESTful API from the engine management service."); return true; } else { log.info(response.getStatus() + " " + response.getStatusInfo() + " " + response.getEntity()); - throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CHECK_NO_PASS); + throw new CorrelationException("Failed to verify the rule. The contents of the rule are invalid."); } } }