Add support for formatting EffectiveModelContext
[mdsal.git] / yanglib / mdsal-yanglib-api / src / main / java / org / opendaylight / mdsal / yanglib / api / YangLibraryContentBuilder.java
diff --git a/yanglib/mdsal-yanglib-api/src/main/java/org/opendaylight/mdsal/yanglib/api/YangLibraryContentBuilder.java b/yanglib/mdsal-yanglib-api/src/main/java/org/opendaylight/mdsal/yanglib/api/YangLibraryContentBuilder.java
new file mode 100644 (file)
index 0000000..cee00c1
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2020 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.mdsal.yanglib.api;
+
+import com.google.common.annotations.Beta;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.opendaylight.yangtools.yang.data.api.DatastoreIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+
+@Beta
+@NonNullByDefault
+public interface YangLibraryContentBuilder {
+    /**
+     * Set the default EffectiveModelContext used for this content builder.
+     *
+     * @param modelContext EffectiveModelContext to use for content generation.
+     * @return this builder
+     * @throws NullPointerException if any argument is null
+     */
+    YangLibraryContentBuilder defaultContext(EffectiveModelContext modelContext);
+
+    /**
+     * Add a secondary datastore(s) which use different EffectiveModelContext than the default provided context.
+     * This/These datastore/s are used in the output encoding of the YANG library.
+     *
+     * @param identifier identifies the datastore in the ouput
+     * @param context EffectiveModelContext of this datastore
+     * @return this builder
+     * @throws NullPointerException if any argument is null
+     * @throws IllegalArgumentException if this implementation does not support per-datastore contexts and a conflicting
+     *                                  context is already present.
+     */
+    YangLibraryContentBuilder addDatastore(DatastoreIdentifier identifier, EffectiveModelContext context);
+
+    /**
+     * Option to include legacy YANG library content in the resulting output.
+     *
+     * @return LegacyYangLibraryContentBuilder which generates output that contains YANG library data in
+     *         both legacy and non-legacy format.
+     */
+    YangLibraryContentBuilderWithLegacy includeLegacy();
+
+    /**
+     * Format the contents of the YANG library into NormalizedNodes using the provided EffectiveModelContext.
+     *
+     * @return List of NormalizedNodes that contain the YANG library content.
+     */
+    ContainerNode formatYangLibraryContent();
+}