Bump upstreams to SNAPSHOTs
[netconf.git] / netconf / mdsal-netconf-notification / src / main / java / org / opendaylight / netconf / mdsal / notification / impl / NetconfNotificationOperationServiceFactory.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.netconf.mdsal.notification.impl;
10
11 import java.util.Collections;
12 import java.util.Set;
13 import org.opendaylight.netconf.api.capability.Capability;
14 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
15 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
16 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
17 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
18 import org.opendaylight.netconf.notifications.NetconfNotificationRegistry;
19
20 public final class NetconfNotificationOperationServiceFactory implements NetconfOperationServiceFactory, AutoCloseable {
21     private final NetconfNotificationRegistry netconfNotificationRegistry;
22     private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
23
24     public NetconfNotificationOperationServiceFactory(
25             final NetconfNotificationRegistry netconfNotificationRegistry,
26             final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener) {
27         this.netconfNotificationRegistry = netconfNotificationRegistry;
28         this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
29
30         this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
31     }
32
33     @Override
34     public Set<Capability> getCapabilities() {
35         // TODO
36         // No capabilities exposed to prevent clashes with schemas from
37         // config-netconf-connector (it exposes all the schemas)
38         // If the schemas exposed by config-netconf-connector are filtered,
39         // this class would expose monitoring related models
40         return Collections.emptySet();
41     }
42
43     @Override
44     public NetconfOperationService createService(final String netconfSessionIdForReporting) {
45         return new NetconfNotificationOperationService(netconfSessionIdForReporting, netconfNotificationRegistry);
46     }
47
48     @Override
49     public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
50         return () -> { };
51     }
52
53     @Override
54     public void close() {
55         netconfOperationServiceFactoryListener.onRemoveNetconfOperationServiceFactory(this);
56     }
57 }