Remove unused exceptions
[netconf.git] / netconf / mdsal-netconf-connector / src / main / java / org / opendaylight / netconf / mdsal / connector / CurrentSchemaContext.java
index fa7f273465b24a665815026412a8e13f3a2afd57..2c5adb41b3a31b8f0f0819497b897da6d77e70b4 100644 (file)
@@ -13,9 +13,9 @@ import com.google.common.collect.Sets;
 import java.util.Collections;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
-import org.opendaylight.controller.config.util.capability.Capability;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.netconf.api.capability.Capability;
 import org.opendaylight.netconf.api.monitoring.CapabilityListener;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
 
 public class CurrentSchemaContext implements SchemaContextListener, AutoCloseable {
-    private final AtomicReference<SchemaContext> currentContext = new AtomicReference();
+    private final AtomicReference<SchemaContext> currentContext = new AtomicReference<>();
     private final ListenerRegistration<SchemaContextListener> schemaContextListenerListenerRegistration;
     private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(Sets.newHashSet());
     private final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider;
@@ -33,7 +33,8 @@ public class CurrentSchemaContext implements SchemaContextListener, AutoCloseabl
         return currentContext.get();
     }
 
-    public CurrentSchemaContext(final SchemaService schemaService, final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider) {
+    public CurrentSchemaContext(final DOMSchemaService schemaService,
+                                final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider) {
         this.rootSchemaSourceProvider = rootSchemaSourceProvider;
         schemaContextListenerListenerRegistration = schemaService.registerSchemaContextListener(this);
     }
@@ -42,22 +43,24 @@ public class CurrentSchemaContext implements SchemaContextListener, AutoCloseabl
     public void onGlobalContextUpdated(final SchemaContext schemaContext) {
         currentContext.set(schemaContext);
         // FIXME is notifying all the listeners from this callback wise ?
-        final Set<Capability> addedCaps = MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider);
+        final Set<Capability> addedCaps = MdsalNetconfOperationServiceFactory.transformCapabilities(
+                currentContext.get(), rootSchemaSourceProvider);
         for (final CapabilityListener listener : listeners1) {
             listener.onCapabilitiesChanged(addedCaps, Collections.emptySet());
         }
     }
 
     @Override
-    public void close() throws Exception {
+    public void close() {
         listeners1.clear();
         schemaContextListenerListenerRegistration.close();
         currentContext.set(null);
     }
 
     public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
-        listener.onCapabilitiesChanged(MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider), Collections.<Capability>emptySet());
+        listener.onCapabilitiesChanged(MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(),
+                rootSchemaSourceProvider), Collections.emptySet());
         listeners1.add(listener);
         return () -> listeners1.remove(listener);
     }
-}
\ No newline at end of file
+}