diff options
author | 2017-08-11 15:43:00 -0400 | |
---|---|---|
committer | 2017-08-11 20:29:18 +0000 | |
commit | 956e9c683052a92f6303d243df77cbaab0c775cf (patch) | |
tree | 37a00e6f7d756d0896d169fbcb2fc6d1344fc192 /appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java | |
parent | d55beb2a5f9831c09601362b2e994e932ef9da74 (diff) |
[APPC-45] appc-dg-common start
Fix appc-dg-common bundle start issue (does not occur at the APPC start
up) by using blueprint for its instantiation.
Issue-Id: APPC-45
Change-Id: I40887701269a44ba711a00aa12a551e672b34532
Signed-off-by: beili.zhou <beili.zhou@amdocs.com>
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java')
-rw-r--r-- | appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java index 0f99f8314..dd667c270 100644 --- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java +++ b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java @@ -33,9 +33,6 @@ import org.openecomp.appc.adapter.message.event.EventStatus; import org.openecomp.appc.dg.common.DCAEReporterPlugin; import org.openecomp.appc.exceptions.APPCException; import org.openecomp.sdnc.sli.SvcLogicContext; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; import java.util.Map; @@ -44,9 +41,16 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { private EventSender eventSender; public DCAEReporterPluginImpl() { - BundleContext bctx = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); - ServiceReference sref = bctx.getServiceReference(EventSender.class); - eventSender = (EventSender) bctx.getService(sref); + // do nothing + } + + /** + * Injected by blueprint + * + * @param eventSender to be set + */ + public void setEventSender(EventSender eventSender) { + this.eventSender = eventSender; } @Override @@ -62,7 +66,9 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { apiVersion = ctx.getAttribute("input.common-header.api-ver"); eventId = ctx.getAttribute("input.common-header.request-id"); - EventMessage eventMessage = new EventMessage(new EventHeader((new java.util.Date()).toString(), apiVersion, eventId), new EventStatus(errorCode, errorDescription)); + EventMessage eventMessage = new EventMessage(new EventHeader( + (new java.util.Date()).toString(), apiVersion, eventId), + new EventStatus(errorCode, errorDescription)); String eventWriteTopic = params.get("event-topic-name"); if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){ eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic); @@ -102,7 +108,9 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { if (null == successDescription) { successDescription = "Success"; } - EventMessage eventMessage = new EventMessage(new EventHeader((new java.util.Date()).toString(), apiVersion, eventId), new EventStatus(successReportCode, successDescription)); + EventMessage eventMessage = new EventMessage(new EventHeader( + (new java.util.Date()).toString(), apiVersion, eventId), + new EventStatus(successReportCode, successDescription)); String eventWriteTopic = params.get("event-topic-name"); if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){ eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic); @@ -120,7 +128,9 @@ public class DCAEReporterPluginImpl implements DCAEReporterPlugin { apiVersion = ctx.getAttribute("input.common-header.api-ver"); eventId = ctx.getAttribute("input.common-header.request-id"); - EventMessage eventMessage = new EventMessage(new EventHeader((new java.util.Date()).toString(), apiVersion, eventId), new EventStatus(errorCode, errorDescription)); + EventMessage eventMessage = new EventMessage(new EventHeader( + (new java.util.Date()).toString(), apiVersion, eventId), + new EventStatus(errorCode, errorDescription)); String eventWriteTopic = params.get("event-topic-name"); if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){ eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic); |