Change the groupid from openo to onap
[holmes/rule-management.git] / rulemgt / src / main / java / org / onap / holmes / rulemgt / bolt / enginebolt / EngineWrapper.java
  * See the License for the specific language governing permissions and\r
  * limitations under the License.\r
  */\r
-package org.openo.holmes.rulemgt.bolt.enginebolt;\r
+package org.onap.holmes.rulemgt.bolt.enginebolt;\r
 \r
 import javax.inject.Inject;\r
 import javax.ws.rs.core.Response;\r
 import lombok.extern.slf4j.Slf4j;\r
 import net.sf.json.JSONObject;\r
 import org.jvnet.hk2.annotations.Service;\r
-import org.openo.holmes.common.exception.CorrelationException;\r
-import org.openo.holmes.common.utils.I18nProxy;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
-import org.openo.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
-import org.openo.holmes.rulemgt.constant.RuleMgtConstant;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationCheckRule4Engine;\r
+import org.onap.holmes.rulemgt.bean.request.CorrelationDeployRule4Engine;\r
+import org.onap.holmes.rulemgt.constant.RuleMgtConstant;\r
+import org.onap.holmes.common.exception.CorrelationException;\r
 \r
 @Service\r
 @Slf4j\r
@@ -38,18 +37,18 @@ public class EngineWrapper {
         try {\r
             response = engineService.deploy(correlationRule);\r
         } catch (Exception e) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DEPLOY_RULE_REST_FAILED, e);\r
+            throw new CorrelationException("Failed to call the rule deployment RESTful API.", e);\r
         }\r
         if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {\r
-            log.info("Call deploy rule rest interface in engine successfully.");\r
+            log.info("Succeeded in calling the rule deployment RESTful API from the engine management service.");\r
             try {\r
                 JSONObject json = JSONObject.fromObject(response.readEntity(String.class));\r
                 return json.get(RuleMgtConstant.PACKAGE).toString();\r
             } catch (Exception e) {\r
-                throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_PARSE_DEPLOY_RESULT_ERROR, e);\r
+                throw new CorrelationException("Failed to parse the value returned by the engine management service.", e);\r
             }\r
         } else {\r
-            throw new CorrelationException(I18nProxy.ENGINE_DEPLOY_RULE_FAILED);\r
+            throw new CorrelationException("Failed to deploy the rule!");\r
         }\r
     }\r
 \r
@@ -58,31 +57,31 @@ public class EngineWrapper {
         try {\r
             response = engineService.delete(packageName);\r
         } catch (Exception e) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_DELETE_RULE_REST_FAILED, e);\r
+            throw new CorrelationException("Failed to call the rule deleting RESTful API.", e);\r
         }\r
         if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {\r
-            log.info("Call delete rule rest interface in engine successfully.");\r
+            log.info("Succeeded in calling the rule deleting RESTful API from the engine management service.");\r
             return true;\r
         } else {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DELETE_RULE_FAILED);\r
+            throw new CorrelationException("Failed to delete the rule!");\r
         }\r
     }\r
 \r
     public boolean checkRuleFromEngine(CorrelationCheckRule4Engine correlationCheckRule4Engine)\r
             throws CorrelationException {\r
-        log.info("content:" + correlationCheckRule4Engine.getContent());\r
+        log.info("Rule Contents: " + correlationCheckRule4Engine.getContent());\r
         Response response;\r
         try {\r
             response = engineService.check(correlationCheckRule4Engine);\r
         } catch (Exception e) {\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CALL_CHECK_RULE_REST_FAILED, e);\r
+            throw new CorrelationException("Failed to call the rule verification RESTful API.", e);\r
         }\r
         if (response.getStatus() == RuleMgtConstant.RESPONSE_STATUS_OK) {\r
-            log.info("Call check rule rest interface in engine successfully.");\r
+            log.info("Succeeded in calling the rule verification RESTful API from the engine management service.");\r
             return true;\r
         } else {\r
             log.info(response.getStatus() + " " + response.getStatusInfo() + " " + response.getEntity());\r
-            throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_CHECK_NO_PASS);\r
+            throw new CorrelationException("Failed to verify the rule. The contents of the rule are invalid.");\r
         }\r
     }\r
 }\r