summaryrefslogtreecommitdiffstats
path: root/engine-d/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'engine-d/src/main')
-rw-r--r--engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java10
-rw-r--r--engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java2
-rw-r--r--engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java2
-rw-r--r--engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java11
-rw-r--r--engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java3
5 files changed, 17 insertions, 11 deletions
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java b/engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java
index 8b20ac1..23600e8 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java
+++ b/engine-d/src/main/java/org/openo/holmes/engine/EngineDAppConfig.java
@@ -21,8 +21,10 @@ import io.dropwizard.db.DataSourceFactory;
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;
+@Service
public class EngineDAppConfig extends Configuration {
@NotEmpty
@@ -31,6 +33,9 @@ public class EngineDAppConfig extends Configuration {
@NotEmpty
private String apidescription = "Holmes rule management rest API";
+ @NotEmpty
+ private String msbServerAddr;
+
@JsonProperty
@NotNull
@Valid
@@ -57,6 +62,11 @@ public class EngineDAppConfig extends Configuration {
this.database = dataSourceFactory;
}
+ @JsonProperty
+ public String getMsbServerAddr() {
+ return msbServerAddr;
+ }
+
public String getApidescription() {
return apidescription;
}
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java b/engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java
index 4370054..0c00102 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java
+++ b/engine-d/src/main/java/org/openo/holmes/engine/db/CorrelationRuleDao.java
@@ -27,7 +27,7 @@ import org.skife.jdbi.v2.sqlobject.customizers.RegisterMapper;
public abstract class CorrelationRuleDao {
- @SqlQuery("SELECT * FROM APLUS_RULE WHERE enable=:enable")
+ @SqlQuery("SELECT * FROM aplus_rule WHERE enable=:enable")
public abstract List<CorrelationRule> queryRuleByEnable(@Bind("enable") int enable);
public List<CorrelationRule> queryRuleByRuleEnable(int enable) {
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java b/engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java
index 6ce0fb6..9c46b58 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java
+++ b/engine-d/src/main/java/org/openo/holmes/engine/db/mapper/CorrelationRuleMapper.java
@@ -39,9 +39,7 @@ public class CorrelationRuleMapper implements ResultSetMapper<CorrelationRule> {
correlationRule.setModifier(resultSet.getString("updator"));
correlationRule.setUpdateTime(resultSet.getDate("updateTime"));
correlationRule.setParams((Properties) resultSet.getObject("params"));
- correlationRule.setDomain(resultSet.getString("domain"));
correlationRule.setContent(resultSet.getString("content"));
- correlationRule.setIsManual(resultSet.getInt("isManual"));
correlationRule.setVendor(resultSet.getString("vendor"));
correlationRule.setPackageName(resultSet.getString("package"));
return correlationRule;
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java b/engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java
index 9b83002..0ed452a 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java
+++ b/engine-d/src/main/java/org/openo/holmes/engine/manager/DroolsEngine.java
@@ -134,11 +134,12 @@ public class DroolsEngine {
private void initDeployRule() throws CorrelationException {
List<CorrelationRule> rules = ruleMgtWrapper.queryRuleByEnable(ENABLE);
- if (!rules.isEmpty()) {
- for (CorrelationRule rule : rules) {
- if (rule.getContent() != null) {
- deployRuleFromDB(rule.getContent());
- }
+ if (rules.isEmpty()) {
+ return;
+ }
+ for (CorrelationRule rule : rules) {
+ if (rule.getContent() != null) {
+ deployRuleFromDB(rule.getContent());
}
}
}
diff --git a/engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java b/engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java
index 7df791d..5a9ce8f 100644
--- a/engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java
+++ b/engine-d/src/main/java/org/openo/holmes/engine/wrapper/RuleMgtWrapper.java
@@ -39,9 +39,6 @@ public class RuleMgtWrapper {
List<CorrelationRule> ruleTemp = daoUtil.getJdbiDaoByOnDemand(CorrelationRuleDao.class)
.queryRuleByRuleEnable(enable);
- if (ruleTemp == null) {
- throw new CorrelationException(I18nProxy.RULE_MANAGEMENT_DB_ERROR);
- }
return ruleTemp;
}
}