- return create(context, path.getPathFromRoot());
- }
-
- private static @NonNull SchemaTracker create(final EffectiveModelContext context, final Iterable<QName> path) {
- final Collection<SchemaNode> schemaNodes = SchemaUtils.findParentSchemaNodesOnPath(context, path);
- checkArgument(!schemaNodes.isEmpty(), "Unable to find schema node for supplied schema path: %s", path);
- if (schemaNodes.size() > 1) {
- LOG.warn("More possible schema nodes {} for supplied schema path {}", schemaNodes, path);
- }
- final Optional<DataNodeContainer> current = schemaNodes.stream()
- .filter(node -> node instanceof DataNodeContainer).map(DataNodeContainer.class::cast)
- .findFirst();
- checkArgument(current.isPresent(),
- "Schema path must point to container or list or an rpc input/output. Supplied path %s pointed to: %s",
- path, current);
- return new SchemaTracker(current.get());