Decouple config and netconf subsystems.
[controller.git] / opendaylight / netconf / mdsal-netconf-monitoring / src / main / java / org / opendaylight / controller / netconf / monitoring / NetconfMonitoringOperationServiceFactory.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.controller.netconf.monitoring;
10
11 import java.util.Collections;
12 import java.util.Set;
13 import org.opendaylight.controller.config.util.capability.Capability;
14 import org.opendaylight.controller.netconf.api.monitoring.CapabilityListener;
15 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService;
16 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory;
17
18 public class NetconfMonitoringOperationServiceFactory implements NetconfOperationServiceFactory, AutoCloseable {
19
20     private final NetconfMonitoringOperationService operationService;
21
22     private static final AutoCloseable AUTO_CLOSEABLE = new AutoCloseable() {
23         @Override
24         public void close() throws Exception {
25             // NOOP
26         }
27     };
28
29     public NetconfMonitoringOperationServiceFactory(final NetconfMonitoringOperationService operationService) {
30         this.operationService = operationService;
31     }
32
33     @Override
34     public NetconfOperationService createService(final String netconfSessionIdForReporting) {
35         return operationService;
36     }
37
38     @Override
39     public Set<Capability> getCapabilities() {
40         // TODO
41         // No capabilities exposed to prevent clashes with schemas from config-netconf-connector (it exposes all the schemas)
42         // If the schemas exposed by config-netconf-connector are filtered, this class would expose monitoring related models
43         return Collections.emptySet();
44     }
45
46     @Override
47     public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
48         return AUTO_CLOSEABLE;
49     }
50
51     @Override
52     public void close() {}
53 }