|
10 | 10 | import akka.actor.Terminated;
|
11 | 11 | import akka.management.javadsl.AkkaManagement;
|
12 | 12 | import com.google.common.base.Stopwatch;
|
13 |
| -import com.google.common.util.concurrent.ListenableFuture; |
| 13 | +import com.google.common.util.concurrent.Futures; |
14 | 14 | import com.typesafe.config.Config;
|
15 | 15 | import io.lighty.codecs.util.exception.DeserializationException;
|
16 | 16 | import io.lighty.core.cluster.ClusteringHandler;
|
|
122 | 122 | import org.opendaylight.yangtools.util.DurationStatisticsTracker;
|
123 | 123 | import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
|
124 | 124 | import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
|
125 |
| -import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; |
126 |
| -import org.opendaylight.yangtools.yang.model.api.source.YangTextSource; |
| 125 | +import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException; |
127 | 126 | import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
|
128 | 127 | import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
|
129 | 128 | import org.opendaylight.yangtools.yang.xpath.api.YangXPathParserFactory;
|
@@ -273,8 +272,13 @@ protected boolean initProcedure() {
|
273 | 272 | this.snapshotResolver = new ModuleInfoSnapshotResolver("binding-dom-codec", yangParserFactory);
|
274 | 273 | this.modelsRegistration = snapshotResolver.registerModuleInfos(modelSet);
|
275 | 274 | this.moduleInfoSnapshot = snapshotResolver.takeSnapshot();
|
276 |
| - this.schemaService = new FixedDOMSchemaService(this::getEffectiveModelContext, |
277 |
| - sourceId -> (ListenableFuture<YangTextSource>) moduleInfoSnapshot.yangTextSource(sourceId)); |
| 275 | + this.schemaService = new FixedDOMSchemaService(() -> moduleInfoSnapshot.modelContext(), sourceId -> { |
| 276 | + try { |
| 277 | + return Futures.immediateFuture(moduleInfoSnapshot.getYangTextSource(sourceId)); |
| 278 | + } catch (MissingSchemaSourceException e) { |
| 279 | + return Futures.immediateFailedFuture(e); |
| 280 | + } |
| 281 | + }); |
278 | 282 |
|
279 | 283 | // INIT CODEC FACTORY
|
280 | 284 |
|
@@ -359,7 +363,7 @@ protected boolean initProcedure() {
|
359 | 363 | final InitialConfigData initialData = this.initialConfigData.get();
|
360 | 364 | try (InputStream inputStream = initialData.getAsInputStream()) {
|
361 | 365 | FileToDatastoreUtils.importConfigDataFile(inputStream, initialData.getFormat(),
|
362 |
| - getEffectiveModelContext(), this.getClusteredDOMDataBroker(), true); |
| 366 | + moduleInfoSnapshot.modelContext(), this.getClusteredDOMDataBroker(), true); |
363 | 367 | } catch (TimeoutException | ExecutionException | IOException | DeserializationException e) {
|
364 | 368 | LOG.error("Exception occurred while importing config data from file", e);
|
365 | 369 | return false;
|
@@ -504,11 +508,6 @@ public ActorSystemProvider getActorSystemProvider() {
|
504 | 508 | return this.actorSystemProvider;
|
505 | 509 | }
|
506 | 510 |
|
507 |
| - @Override |
508 |
| - public EffectiveModelContext getEffectiveModelContext() { |
509 |
| - return this.moduleInfoSnapshot.modelContext(); |
510 |
| - } |
511 |
| - |
512 | 511 | @Override
|
513 | 512 | public DOMSchemaService getDOMSchemaService() {
|
514 | 513 | return this.schemaService;
|
|
0 commit comments