diff options
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-common/src/main')
3 files changed, 17 insertions, 36 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/DCAEReporterPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/DCAEReporterPluginImpl.java index b244d31db..c69d1fe52 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/DCAEReporterPluginImpl.java +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/DCAEReporterPluginImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -25,11 +25,11 @@ package org.onap.appc.dg.common.impl; import java.util.Map; import org.apache.commons.lang3.StringUtils; -import org.onap.appc.adapter.message.EventSender; -import org.onap.appc.adapter.message.MessageDestination; -import org.onap.appc.adapter.message.event.EventHeader; -import org.onap.appc.adapter.message.event.EventMessage; -import org.onap.appc.adapter.message.event.EventStatus; +import org.onap.appc.srvcomm.messaging.event.EventSender; +import org.onap.appc.srvcomm.messaging.MessageDestination; +import org.onap.appc.srvcomm.messaging.event.EventHeader; +import org.onap.appc.srvcomm.messaging.event.EventMessage; +import org.onap.appc.srvcomm.messaging.event.EventStatus; import org.onap.appc.dg.common.DCAEReporterPlugin; import org.onap.appc.exceptions.APPCException; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java index 4cef62581..3efbc02e3 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/IntermediateMessageSenderImpl.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ================================================================================ @@ -36,11 +36,10 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import org.apache.commons.lang3.StringUtils; -import org.onap.appc.adapter.message.MessageAdapterFactory; -import org.onap.appc.adapter.message.Producer; import org.onap.appc.configuration.ConfigurationFactory; import org.onap.appc.dg.common.IntermediateMessageSender; import org.onap.appc.exceptions.APPCException; +import org.onap.appc.srvcomm.messaging.MessagingConnector; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; @@ -52,8 +51,9 @@ public class IntermediateMessageSenderImpl implements IntermediateMessageSender private static final String PARAM_MESSAGE = "message"; private static final String ATTR_REQUEST_ID = "input.common-header.request-id"; + private static final String PROPERTIES_PREFIX = "appc.LCM"; - private Producer producer; + private MessagingConnector messageService; private static final String STATUS = "STATUS"; private static final String FAILURE = "FAILURE"; @@ -64,29 +64,10 @@ public class IntermediateMessageSenderImpl implements IntermediateMessageSender private static final String MSO = "MSO"; public void init() { - Properties properties = ConfigurationFactory.getConfiguration().getProperties(); - - String writeTopic = properties.getProperty("appc.LCM.topic.write"); - String apiKey = properties.getProperty("appc.LCM.client.key"); - String apiSecret = properties.getProperty("appc.LCM.client.secret"); - String hostNames = properties.getProperty("appc.LCM.poolMembers"); - - logger.debug("Configuration Read : writeTopic = " + writeTopic + ", " + - "hostNames = " + hostNames); - - Set<String> pool = new HashSet<>(); - if (!StringUtils.isEmpty(hostNames)) { - pool.addAll(Arrays.asList(hostNames.split(","))); - } - - BundleContext ctx = FrameworkUtil.getBundle(IntermediateMessageSenderImpl.class).getBundleContext(); - if (ctx != null) { - ServiceReference svcRef = ctx.getServiceReference(MessageAdapterFactory.class.getName()); - if (svcRef != null) { - MessageAdapterFactory messageAdapterFactory = ((MessageAdapterFactory) ctx.getService(svcRef)); - producer = messageAdapterFactory.createProducer(pool, writeTopic, apiKey, apiSecret); - } - } + messageService = new MessagingConnector(); + } + public void init(MessagingConnector messagingConnector) { + messageService = messagingConnector; } @Override @@ -97,7 +78,7 @@ public class IntermediateMessageSenderImpl implements IntermediateMessageSender validateInputs(params, context); String jsonMessage = getJsonMessage(params, context); logger.debug("Constructed JSON Message : " + jsonMessage); - producer.post("", jsonMessage); + messageService.publishMessage(PROPERTIES_PREFIX, "", jsonMessage); context.setAttribute(prefix + STATUS, SUCCESS); } catch (Exception e) { String errorMessage = "Error sending intermediate message to initiator " + e.getMessage(); diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml index ff6b824f2..a90f463b9 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP : APPC ================================================================================ - Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. ================================================================================ Copyright (C) 2017 Amdocs ============================================================================= @@ -33,7 +33,7 @@ <service id="JsonDgUtil" interface="org.onap.appc.dg.common.JsonDgUtil" ref="JsonDgUtilBean"/> <reference id="eventSenderReference" availability="mandatory" activation="eager" - interface="org.onap.appc.adapter.message.EventSender"/> + interface="org.onap.appc.srvcomm.messaging.event.EventSender"/> <bean id="DCAEReporterPluginBean" class="org.onap.appc.dg.common.impl.DCAEReporterPluginImpl" scope="singleton"> |