2 * Copyright (c) 2015 Cisco Systems, Inc. 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.netconf.server.events.mdsal;
10 import static java.util.Objects.requireNonNull;
13 import org.opendaylight.netconf.api.capability.Capability;
14 import org.opendaylight.netconf.server.api.monitoring.CapabilityListener;
15 import org.opendaylight.netconf.server.api.notifications.NetconfNotificationRegistry;
16 import org.opendaylight.netconf.server.api.operations.NetconfOperationService;
17 import org.opendaylight.netconf.server.api.operations.NetconfOperationServiceFactory;
18 import org.opendaylight.netconf.server.api.operations.NetconfOperationServiceFactoryListener;
19 import org.opendaylight.yangtools.concepts.Registration;
20 import org.osgi.service.component.annotations.Activate;
21 import org.osgi.service.component.annotations.Component;
22 import org.osgi.service.component.annotations.Deactivate;
23 import org.osgi.service.component.annotations.Reference;
25 @Component(service = NetconfOperationServiceFactory.class, immediate = true,
26 property = "type=mdsal-netconf-notification")
27 public final class NetconfNotificationOperationServiceFactory implements NetconfOperationServiceFactory, AutoCloseable {
28 private final NetconfNotificationRegistry notifManager;
29 private final NetconfOperationServiceFactoryListener aggregatorRegistry;
32 public NetconfNotificationOperationServiceFactory(
33 @Reference(target = "(type=netconf-notification-manager)") final NetconfNotificationRegistry notifManager,
34 @Reference(target = "(type=mapper-aggregator-registry)")
35 final NetconfOperationServiceFactoryListener aggregatorRegistry) {
36 this.notifManager = requireNonNull(notifManager);
37 this.aggregatorRegistry = requireNonNull(aggregatorRegistry);
38 this.aggregatorRegistry.onAddNetconfOperationServiceFactory(this);
44 aggregatorRegistry.onRemoveNetconfOperationServiceFactory(this);
48 public Set<Capability> getCapabilities() {
50 // No capabilities exposed to prevent clashes with schemas from
51 // config-netconf-connector (it exposes all the schemas)
52 // If the schemas exposed by config-netconf-connector are filtered,
53 // this class would expose monitoring related models
58 public NetconfOperationService createService(final String netconfSessionIdForReporting) {
59 return new NetconfNotificationOperationService(netconfSessionIdForReporting, notifManager);
63 public Registration registerCapabilityListener(final CapabilityListener listener) {