2 * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.rfc8528.data.api;
10 import com.google.common.annotations.Beta;
11 import java.util.Optional;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.rfc8528.model.api.MountPointSchemaResolver;
14 import org.opendaylight.yangtools.rfc8528.model.api.YangLibraryConstants.ContainerName;
15 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17 import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
20 * A resolver which can resolve the SchemaContext for use with mount point data based on the
21 * {@code ietf-yang-library} content of the mountpoint itself. This process requires two steps:
23 * <li>{@link #findContainerContext(ContainerName)} is invoked to acquire a SchemaContext in which to interpret
24 * one of the possible {@code ietf-yang-library} top-level containers.
26 * <li>The container is normalized based on the returned context by the user of this interface and then
27 * {@link #assembleSchemaContext(ContainerNode)} is invoked to acquire the SchemaContext which will be used
28 * to interpret the mount point data.
33 public interface DynamicMountPointSchemaResolver extends MountPointSchemaResolver {
35 * Return the schema in which YANG Library container content should be interpreted.
37 * @param containerName Top-level YANG Library container name
38 * @return The SchemaContext to use when interpreting the specified YANG Library container, or empty
39 * @throws NullPointerException if container is null
41 Optional<SchemaContext> findContainerContext(@NonNull ContainerName containerName);
44 * Assemble the SchemaContext for specified normalized YANG Library top-level container.
46 * @param container Top-level YANG Library container
47 * @return An assembled SchemaContext
48 * @throws NullPointerException if container is null
49 * @throws YangParserException if the schema context cannot be assembled
51 @NonNull SchemaContext assembleSchemaContext(@NonNull ContainerNode container) throws YangParserException;