Search in sources :

Example 1 with DOMNotificationPublishService

use of org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService in project controller by opendaylight.

the class BindingNotificationPublishAdapterModule method createInstance.

@Override
public AutoCloseable createInstance() {
    final BindingToNormalizedNodeCodec codec = getBindingMappingServiceDependency();
    final Broker.ProviderSession session = getDomAsyncBrokerDependency().registerProvider(new DummyDOMProvider());
    final DOMNotificationPublishService publishService = session.getService(DOMNotificationPublishService.class);
    return new BindingDOMNotificationPublishServiceAdapter(codec, publishService);
}
Also used : Broker(org.opendaylight.controller.sal.core.api.Broker) BindingDOMNotificationPublishServiceAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter) BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec) DOMNotificationPublishService(org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService)

Example 2 with DOMNotificationPublishService

use of org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService in project controller by opendaylight.

the class DomBrokerImplModule method createInstance.

@Override
@SuppressWarnings("checkstyle:IllegalCatch")
public AutoCloseable createInstance() {
    // The services are provided via blueprint so retrieve then from the OSGi service registry for
    // backwards compatibility.
    final List<AutoCloseable> closeables = new ArrayList<>();
    DOMNotificationService domNotificationService = newTracker(DOMNotificationService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
    DOMNotificationPublishService domNotificationPublishService = newTracker(DOMNotificationPublishService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
    DOMRpcService domRpcService = newTracker(DOMRpcService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
    DOMRpcProviderService domRpcProvider = newTracker(DOMRpcProviderService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
    DOMMountPointService mountService = newTracker(DOMMountPointService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
    SchemaService globalSchemaService = newTracker(SchemaService.class, closeables).waitForService(WaitingServiceTracker.FIVE_MINUTES);
    final DOMDataBroker dataBroker = getAsyncDataBrokerDependency();
    final ClassToInstanceMap<BrokerService> services = MutableClassToInstanceMap.create();
    services.putInstance(DOMNotificationService.class, domNotificationService);
    services.putInstance(DOMNotificationPublishService.class, domNotificationPublishService);
    final SchemaService schemaService = getSchemaServiceImpl(globalSchemaService);
    services.putInstance(SchemaService.class, schemaService);
    services.putInstance(DOMDataBroker.class, dataBroker);
    services.putInstance(DOMRpcService.class, domRpcService);
    services.putInstance(DOMRpcProviderService.class, domRpcProvider);
    services.putInstance(DOMMountPointService.class, mountService);
    BrokerImpl broker = new BrokerImpl(domRpcService, domRpcProvider, services);
    broker.setDeactivator(() -> {
        for (AutoCloseable ac : closeables) {
            try {
                ac.close();
            } catch (Exception e) {
                LOG.warn("Exception while closing {}", ac, e);
            }
        }
    });
    return broker;
}
Also used : DOMRpcService(org.opendaylight.controller.md.sal.dom.api.DOMRpcService) ArrayList(java.util.ArrayList) DOMMountPointService(org.opendaylight.controller.md.sal.dom.api.DOMMountPointService) DOMRpcProviderService(org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService) DOMNotificationService(org.opendaylight.controller.md.sal.dom.api.DOMNotificationService) BrokerImpl(org.opendaylight.controller.sal.dom.broker.BrokerImpl) SchemaService(org.opendaylight.controller.sal.core.api.model.SchemaService) DOMNotificationPublishService(org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService) DOMDataBroker(org.opendaylight.controller.md.sal.dom.api.DOMDataBroker) BrokerService(org.opendaylight.controller.sal.core.api.BrokerService)

Example 3 with DOMNotificationPublishService

use of org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService in project controller by opendaylight.

the class NotificationBrokerImplModule method createHeliumAdapter.

private static AutoCloseable createHeliumAdapter(final NotificationPublishService publishService, final NotificationService listenService) {
    if (listenService instanceof BindingDOMNotificationServiceAdapter && publishService instanceof BindingDOMNotificationPublishServiceAdapter) {
        final BindingDOMNotificationPublishServiceAdapter castedPublish = (BindingDOMNotificationPublishServiceAdapter) publishService;
        final BindingDOMNotificationServiceAdapter castedListen = (BindingDOMNotificationServiceAdapter) listenService;
        final DOMNotificationPublishService domPublishService = castedPublish.getDomPublishService();
        if (domPublishService instanceof DOMNotificationSubscriptionListenerRegistry) {
            final DOMNotificationSubscriptionListenerRegistry subsRegistry = (DOMNotificationSubscriptionListenerRegistry) domPublishService;
            return new HeliumNotificationProviderServiceWithInterestListeners(castedPublish, castedListen, subsRegistry);
        }
    }
    return new HeliumNotificationProviderServiceAdapter(publishService, listenService);
}
Also used : BindingDOMNotificationServiceAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationServiceAdapter) BindingDOMNotificationPublishServiceAdapter(org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter) HeliumNotificationProviderServiceWithInterestListeners(org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceWithInterestListeners) HeliumNotificationProviderServiceAdapter(org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter) DOMNotificationPublishService(org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService) DOMNotificationSubscriptionListenerRegistry(org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListenerRegistry)

Aggregations

DOMNotificationPublishService (org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService)3 BindingDOMNotificationPublishServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter)2 ArrayList (java.util.ArrayList)1 HeliumNotificationProviderServiceAdapter (org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter)1 HeliumNotificationProviderServiceWithInterestListeners (org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceWithInterestListeners)1 BindingDOMNotificationServiceAdapter (org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationServiceAdapter)1 BindingToNormalizedNodeCodec (org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec)1 DOMDataBroker (org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)1 DOMMountPointService (org.opendaylight.controller.md.sal.dom.api.DOMMountPointService)1 DOMNotificationService (org.opendaylight.controller.md.sal.dom.api.DOMNotificationService)1 DOMRpcProviderService (org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService)1 DOMRpcService (org.opendaylight.controller.md.sal.dom.api.DOMRpcService)1 DOMNotificationSubscriptionListenerRegistry (org.opendaylight.controller.md.sal.dom.spi.DOMNotificationSubscriptionListenerRegistry)1 Broker (org.opendaylight.controller.sal.core.api.Broker)1 BrokerService (org.opendaylight.controller.sal.core.api.BrokerService)1 SchemaService (org.opendaylight.controller.sal.core.api.model.SchemaService)1 BrokerImpl (org.opendaylight.controller.sal.dom.broker.BrokerImpl)1