2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.messagebus.app.impl;
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.controller.messagebus.spi.EventSource;
12 import org.opendaylight.controller.messagebus.spi.EventSourceRegistration;
13 import org.opendaylight.controller.messagebus.spi.EventSourceRegistry;
14 import org.opendaylight.mdsal.binding.api.DataBroker;
15 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
16 import org.opendaylight.mdsal.binding.api.RpcProviderService;
17 import org.osgi.service.component.annotations.Activate;
18 import org.osgi.service.component.annotations.Component;
19 import org.osgi.service.component.annotations.Deactivate;
20 import org.osgi.service.component.annotations.Reference;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
25 @Component(immediate = true)
26 public final class OSGiEventSourceRegistry implements EventSourceRegistry {
27 private static final Logger LOG = LoggerFactory.getLogger(OSGiEventSourceRegistry.class);
30 DataBroker dataBroker;
32 RpcConsumerRegistry rpcConsumerRegistry;
34 RpcProviderService rpcProviderService;
36 private EventSourceTopology delegate;
39 public <T extends EventSource> EventSourceRegistration<T> registerEventSource(final T eventSource) {
40 return delegate.registerEventSource(eventSource);
45 // Intentiational no-op
50 delegate = new EventSourceTopology(dataBroker, rpcProviderService, rpcConsumerRegistry);
51 LOG.info("Event Source Registry started");
56 LOG.info("Event Source Registry stopping");
58 LOG.info("Event Source Registry stopped");