import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.source.SourceRepresentation;
import org.opendaylight.yangtools.yang.model.repo.api.MissingSchemaSourceException;
import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
-import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
-import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* a specific representation of a source.
*/
@GuardedBy("this")
- private final Map<SourceIdentifier, ListMultimap<Class<? extends SchemaSourceRepresentation>,
+ private final Map<SourceIdentifier, ListMultimap<Class<? extends SourceRepresentation>,
SchemaSourceRegistration>> sources = new HashMap<>();
/*
@GuardedBy("this")
private final List<SchemaListenerRegistration> listeners = new ArrayList<>();
- private static <T extends SchemaSourceRepresentation> ListenableFuture<T> fetchSource(final SourceIdentifier id,
- final Iterator<SchemaSourceRegistration> it) {
+ private static <T extends SourceRepresentation> ListenableFuture<T> fetchSource(
+ final SourceIdentifier sourceId, final Iterator<SchemaSourceRegistration> it) {
final var reg = it.next();
@SuppressWarnings("unchecked")
final var provider = (SchemaSourceProvider<T>) reg.provider();
- return Futures.catchingAsync(provider.getSource(id), Throwable.class, input -> {
+ return Futures.catchingAsync(provider.getSource(sourceId), Throwable.class, input -> {
LOG.debug("Failed to acquire source from {}", reg, input);
if (it.hasNext()) {
- return fetchSource(id, it);
+ return fetchSource(sourceId, it);
}
- throw new MissingSchemaSourceException("All available providers exhausted", id, input);
+ throw new MissingSchemaSourceException("All available providers exhausted", sourceId, input);
}, MoreExecutors.directExecutor());
}
@Override
- public <T extends SchemaSourceRepresentation> ListenableFuture<T> getSchemaSource(final SourceIdentifier id,
+ public <T extends SourceRepresentation> ListenableFuture<T> getSchemaSource(final SourceIdentifier id,
final Class<T> representation) {
final ArrayList<SchemaSourceRegistration> sortedSchemaSourceRegistrations;
final var regs = sortedSchemaSourceRegistrations.iterator();
if (!regs.hasNext()) {
return immediateFailedFluentFuture(new MissingSchemaSourceException(
- "No providers for source " + id + " representation " + representation + " available", id));
+ "No providers for source " + id + " representation " + representation + " available", id));
}
final ListenableFuture<T> fetchSourceFuture = fetchSource(id, regs);
}
@Override
- public <T extends SchemaSourceRepresentation> Registration registerSchemaSource(
+ public <T extends SourceRepresentation> Registration registerSchemaSource(
final SchemaSourceProvider<? super T> provider, final PotentialSchemaSource<T> source) {
final var ret = new SchemaSourceRegistration(source.cachedReference(), provider);
addSource(ret);