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.eclipse.jdt.annotation.NonNullByDefault;
14 import org.opendaylight.yangtools.rfc8528.model.api.MountPointSchemaResolver;
15 import org.opendaylight.yangtools.rfc8528.model.api.StaticMountPointSchemaResolver;
16 import org.opendaylight.yangtools.rfc8528.model.api.YangLibraryConstants.ContainerName;
17 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
22 public interface MountPointNodeFactoryResolver extends MountPointSchemaResolver {
24 * A resolver which can resolve the SchemaContext for use with mount point data based on the
25 * {@code ietf-yang-library} content of the mountpoint itself. This process requires two steps:
27 * <li>{@link #findSchemaForLibrary(ContainerName)} is invoked to acquire a SchemaContext in which to interpret
28 * one of the possible {@code ietf-yang-library} top-level containers.
30 * <li>The container is normalized based on the returned context by the user of this interface and then
31 * {@link LibraryContext#bindTo(ContainerNode)} is invoked to acquire the MountPointMetadata.
35 public interface Inline extends MountPointNodeFactoryResolver {
37 interface LibraryContext {
39 * Return a SchemaContext capable of parsing the content of YANG Library.
41 * @return A SchemaContext instance
43 SchemaContext getLibraryContainerSchema();
46 * Assemble the SchemaContext for specified normalized YANG Library top-level container.
48 * @param container Top-level YANG Library container
49 * @return An assembled SchemaContext
50 * @throws NullPointerException if container is null
51 * @throws YangParserException if the schema context cannot be assembled
53 MountPointNodeFactory bindTo(ContainerNode container) throws YangParserException;
57 * Return the schema in which YANG Library container content should be interpreted.
60 * Note this schema is not guaranteed to contain any augmentations, hence parsing could fail.
62 * @param containerName Top-level YANG Library container name
63 * @return The LibraryContext to use when interpreting the specified YANG Library container, or empty
64 * @throws NullPointerException if container is null
66 Optional<LibraryContext> findSchemaForLibrary(@NonNull ContainerName containerName);
70 interface SharedSchema extends MountPointNodeFactoryResolver, StaticMountPointSchemaResolver {
73 MountPointNodeFactory getSchema();