Refactor DOMYangTextSourceProvider 52/109652/9
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 6 Jan 2024 03:48:25 +0000 (04:48 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Jan 2024 08:07:27 +0000 (09:07 +0100)
This should really be a proper extension with its own API. While we are
at it.

mdsal-binding-runtime-api is made synchronous, as there is just no need
to use futures.

Change-Id: I3711662242df8d912c2536a3d73d4f86beea2c33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 files changed:
binding/mdsal-binding-dom-adapter/src/test/java/org/opendaylight/mdsal/binding/dom/adapter/CurrentAdapterSerializerTest.java
binding/mdsal-binding-runtime-api/pom.xml
binding/mdsal-binding-runtime-api/src/main/java/module-info.java
binding/mdsal-binding-runtime-api/src/main/java/org/opendaylight/mdsal/binding/runtime/api/ModuleInfoSnapshot.java
binding/mdsal-binding-runtime-spi/src/main/java/org/opendaylight/mdsal/binding/runtime/spi/DefaultModuleInfoSnapshot.java
binding/mdsal-binding-runtime-spi/src/main/java/org/opendaylight/mdsal/binding/runtime/spi/ForwardingModuleInfoSnapshot.java
dom/mdsal-dom-api/pom.xml
dom/mdsal-dom-api/src/main/java/module-info.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMSchemaService.java
dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMYangTextSourceProvider.java [deleted file]
dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/OSGiDOMSchemaService.java
dom/mdsal-dom-spi/pom.xml
dom/mdsal-dom-spi/src/main/java/module-info.java
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/FixedDOMSchemaService.java

index e677a8625edfd1ce2e85690b624a90b7bfe91fa3..5db62c0fca122bccf7c7d337efe1a4cfb33b4824 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThrows;
 
-import com.google.common.util.concurrent.ListenableFuture;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -36,6 +35,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
+import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class CurrentAdapterSerializerTest {
@@ -126,19 +126,25 @@ public class CurrentAdapterSerializerTest {
         }
 
         @Override
-        public EffectiveModelContext modelContext() {
-            throw new UnsupportedOperationException();
+        @SuppressWarnings("unchecked")
+        public <T> Class<T> loadClass(final String fullyQualifiedName) throws ClassNotFoundException {
+            return (Class<T>) Class.forName(fullyQualifiedName);
         }
 
         @Override
-        public ListenableFuture<? extends YangTextSource> getSource(final SourceIdentifier sourceIdentifier) {
-            throw new UnsupportedOperationException();
+        public YangTextSource yangTextSource(final SourceIdentifier arg0) {
+            return null;
         }
 
         @Override
-        @SuppressWarnings("unchecked")
-        public <T> Class<T> loadClass(final String fullyQualifiedName) throws ClassNotFoundException {
-            return (Class<T>) Class.forName(fullyQualifiedName);
+        public YangTextSource getYangTextSource(final SourceIdentifier sourceId) throws MissingSchemaSourceException {
+            throw new MissingSchemaSourceException(sourceId, "no sources");
         }
+
+        @Override
+        public EffectiveModelContext modelContext() {
+            throw new UnsupportedOperationException();
+        }
+
     }
 }
index 06a9bd48547fa96f0214ec918811f13fd5cf7bf8..87261eaeaa17addc5b4f7cfab5c495b99dc2c2ea 100644 (file)
@@ -46,7 +46,7 @@
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-repo-spi</artifactId>
+            <artifactId>yang-repo-api</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
index e39a79178395cbc8a8d465055d56692f3c45cb18..dabf23dd6767d421464ce704eff46e04dfa566bd 100644 (file)
@@ -11,8 +11,8 @@ module org.opendaylight.mdsal.binding.runtime.api {
     requires transitive org.opendaylight.yangtools.concepts;
     requires transitive org.opendaylight.yangtools.yang.common;
     requires transitive org.opendaylight.yangtools.yang.model.api;
+    requires transitive org.opendaylight.yangtools.yang.repo.api;
     requires transitive org.opendaylight.yangtools.yang.binding;
-    requires transitive org.opendaylight.yangtools.yang.repo.spi;
     requires transitive org.opendaylight.yangtools.rfc8040.model.api;
     requires transitive org.opendaylight.mdsal.binding.model.api;
     requires org.slf4j;
index fa70bfb1f69accd2492e45ef5432433921ba407b..9b2b722d45b4ee2ae5ea3e8d35a4e7be0d615444 100644 (file)
@@ -8,24 +8,31 @@
 package org.opendaylight.mdsal.binding.runtime.api;
 
 import com.google.common.annotations.Beta;
-import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
-import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
+import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 
 /**
  * A snapshot of a set of {@link YangModuleInfo}s, assembled to form an {@link EffectiveModelContext}.
  */
 @Beta
-public interface ModuleInfoSnapshot extends Immutable, SchemaSourceProvider<YangTextSource> {
+@NonNullByDefault
+public interface ModuleInfoSnapshot extends Immutable {
     /**
      * The {@link EffectiveModelContext} resulting from all models exposed from constituent module infos.
      *
      * @return the resulting model context
      */
-    @NonNull EffectiveModelContext modelContext();
+    EffectiveModelContext modelContext();
+
+    @Nullable YangTextSource yangTextSource(SourceIdentifier sourceId);
+
+    YangTextSource getYangTextSource(SourceIdentifier sourceId) throws MissingSchemaSourceException;
 
     <T> Class<T> loadClass(String fullyQualifiedName) throws ClassNotFoundException;
 }
index 94298c1bb1bae829a7640a8899e3207d7baf22f3..a439c50899211fb61fa2a76231c34434784e7761 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.mdsal.binding.runtime.spi;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.collect.ImmutableMap;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Map;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot;
@@ -41,11 +39,18 @@ final class DefaultModuleInfoSnapshot implements ModuleInfoSnapshot {
     }
 
     @Override
-    public ListenableFuture<? extends YangTextSource> getSource(final SourceIdentifier sourceId) {
+    public YangTextSource yangTextSource(final SourceIdentifier sourceId) {
         final var info = moduleInfos.get(sourceId);
-        return info == null
-            ? Futures.immediateFailedFuture(new MissingSchemaSourceException(sourceId, "No source registered"))
-                : Futures.immediateFuture(new DelegatedYangTextSource(sourceId, info.getYangTextCharSource()));
+        return info == null ? null : new DelegatedYangTextSource(sourceId, info.getYangTextCharSource());
+    }
+
+    @Override
+    public YangTextSource getYangTextSource(final SourceIdentifier sourceId) throws MissingSchemaSourceException {
+        final var source = yangTextSource(sourceId);
+        if (source == null) {
+            throw new MissingSchemaSourceException(sourceId, "No source registered");
+        }
+        return source;
     }
 
     @Override
index 1564797e7e51908819449b7fad3260030120a627..705573915fcf238dae7d8a72f2b76de7322f3966 100644 (file)
@@ -9,14 +9,16 @@ package org.opendaylight.mdsal.binding.runtime.spi;
 
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ForwardingObject;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
+import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 
 @Beta
+@NonNullByDefault
 public abstract class ForwardingModuleInfoSnapshot extends ForwardingObject implements ModuleInfoSnapshot {
     @Override
     protected abstract ModuleInfoSnapshot delegate();
@@ -27,12 +29,17 @@ public abstract class ForwardingModuleInfoSnapshot extends ForwardingObject impl
     }
 
     @Override
-    public @NonNull EffectiveModelContext modelContext() {
+    public EffectiveModelContext modelContext() {
         return delegate().modelContext();
     }
 
     @Override
-    public ListenableFuture<? extends YangTextSource> getSource(final SourceIdentifier sourceIdentifier) {
-        return delegate().getSource(sourceIdentifier);
+    public @Nullable YangTextSource yangTextSource(final SourceIdentifier sourceId) {
+        return delegate().yangTextSource(sourceId);
+    }
+
+    @Override
+    public YangTextSource getYangTextSource(final SourceIdentifier sourceId) throws MissingSchemaSourceException {
+        return delegate().getYangTextSource(sourceId);
     }
 }
index 37d322d84e220e619419db5e3e56ef1b2c4621bc..d19e55936886cd5d92c206a32c179639fdffa867 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-model-api</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-model-spi</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-repo-spi</artifactId>
-        </dependency>
 
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
index dad7ab6946865553d51f0b74e085a6229fb57d9f..b253ca497c35a29fd618841c49a23e4809a26ffc 100644 (file)
@@ -14,8 +14,6 @@ module org.opendaylight.mdsal.dom.api {
     requires transitive org.opendaylight.yangtools.yang.data.api;
     requires transitive org.opendaylight.yangtools.yang.data.tree.api;
     requires transitive org.opendaylight.yangtools.yang.model.api;
-    requires transitive org.opendaylight.yangtools.yang.model.spi;
-    requires transitive org.opendaylight.yangtools.yang.repo.spi;
     requires transitive org.opendaylight.mdsal.common.api;
     requires transitive org.opendaylight.yangtools.concepts;
     requires org.opendaylight.yangtools.util;
index 8770f96f204975a2227262285348876866875970..42dbd9bb132e755bd8e34170161c7ee60578a363 100644 (file)
@@ -7,10 +7,13 @@
  */
 package org.opendaylight.mdsal.dom.api;
 
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.function.Consumer;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
 
 @NonNullByDefault
 public interface DOMSchemaService extends DOMService<DOMSchemaService, DOMSchemaService.Extension> {
@@ -36,4 +39,18 @@ public interface DOMSchemaService extends DOMService<DOMSchemaService, DOMSchema
      * @throws NullPointerException if {@code listener} is {@code null}
      */
     Registration registerSchemaContextListener(Consumer<EffectiveModelContext> listener);
+
+    /**
+     * An {@link Extension} exposing access to {@link YangTextSource}.
+     */
+    @FunctionalInterface
+    interface YangTextSourceExtension extends Extension {
+        /**
+         * Return a future producing a {@link YangTextSource} containing the YANG text of specified source.
+         *
+         * @param sourceId A {@link SourceIdentifier}
+         * @return A future
+         */
+        ListenableFuture<YangTextSource> getYangTexttSource(SourceIdentifier sourceId);
+    }
 }
diff --git a/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMYangTextSourceProvider.java b/dom/mdsal-dom-api/src/main/java/org/opendaylight/mdsal/dom/api/DOMYangTextSourceProvider.java
deleted file mode 100644 (file)
index c547b94..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.dom.api;
-
-import com.google.common.annotations.Beta;
-import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
-import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
-
-/**
- * A {@link DOMSchemaService.Extension} exposing access to {@link YangTextSource}. Instances of this method should
- * be acquired from {@link DOMSchemaService}.
- */
-@Beta
-public interface DOMYangTextSourceProvider
-        extends DOMSchemaService.Extension, SchemaSourceProvider<YangTextSource> {
-
-}
index a1ace089a0279b82e352dcfa8e9565ada4d1b4ae..013fc91e6c0c07c0c26bd104da3de0370f284516 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.mdsal.dom.schema.osgi.impl;
 
 import static java.util.Objects.requireNonNull;
 
+import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -17,13 +18,13 @@ import java.util.function.Consumer;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
 import org.opendaylight.mdsal.dom.schema.osgi.OSGiModuleInfoSnapshot;
 import org.opendaylight.yangtools.concepts.AbstractRegistration;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
+import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
 import org.osgi.service.component.ComponentFactory;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
@@ -38,8 +39,8 @@ import org.slf4j.LoggerFactory;
 /**
  * OSGi Service Registry-backed implementation of {@link DOMSchemaService}.
  */
-@Component(service = DOMSchemaService.class, immediate = true)
-public final class OSGiDOMSchemaService implements DOMSchemaService, DOMYangTextSourceProvider {
+@Component(immediate = true)
+public final class OSGiDOMSchemaService implements DOMSchemaService, DOMSchemaService.YangTextSourceExtension {
     private static final Logger LOG = LoggerFactory.getLogger(OSGiDOMSchemaService.class);
 
     private final List<Consumer<EffectiveModelContext>> listeners = new CopyOnWriteArrayList<>();
@@ -56,6 +57,11 @@ public final class OSGiDOMSchemaService implements DOMSchemaService, DOMYangText
         LOG.info("DOM Schema services activated");
     }
 
+    @Override
+    public List<Extension> supportedExtensions() {
+        return List.of(this);
+    }
+
     @Deactivate
     void deactivate() {
         LOG.info("DOM Schema services deactivated");
@@ -110,8 +116,12 @@ public final class OSGiDOMSchemaService implements DOMSchemaService, DOMYangText
     }
 
     @Override
-    public ListenableFuture<? extends YangTextSource> getSource(final SourceIdentifier sourceIdentifier) {
-        return currentSnapshot.get().getSource(sourceIdentifier);
+    public ListenableFuture<YangTextSource> getYangTexttSource(final SourceIdentifier sourceId) {
+        try {
+            return Futures.immediateFuture(currentSnapshot.get().getYangTextSource(sourceId));
+        } catch (MissingSchemaSourceException e) {
+            return Futures.immediateFailedFuture(e);
+        }
     }
 
     @SuppressWarnings("checkstyle:illegalCatch")
index 0f34d4f8501d19ff930a298e55ce31e860c4887c..7868dae4eabeb4b0ddc5fddcf028f006fa92610e 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-model-api</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-repo-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>yang-repo-spi</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-common-api</artifactId>
             <artifactId>yang-parser-api</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-repo-api</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-test-util</artifactId>
index 6b4bb0e8b1170c7bdba8eeb42f350a36c3b86d10..048d94bce9ecaac9bd4e056ff6bf1cce67f7d561 100644 (file)
@@ -15,8 +15,6 @@ module org.opendaylight.mdsal.dom.spi {
     requires transitive org.opendaylight.yangtools.yang.common;
     requires transitive org.opendaylight.yangtools.yang.data.tree.api;
     requires transitive org.opendaylight.yangtools.yang.model.api;
-    requires transitive org.opendaylight.yangtools.yang.repo.api;
-    requires transitive org.opendaylight.yangtools.yang.repo.spi;
     requires com.google.common;
     requires org.opendaylight.yangtools.concepts;
     requires org.opendaylight.yangtools.odlext.model.api;
index c2d49c449237274506249139283002e760e31328..48cbd4b996ecbdf1e600b0956241fc8f87cefb4a 100644 (file)
@@ -10,67 +10,44 @@ package org.opendaylight.mdsal.dom.spi;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.util.List;
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
-import org.opendaylight.mdsal.dom.api.DOMYangTextSourceProvider;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
-import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
 
 /**
- * {@link DOMSchemaService} (and {@link DOMYangTextSourceProvider}) implementations backed by a
- * {@code Supplier<EffectiveModelContext>} (and {@link SchemaSourceProvider}) which are known to be fixed and never
- * change schemas.
+ * {@link DOMSchemaService} backed by a {@code Supplier<EffectiveModelContext>}
+ * (and potentially a {@link YangTextSourceExtension}) which are known to be fixed
+ * and never change schemas.
  *
  * @author Michael Vorburger.ch
  */
 @Beta
 @NonNullByDefault
-public sealed class FixedDOMSchemaService implements DOMSchemaService {
-    private static final class WithYangTextSources extends FixedDOMSchemaService implements DOMYangTextSourceProvider {
-        private final SchemaSourceProvider<YangTextSource> schemaSourceProvider;
-
-        WithYangTextSources(final Supplier<EffectiveModelContext> modelContextSupplier,
-                final SchemaSourceProvider<YangTextSource> schemaSourceProvider) {
-            super(modelContextSupplier);
-            this.schemaSourceProvider = requireNonNull(schemaSourceProvider);
-        }
-
-        @Override
-        public List<Extension> supportedExtensions() {
-            return List.of(this);
-        }
-
-        @Override
-        public ListenableFuture<? extends YangTextSource> getSource(final SourceIdentifier sourceIdentifier) {
-            return schemaSourceProvider.getSource(sourceIdentifier);
-        }
+public record FixedDOMSchemaService(
+        Supplier<EffectiveModelContext> modelContextSupplier,
+        @Nullable YangTextSourceExtension extension) implements DOMSchemaService {
+    public FixedDOMSchemaService {
+        requireNonNull(modelContextSupplier);
     }
 
-    private final Supplier<EffectiveModelContext> modelContextSupplier;
-
-    private FixedDOMSchemaService(final Supplier<EffectiveModelContext> modelContextSupplier) {
-        this.modelContextSupplier = requireNonNull(modelContextSupplier);
+    public FixedDOMSchemaService(final Supplier<EffectiveModelContext> modelContextSupplier) {
+        this(modelContextSupplier, null);
     }
 
-    public static DOMSchemaService of(final EffectiveModelContext effectiveModel) {
-        final var checked = requireNonNull(effectiveModel);
-        return new FixedDOMSchemaService(() -> checked);
+    public FixedDOMSchemaService(final EffectiveModelContext effectiveModel) {
+        this(() -> effectiveModel, null);
+        requireNonNull(effectiveModel);
     }
 
-    public static DOMSchemaService of(final Supplier<EffectiveModelContext> modelContextSupplier) {
-        return new FixedDOMSchemaService(modelContextSupplier);
-    }
-
-    public static DOMSchemaService of(final Supplier<EffectiveModelContext> modelContextSupplier,
-            final SchemaSourceProvider<YangTextSource> yangTextSourceProvider) {
-        return new WithYangTextSources(modelContextSupplier, requireNonNull(yangTextSourceProvider));
+    @Override
+    public List<Extension> supportedExtensions() {
+        final var local = extension;
+        return local == null ? List.of() : List.of(local);
     }
 
     @Override