<version>3.0.3-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc8528-data-api</artifactId>
+ <version>3.0.3-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>rfc8528-model-api</artifactId>
<module>rfc8040-parser-support</module>
<!-- RFC8528 (mount-point) metamodel support -->
+ <module>rfc8528-data-api</module>
<module>rfc8528-model-api</module>
<module>rfc8528-parser-support</module>
</modules>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>bundle-parent</artifactId>
+ <version>3.0.3-SNAPSHOT</version>
+ <relativePath>../../bundle-parent</relativePath>
+ </parent>
+
+ <artifactId>rfc8528-data-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>${project.artifactId}</name>
+ <description>RFC8528 data model extensions</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>concepts</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-parser-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>rfc8528-model-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Automatic-Module-Name>org.opendaylight.yangtools.rfc8528.data.api</Automatic-Module-Name>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <configuration>
+ <failOnError>true</failOnError>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.rfc8528.data.api;
+
+import com.google.common.annotations.Beta;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.rfc8528.model.api.MountPointSchemaResolver;
+import org.opendaylight.yangtools.rfc8528.model.api.YangLibraryConstants.ContainerName;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.parser.api.YangParserException;
+
+/**
+ * A resolver which can resolve the SchemaContext for use with mount point data based on the
+ * {@code ietf-yang-library} content of the mountpoint itself. This process requires two steps:
+ * <ul>
+ * <li>{@link #findContainerContext(ContainerName)} is invoked to acquire a SchemaContext in which to interpret
+ * one of the possible {@code ietf-yang-library} top-level containers.
+ * </li>
+ * <li>The container is normalized based on the returned context by the user of this interface and then
+ * {@link #assembleSchemaContext(ContainerNode)} is invoked to acquire the SchemaContext which will be used
+ * to interpret the mount point data.
+ * </li>
+ * </ul>
+ */
+@Beta
+public interface DynamicMountPointSchemaResolver extends MountPointSchemaResolver {
+ /**
+ * Return the schema in which YANG Library container content should be interpreted.
+ *
+ * @param containerName Top-level YANG Library container name
+ * @return The SchemaContext to use when interpreting the specified YANG Library container, or empty
+ * @throws NullPointerException if container is null
+ */
+ Optional<SchemaContext> findContainerContext(@NonNull ContainerName containerName);
+
+ /**
+ * Assemble the SchemaContext for specified normalized YANG Library top-level container.
+ *
+ * @param container Top-level YANG Library container
+ * @return An assembled SchemaContext
+ * @throws NullPointerException if container is null
+ * @throws YangParserException if the schema context cannot be assembled
+ */
+ @NonNull SchemaContext assembleSchemaContext(@NonNull ContainerNode container) throws YangParserException;
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.rfc8528.data.api;
+
+import com.google.common.annotations.Beta;
+import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.rfc8528.model.api.MountPointSchemaResolver;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension;
+
+/**
+ * A {@link NormalizedNodeStreamWriterExtension} exposed by stream writers which can handle mount point data, notably
+ * providing the facilities to resolve a mount point schema and normalize mount point contents into a normalized
+ * structure.
+ */
+@Beta
+public interface MountPointStreamWriter extends NormalizedNodeStreamWriterExtension {
+ /**
+ * Attempt to acquire a {@link MountPointSchemaResolver} to resolve schemas for the purposes of interpreting this
+ * mount point. An empty result indicates the mount point is not attached.
+ *
+ * @param label Mount point label, as defined via the use of {@code mount-point} statement
+ * @return An optional handler for mount point data
+ * @throws NullPointerException if label is null
+ */
+ Optional<MountPointSchemaResolver> findMountPoint(@NonNull QName label);
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.rfc8528.model.api;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
+/**
+ * An entity able to resolve the SchemaContext for embedded mount points. This interface should not be implemented
+ * directly, but rather its domain specializations, like {@link StaticMountPointSchemaResolver} should be provided.
+ */
+@Beta
+@NonNullByDefault
+public interface MountPointSchemaResolver {
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.rfc8528.model.api;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNull;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
+
+/**
+ * A resolver which has static knowledge of the SchemaContext which should be used to interpret mount point data.
+ * Instances of this interface should be used in contexts where the mount point data is expected not to contain
+ * required {@code ietf-yang-library} data, for example due to filtering.
+ */
+@Beta
+public interface StaticMountPointSchemaResolver extends MountPointSchemaResolver, SchemaContextProvider {
+ @Override
+ @NonNull SchemaContext getSchemaContext();
+}