use of org.opendaylight.yangtools.rfc8528.data.api.YangLibraryConstants.ContainerName in project yangtools by opendaylight.
the class AbstractDynamicMountPointContextFactory method createContext.
@Override
public final MountPointContext createContext(final Map<ContainerName, MountPointChild> libraryContainers, final MountPointChild schemaMounts) throws YangParserException {
for (Entry<ContainerName, MountPointChild> entry : libraryContainers.entrySet()) {
// Context for the specific code word
final Optional<EffectiveModelContext> optLibContext = findSchemaForLibrary(entry.getKey());
if (optLibContext.isEmpty()) {
LOG.debug("YANG Library context for mount point {} container {} not found", getIdentifier(), entry.getKey());
continue;
}
final NormalizedNode libData;
try {
libData = entry.getValue().normalizeTo(optLibContext.get());
} catch (IOException e) {
throw new YangParserException("Failed to interpret yang-library data", e);
}
if (!(libData instanceof ContainerNode)) {
throw new YangParserException("Invalid yang-library non-container " + libData);
}
final EffectiveModelContext schemaContext = bindLibrary(entry.getKey(), (ContainerNode) libData);
if (schemaMounts == null) {
return new EmptyMountPointContext(schemaContext);
}
final NormalizedNode mountData;
try {
mountData = schemaMounts.normalizeTo(schemaContext);
} catch (IOException e) {
throw new YangParserException("Failed to interpret schema-mount data", e);
}
if (!(mountData instanceof ContainerNode)) {
throw new YangParserException("Invalid schema-mount non-container " + mountData);
}
return createMountPointContext(schemaContext, (ContainerNode) mountData);
}
throw new YangParserException("Failed to interpret " + libraryContainers);
}
use of org.opendaylight.yangtools.rfc8528.data.api.YangLibraryConstants.ContainerName in project yangtools by opendaylight.
the class MountPointData method setContainer.
public void setContainer(@NonNull final ContainerName containerName, @NonNull final MountPointChild data) {
final MountPointChild prev = yangLib.putIfAbsent(containerName, requireNonNull(data));
checkState(prev == null, "Attempted to duplicate container %s data %s with %s", containerName, prev, data);
addChild(data);
}
Aggregations