diff options
author | 2017-10-14 15:21:29 +0800 | |
---|---|---|
committer | 2017-10-14 16:14:18 +0800 | |
commit | 095ad14dcf2c7e836924e9e4911c5237a94661ce (patch) | |
tree | 5b88c81ec7a432d7bdff116b1f4988378bf67356 /holmes-actions/src | |
parent | 105437a89bd5bcfcaf40dac25e2c087aafb0996b (diff) |
Add Control Loop Related Attrs
Change-Id: I5fa8250b5c0893d05d6a6186ff3a05700b8e48da
Issue-ID: HOLMES-70
Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'holmes-actions/src')
4 files changed, 14 insertions, 6 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java index c8d61b9..eb9273a 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/api/entity/CorrelationRule.java @@ -54,4 +54,6 @@ public class CorrelationRule { private Date updateTime;
@JsonProperty(value = "package")
private String packageName;
+ @JsonProperty(value = "controlloopname")
+ private String closedControlLoopName;
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java index 2564e23..8646abe 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dcae/DcaeConfigurationsCache.java @@ -20,7 +20,7 @@ import org.onap.holmes.common.dcae.entity.SecurityInfo; public class DcaeConfigurationsCache { - private static DcaeConfigurations dcaeConfigurations; + private static DcaeConfigurations dcaeConfigurations = new DcaeConfigurations(); public synchronized static SecurityInfo getPubSecInfo(String key) { if (dcaeConfigurations != null) { @@ -29,6 +29,12 @@ public class DcaeConfigurationsCache { return null; } + public synchronized static void addPubSecInfo(String key, SecurityInfo securityInfo) { + if (dcaeConfigurations != null) { + dcaeConfigurations.addPubSecInfo(key, securityInfo); + } + } + public synchronized static void setDcaeConfigurations(DcaeConfigurations configurations) { dcaeConfigurations = configurations; } diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java index 64b7dbc..f414341 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/DmaapService.java @@ -39,23 +39,23 @@ public class DmaapService { public static final int POLICY_MESSAGE_ABATED = 1; - public static final String PUBLISHER_KEY = "unauthenticated.DCAE_CL_OUTPUT"; - @Inject private AaiQuery aaiQuery; public static ConcurrentHashMap<String, String> loopControlNames = new ConcurrentHashMap<>(); - public void publishPolicyMsg(PolicyMsg policyMsg) { + public void publishPolicyMsg(PolicyMsg policyMsg, String dmaapConfigKey) { try { Publisher publisher = new Publisher(); - publisher.setUrl(DcaeConfigurationsCache.getPubSecInfo(PUBLISHER_KEY).getDmaapInfo().getTopicUrl()); + publisher.setUrl(DcaeConfigurationsCache.getPubSecInfo(dmaapConfigKey).getDmaapInfo().getTopicUrl()); publisher.publish(policyMsg); log.info("send policyMsg: " + JacksonUtil.beanToJson(policyMsg)); } catch (CorrelationException e) { log.error("Failed to publish policyMsg to dmaap", e.getMessage()); } catch (JsonProcessingException e) { log.info("Failed to convert policyMsg to json"); + } catch (NullPointerException e) { + log.error("DMaaP configurations does not exist!"); } } diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/utils/HttpsUtils.java b/holmes-actions/src/main/java/org/onap/holmes/common/utils/HttpsUtils.java index 510491e..091b25c 100644 --- a/holmes-actions/src/main/java/org/onap/holmes/common/utils/HttpsUtils.java +++ b/holmes-actions/src/main/java/org/onap/holmes/common/utils/HttpsUtils.java @@ -74,7 +74,7 @@ public class HttpsUtils { connectionManager = new PoolingHttpClientConnectionManager(registry); connectionManager.setMaxTotal(200); } catch (Exception e) { - log.error("Failed to init ssl builder" + e.getMessage()); + log.error("Failed to initialize the ssl builder: " + e.getMessage()); } } |