c6712b2ff0128e3ab642780b7f808af99500e09a
[yangtools.git] / data / rfc8528-data-api / src / main / java / org / opendaylight / yangtools / rfc8528 / data / api / StreamWriterMountPointExtension.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech s.r.o. and others. All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.rfc8528.data.api;
9
10 import com.google.common.annotations.Beta;
11 import java.io.IOException;
12 import org.eclipse.jdt.annotation.NonNullByDefault;
13 import org.opendaylight.yangtools.yang.data.api.schema.MountPointContext;
14 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
15 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriterExtension;
16
17 /**
18  * A {@link NormalizedNodeStreamWriterExtension} exposed by stream writers which can handle mount point data, notably
19  * providing the facilities to resolve a mount point schema and normalize mount point contents into a normalized
20  * structure.
21  */
22 @Beta
23 @NonNullByDefault
24 public interface StreamWriterMountPointExtension extends NormalizedNodeStreamWriterExtension {
25     /**
26      * Start a new mount point with a specific mount point context. The returned writer will be used to emit the content
27      * of the mount point, without touching the writer to which this extension is attached to. Once that is done, the
28      * returned writer will be {@link NormalizedNodeStreamWriter#close()}d, at which point the parent writer will be
29      * used again to emit the rest of the tree.
30      *
31      * @param mountId Mount point identifier
32      * @param mountCtx Mount point context
33      * @return A new NormalizedNodeStreamWriter
34      * @throws IOException if an error occurs
35      */
36     NormalizedNodeStreamWriter startMountPoint(MountPointIdentifier mountId, MountPointContext mountCtx)
37             throws IOException;
38 }