OSGiDOMSchemaService should provide YANG sources 97/89297/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 23 Apr 2020 00:19:17 +0000 (02:19 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 23 Apr 2020 06:12:14 +0000 (06:12 +0000)
This was caught in downstream integration: the refactor here
forgo to add routing towards YANG source.

JIRA: MDSAL-392
Change-Id: I27b792eb932c68c89aeab21c69f7338ecb68d73b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
dom/mdsal-dom-schema-osgi/src/main/java/org/opendaylight/mdsal/dom/schema/osgi/impl/OSGiDOMSchemaService.java

index 28d76bd0eca41b04535aa8dce89008e8d141cd75..7f37aae240fa9a63e52bfe48ac3d6da6342bdd6a 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.ListenableFuture;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 import org.eclipse.jdt.annotation.NonNull;
@@ -19,6 +20,8 @@ import org.opendaylight.mdsal.dom.spi.AbstractDOMSchemaService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextListener;
+import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.osgi.service.component.ComponentFactory;
 import org.osgi.service.component.ComponentInstance;
 import org.osgi.service.component.annotations.Activate;
@@ -36,7 +39,7 @@ import org.slf4j.LoggerFactory;
  * OSGi Service Registry-backed implementation of {@link DOMSchemaService}.
  */
 @Component(service = DOMSchemaService.class, immediate = true)
-public final class OSGiDOMSchemaService extends AbstractDOMSchemaService {
+public final class OSGiDOMSchemaService extends AbstractDOMSchemaService.WithYangTextSources {
     private static final Logger LOG = LoggerFactory.getLogger(OSGiDOMSchemaService.class);
 
     @Reference(target = "(component.factory=" + EffectiveModelContextImpl.FACTORY_NAME + ")")
@@ -57,6 +60,11 @@ public final class OSGiDOMSchemaService extends AbstractDOMSchemaService {
         return registerListener(requireNonNull(listener));
     }
 
+    @Override
+    public ListenableFuture<? extends YangTextSchemaSource> getSource(final SourceIdentifier sourceIdentifier) {
+        return currentSnapshot.getSource(sourceIdentifier);
+    }
+
     @Reference(fieldOption = FieldOption.REPLACE)
     void bindSnapshot(final OSGiModuleInfoSnapshot newContext) {
         LOG.trace("Updating context to generation {}", newContext.getGeneration());