Fix dg-common bundle error 18/97718/4
authorPatrick Brady <patrick.brady@att.com>
Tue, 29 Oct 2019 22:35:20 +0000 (15:35 -0700)
committerTakamune Cho <takamune.cho@att.com>
Fri, 8 Nov 2019 17:20:07 +0000 (17:20 +0000)
Fix a dg-common blueprint error that was caused by the
changes with the new appc-service-communicator.

Added an interface for the EventSender, and created a blueprint file
to publish the interface as a service.

Change-Id: I37248fcbfa7cfa75e62965dad811b648c336b5e2
Signed-off-by: Patrick Brady <patrick.brady@att.com>
Issue-ID: APPC-1744

appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/onap/appc/dg/common/impl/DCAEReporterPluginImpl.java
appc-dg/appc-dg-shared/appc-dg-common/src/main/resources/OSGI-INF/blueprint/blueprint.xml
appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSender.java
appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSenderInterface.java [new file with mode: 0644]
appc-service-communicator/appc-service-communicator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml [new file with mode: 0644]

index c69d1fe..2b3c678 100644 (file)
@@ -25,7 +25,7 @@ package org.onap.appc.dg.common.impl;
 
 import java.util.Map;
 import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.srvcomm.messaging.event.EventSender;
+import org.onap.appc.srvcomm.messaging.event.EventSenderInterface;
 import org.onap.appc.srvcomm.messaging.MessageDestination;
 import org.onap.appc.srvcomm.messaging.event.EventHeader;
 import org.onap.appc.srvcomm.messaging.event.EventMessage;
@@ -39,7 +39,7 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin {
     private static final String ATTR_API_VERSION = "input.common-header.api-ver";
     private static final String ATTR_REQUEST_ID = "input.common-header.request-id";
     private static final String PARAM_EVENT_TOPIC_NAME = "event-topic-name";
-    private EventSender eventSender;
+    private EventSenderInterface eventSender;
 
     public DCAEReporterPluginImpl() {
         // do nothing
@@ -50,7 +50,7 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin {
      *
      * @param eventSender to be set
      */
-    public void setEventSender(EventSender eventSender) {
+    public void setEventSender(EventSenderInterface eventSender) {
         this.eventSender = eventSender;
     }
 
index a90f463..27062d7 100644 (file)
@@ -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.srvcomm.messaging.event.EventSender"/>
+               interface="org.onap.appc.srvcomm.messaging.event.EventSenderInterface"/>
 
     <bean id="DCAEReporterPluginBean" class="org.onap.appc.dg.common.impl.DCAEReporterPluginImpl"
           scope="singleton">
index c156708..24442ac 100644 (file)
@@ -37,7 +37,7 @@ import java.util.Date;
 import java.util.Map;
 
 
-public class EventSender
+public class EventSender implements EventSenderInterface
 {
     private final EELFLogger LOG = EELFManager.getInstance().getLogger(EventSender.class);
     public static final String PROPERTY_PREFIX = "dmaap.event";
@@ -50,6 +50,7 @@ public class EventSender
         messagingConnector = new MessagingConnector();
     }
 
+    @Override
     public boolean sendEvent(MessageDestination destination, EventMessage msg) {
         String jsonStr = msg.toJson();
         String id = msg.getEventHeader().getEventId();
@@ -58,6 +59,7 @@ public class EventSender
         return messagingConnector.publishMessage(propertyPrefix, id, jsonStr);
     }
 
+    @Override
     public boolean sendEvent(MessageDestination destination, EventMessage msg, String eventTopicName) {
         String jsonStr = msg.toJson();
         String id = msg.getEventHeader().getEventId();
@@ -66,6 +68,7 @@ public class EventSender
         return messagingConnector.publishMessage(propertyPrefix, id, eventTopicName, jsonStr);
     }
 
+    @Override
     public boolean sendEvent(MessageDestination destination, Map<String, String> params, SvcLogicContext ctx) throws APPCException {
 
         if (params == null) {
@@ -94,4 +97,5 @@ public class EventSender
 
         return sendEvent(destination, eventMessage);
     }
+    
 }
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSenderInterface.java b/appc-service-communicator/appc-service-communicator-bundle/src/main/java/org/onap/appc/srvcomm/messaging/event/EventSenderInterface.java
new file mode 100644 (file)
index 0000000..b5bb71d
--- /dev/null
@@ -0,0 +1,14 @@
+package org.onap.appc.srvcomm.messaging.event;
+
+import java.util.Map;
+
+import org.onap.appc.exceptions.APPCException;
+import org.onap.appc.srvcomm.messaging.MessageDestination;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
+
+public interface EventSenderInterface extends SvcLogicJavaPlugin {
+    boolean sendEvent(MessageDestination destination, EventMessage msg);
+    boolean sendEvent(MessageDestination destination, EventMessage msg,String eventTopicName);
+    boolean sendEvent(MessageDestination destination, Map<String, String> params, SvcLogicContext ctx) throws APPCException;
+}
diff --git a/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-service-communicator/appc-service-communicator-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
new file mode 100644 (file)
index 0000000..603a5bf
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ============LICENSE_START=======================================================
+  ONAP : APPC
+  ================================================================================
+  Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+  =============================================================================
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+  
+       http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  
+  ============LICENSE_END=========================================================
+  -->
+
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+    <bean id="eventSenderBean" class="org.onap.appc.srvcomm.messaging.event.EventSender" scope="singleton">
+    </bean>
+
+    <service id="eventSenderService" interface="org.onap.appc.srvcomm.messaging.event.EventSenderInterface" ref="eventSenderBean" />
+
+</blueprint>