summaryrefslogtreecommitdiffstats
path: root/engine-d/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'engine-d/src/main/java')
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/EngineDActiveApp.java)12
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/EngineDAppConfig.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java)4
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/db/CorrelationRuleDao.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java)6
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/db/mapper/CorrelationRuleMapper.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java)4
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/manager/DroolsEngine.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java)48
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/request/CompileRuleRequest.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/request/CompileRuleRequest.java)2
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/request/DeployRuleRequest.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/request/DeployRuleRequest.java)2
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/resources/EngineResources.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/resources/EngineResources.java)16
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/response/CorrelationRuleResponse.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/response/CorrelationRuleResponse.java)2
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/utils/AlarmUtil.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/utils/AlarmUtil.java)6
-rw-r--r--engine-d/src/main/java/org/onap/holmes/engine/wrapper/RuleMgtWrapper.java (renamed from engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java)11
11 files changed, 48 insertions, 65 deletions
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/EngineDActiveApp.java b/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java
index 3169f1b..ef671e3 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/EngineDActiveApp.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java
@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine;
+package org.onap.holmes.engine;
import io.dropwizard.setup.Environment;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
-import org.openo.dropwizard.ioc.bundle.IOCApplication;
-import org.openo.holmes.common.api.entity.ServiceRegisterEntity;
-import org.openo.holmes.common.config.MicroServiceConfig;
-import org.openo.holmes.common.utils.MSBRegisterUtil;
+import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication;
+import org.onap.holmes.common.api.entity.ServiceRegisterEntity;
+import org.onap.holmes.common.config.MicroServiceConfig;
+import org.onap.holmes.common.utils.MSBRegisterUtil;
@Slf4j
public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> {
@@ -46,7 +46,7 @@ public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> {
serviceRegisterEntity.setServiceName("holmes-engine-mgmt");
serviceRegisterEntity.setProtocol("REST");
serviceRegisterEntity.setVersion("v1");
- serviceRegisterEntity.setUrl("/openoapi/holmes-engine-mgmt/v1");
+ serviceRegisterEntity.setUrl("/onapapi/holmes-engine-mgmt/v1");
serviceRegisterEntity.setSingleNode(MicroServiceConfig.getServiceIp(), "9102", 0);
serviceRegisterEntity.setVisualRange("1|0");
return serviceRegisterEntity;
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java b/engine-d/src/main/java/org/onap/holmes/engine/EngineDAppConfig.java
index 66944a1..c42e9d9 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/EngineDAppConfig.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine;
+package org.onap.holmes.engine;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
@@ -22,7 +22,7 @@ import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotEmpty;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.config.MQConfig;
+import org.onap.holmes.common.config.MQConfig;
@Service
public class EngineDAppConfig extends Configuration {
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java b/engine-d/src/main/java/org/onap/holmes/engine/db/CorrelationRuleDao.java
index 4370054..4e01778 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/db/CorrelationRuleDao.java
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.db;
+package org.onap.holmes.engine.db;
import java.util.List;
-import org.openo.holmes.common.api.entity.CorrelationRule;
-import org.openo.holmes.engine.db.mapper.CorrelationRuleMapper;
+import org.onap.holmes.engine.db.mapper.CorrelationRuleMapper;
+import org.onap.holmes.common.api.entity.CorrelationRule;
import org.skife.jdbi.v2.sqlobject.Bind;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper;
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java b/engine-d/src/main/java/org/onap/holmes/engine/db/mapper/CorrelationRuleMapper.java
index 9c46b58..a682824 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/db/mapper/CorrelationRuleMapper.java
@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.db.mapper;
+package org.onap.holmes.engine.db.mapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
-import org.openo.holmes.common.api.entity.CorrelationRule;
+import org.onap.holmes.common.api.entity.CorrelationRule;
import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.ResultSetMapper;
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java b/engine-d/src/main/java/org/onap/holmes/engine/manager/DroolsEngine.java
index f8d9626..c8835cc 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/manager/DroolsEngine.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.manager;
+package org.onap.holmes.engine.manager;
import java.io.Serializable;
@@ -49,15 +49,14 @@ import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.rule.FactHandle;
import org.glassfish.hk2.api.IterableProvider;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.entity.CorrelationRule;
-import org.openo.holmes.common.api.stat.Alarm;
-import org.openo.holmes.common.config.MQConfig;
-import org.openo.holmes.common.constant.AlarmConst;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.ExceptionUtil;
-import org.openo.holmes.common.utils.I18nProxy;
-import org.openo.holmes.engine.request.DeployRuleRequest;
-import org.openo.holmes.engine.wrapper.RuleMgtWrapper;
+import org.onap.holmes.engine.request.DeployRuleRequest;
+import org.onap.holmes.common.api.entity.CorrelationRule;
+import org.onap.holmes.common.api.stat.Alarm;
+import org.onap.holmes.common.config.MQConfig;
+import org.onap.holmes.common.constant.AlarmConst;
+import org.onap.holmes.common.exception.CorrelationException;
+import org.onap.holmes.common.utils.ExceptionUtil;
+import org.onap.holmes.engine.wrapper.RuleMgtWrapper;
@Slf4j
@Service
@@ -82,8 +81,8 @@ public class DroolsEngine {
// 2. start mq listener
registerAlarmTopicListener();
} catch (Exception e) {
- log.error("Start service failed: " + e.getMessage(), e);
- throw ExceptionUtil.buildExceptionResponse("Start service failed!");
+ log.error("Failed to start the service: " + e.getMessage(), e);
+ throw ExceptionUtil.buildExceptionResponse("Failed to start the drools engine!");
}
}
@@ -169,10 +168,7 @@ public class DroolsEngine {
packageNames.add(packageName);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
} catch (Exception e) {
-
- String errorMsg =
- I18nProxy.getInstance().getValue(locale, I18nProxy.ENGINE_DEPLOY_RULE_FAILED);
- throw new CorrelationException(errorMsg, e);
+ throw new CorrelationException("Failed to deploy the rule.", e);
}
ksession.fireAllRules();
@@ -185,19 +181,13 @@ public class DroolsEngine {
KnowledgePackage pkg = kbase.getKnowledgePackage(packageName);
if (null == pkg) {
- String errorMsg = I18nProxy.getInstance().getValueByArgs(locale,
- I18nProxy.ENGINE_DELETE_RULE_NULL,
- new String[]{packageName});
- throw new CorrelationException(errorMsg);
+ throw new CorrelationException("The rule " + packageName + " does not exist!");
}
try {
-
kbase.removeKnowledgePackage(pkg.getName());
} catch (Exception e) {
- String errorMsg = I18nProxy.getInstance().getValueByArgs(locale,
- I18nProxy.ENGINE_DELETE_RULE_FAILED, new String[]{packageName});
- throw new CorrelationException(errorMsg, e);
+ throw new CorrelationException("Failed to delete the rule: " + packageName, e);
}
}
@@ -216,9 +206,7 @@ public class DroolsEngine {
private void judgeRuleContent(Locale locale, KnowledgeBuilder kbuilder, boolean judgePackageName)
throws CorrelationException {
if (kbuilder.hasErrors()) {
- String errorMsg = I18nProxy.getInstance().getValueByArgs(locale,
- I18nProxy.ENGINE_CONTENT_ILLEGALITY,
- new String[]{kbuilder.getErrors().toString()});
+ String errorMsg = "There are errors in the rule: " + kbuilder.getErrors().toString();
log.error(errorMsg);
throw new CorrelationException(errorMsg);
}
@@ -226,11 +214,7 @@ public class DroolsEngine {
String packageName = kbuilder.getKnowledgePackages().iterator().next().getName();
if (packageNames.contains(packageName) && judgePackageName) {
- String errorMsg = I18nProxy.getInstance().getValueByArgs(locale,
- I18nProxy.ENGINE_CONTENT_ILLEGALITY, new String[]{
- I18nProxy.getInstance().getValue(locale, I18nProxy.ENGINE_CONTAINS_PACKAGE)});
-
- throw new CorrelationException(errorMsg);
+ throw new CorrelationException("The rule " + packageName + " already exists in the drools engine.");
}
}
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/request/CompileRuleRequest.java b/engine-d/src/main/java/org/onap/holmes/engine/request/CompileRuleRequest.java
index 692deb5..6e0da48 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/request/CompileRuleRequest.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/request/CompileRuleRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.request;
+package org.onap.holmes.engine.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.NotNull;
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/request/DeployRuleRequest.java b/engine-d/src/main/java/org/onap/holmes/engine/request/DeployRuleRequest.java
index 979c5bf..de9d773 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/request/DeployRuleRequest.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/request/DeployRuleRequest.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.request;
+package org.onap.holmes.engine.request;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.validation.constraints.NotNull;
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/resources/EngineResources.java b/engine-d/src/main/java/org/onap/holmes/engine/resources/EngineResources.java
index 5be8eb9..3480dbb 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/resources/EngineResources.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/resources/EngineResources.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.resources;
+package org.onap.holmes.engine.resources;
import com.codahale.metrics.annotation.Timed;
@@ -32,13 +32,13 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import lombok.extern.slf4j.Slf4j;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.ExceptionUtil;
-import org.openo.holmes.common.utils.LanguageUtil;
-import org.openo.holmes.engine.manager.DroolsEngine;
-import org.openo.holmes.engine.request.CompileRuleRequest;
-import org.openo.holmes.engine.request.DeployRuleRequest;
-import org.openo.holmes.engine.response.CorrelationRuleResponse;
+import org.onap.holmes.common.exception.CorrelationException;
+import org.onap.holmes.common.utils.ExceptionUtil;
+import org.onap.holmes.common.utils.LanguageUtil;
+import org.onap.holmes.engine.manager.DroolsEngine;
+import org.onap.holmes.engine.request.CompileRuleRequest;
+import org.onap.holmes.engine.request.DeployRuleRequest;
+import org.onap.holmes.engine.response.CorrelationRuleResponse;
@Service
@Path("/rule")
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/response/CorrelationRuleResponse.java b/engine-d/src/main/java/org/onap/holmes/engine/response/CorrelationRuleResponse.java
index f033a1b..b234f91 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/response/CorrelationRuleResponse.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/response/CorrelationRuleResponse.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.response;
+package org.onap.holmes.engine.response;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/utils/AlarmUtil.java b/engine-d/src/main/java/org/onap/holmes/engine/utils/AlarmUtil.java
index 558d97b..ca93066 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/utils/AlarmUtil.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/utils/AlarmUtil.java
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.utils;
+package org.onap.holmes.engine.utils;
import java.util.HashMap;
import java.util.Map;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.stat.Alarm;
-import org.openo.holmes.common.producer.MQProducer;
+import org.onap.holmes.common.api.stat.Alarm;
+import org.onap.holmes.common.producer.MQProducer;
@Service
public class AlarmUtil {
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java b/engine-d/src/main/java/org/onap/holmes/engine/wrapper/RuleMgtWrapper.java
index 5a9ce8f..1fbbfe7 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java
+++ b/engine-d/src/main/java/org/onap/holmes/engine/wrapper/RuleMgtWrapper.java
@@ -13,18 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.openo.holmes.engine.wrapper;
+package org.onap.holmes.engine.wrapper;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import org.jvnet.hk2.annotations.Service;
-import org.openo.holmes.common.api.entity.CorrelationRule;
-import org.openo.holmes.common.exception.CorrelationException;
-import org.openo.holmes.common.utils.DbDaoUtil;
-import org.openo.holmes.common.utils.I18nProxy;
-import org.openo.holmes.engine.db.CorrelationRuleDao;
+import org.onap.holmes.engine.db.CorrelationRuleDao;
+import org.onap.holmes.common.api.entity.CorrelationRule;
+import org.onap.holmes.common.exception.CorrelationException;
+import org.onap.holmes.common.utils.DbDaoUtil;
@Service