Remove netconf-notification
[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.controller.sal.common.util.NoopAutoCloseable;
14 import org.opendaylight.netconf.api.capability.Capability;
15 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
16 import org.opendaylight.netconf.mapping.api.NetconfOperationService;
17 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
18 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
19 import org.opendaylight.netconf.notifications.NetconfNotificationRegistry;
20
21 public class NetconfNotificationOperationServiceFactory implements NetconfOperationServiceFactory, AutoCloseable {
22
23     private final NetconfNotificationRegistry netconfNotificationRegistry;
24     private final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener;
25
26     public NetconfNotificationOperationServiceFactory(
27             final NetconfNotificationRegistry netconfNotificationRegistry,
28             final NetconfOperationServiceFactoryListener netconfOperationServiceFactoryListener) {
29         this.netconfNotificationRegistry = netconfNotificationRegistry;
30         this.netconfOperationServiceFactoryListener = netconfOperationServiceFactoryListener;
31
32         this.netconfOperationServiceFactoryListener.onAddNetconfOperationServiceFactory(this);
33     }
34
35     @Override
36     public Set<Capability> getCapabilities() {
37         // TODO
38         // No capabilities exposed to prevent clashes with schemas from
39         // config-netconf-connector (it exposes all the schemas)
40         // If the schemas exposed by config-netconf-connector are filtered,
41         // this class would expose monitoring related models
42         return Collections.emptySet();
43     }
44
45     @Override
46     public NetconfOperationService createService(String netconfSessionIdForReporting) {
47         return new NetconfNotificationOperationService(netconfSessionIdForReporting, netconfNotificationRegistry);
48     }
49
50     @Override
51     public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
52         return NoopAutoCloseable.INSTANCE;
53     }
54
55     @Override
56     public void close() {
57         this.netconfOperationServiceFactoryListener.onRemoveNetconfOperationServiceFactory(this);
58     }
59 }