Move OpenConfigVersion support
[yangtools.git] / parser / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / reactor / RFC7950Reactors.java
index 1d13c6b6690a23885b75724b280fec87289be450..e756825b2c6d710a6847caccc334659d5b0b7356 100644 (file)
@@ -16,7 +16,6 @@ import com.google.common.collect.Sets;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.YangVersion;
 import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
-import org.opendaylight.yangtools.yang.parser.openconfig.stmt.OpenConfigVersionSupport;
 import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.ModuleQNameToPrefix;
 import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.YangNamespaceContextNamespace;
 import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.augment.AugmentImplicitHandlingNamespace;
@@ -111,8 +110,6 @@ import org.opendaylight.yangtools.yang.parser.spi.SchemaTreeNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.SubmoduleNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
-import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionModuleNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.SemanticVersionNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementDefinitionNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupportBundle;
 import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToModuleContext;
@@ -120,7 +117,6 @@ import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToPrefixToModule
 import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToPrefixToModuleName;
 import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.source.ImportPrefixToModuleCtx;
-import org.opendaylight.yangtools.yang.parser.spi.source.ImportPrefixToSemVerSourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.source.ImportedModuleContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.IncludedModuleContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameToModuleCtx;
@@ -285,7 +281,7 @@ public final class RFC7950Reactors {
 
     public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder(
             final YangParserConfiguration config) {
-        return addExtensions(vanillaReactorBuilder(config), config);
+        return vanillaReactorBuilder(config);
     }
 
     public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder(
@@ -295,18 +291,7 @@ public final class RFC7950Reactors {
 
     public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder(
             final YangXPathParserFactory xpathFactory, final YangParserConfiguration config) {
-        return addExtensions(vanillaReactorBuilder(xpathFactory, config), config);
-    }
-
-    private static @NonNull CustomCrossSourceStatementReactorBuilder addExtensions(
-            final @NonNull CustomCrossSourceStatementReactorBuilder builder, final YangParserConfiguration config) {
-        return builder
-                // Semantic version support
-                .addStatementSupport(ModelProcessingPhase.SOURCE_LINKAGE, new OpenConfigVersionSupport(config))
-                .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE, SemanticVersionNamespace.BEHAVIOUR)
-                .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE, SemanticVersionModuleNamespace.BEHAVIOUR)
-                .addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE,
-                    ImportPrefixToSemVerSourceIdentifier.BEHAVIOUR);
+        return vanillaReactorBuilder(xpathFactory, config);
     }
 
     /**
@@ -375,19 +360,16 @@ public final class RFC7950Reactors {
 
     private static @NonNull StatementSupportBundle fullDeclarationBundle(final StatementSupportBundle stmtDefBundle,
             final XPathSupport xpathSupport, final YangParserConfiguration config) {
-        final CaseStatementSupport rfc6020case = CaseStatementSupport.rfc6020Instance(config);
-        final CaseStatementSupport rfc7950case = CaseStatementSupport.rfc7950Instance(config);
-
         return StatementSupportBundle.derivedFrom(stmtDefBundle)
             .addSupport(new LeafStatementSupport(config))
             .addSupport(new ConfigStatementSupport(config))
             .addSupport(new DeviationStatementSupport(config))
             .addVersionSpecificSupport(VERSION_1, new DeviateStatementRFC6020Support(config))
             .addVersionSpecificSupport(VERSION_1_1, new DeviateStatementRFC7950Support(config))
-            .addVersionSpecificSupport(VERSION_1, ChoiceStatementSupport.rfc6020Instance(config, rfc6020case))
-            .addVersionSpecificSupport(VERSION_1_1, ChoiceStatementSupport.rfc7950Instance(config, rfc7950case))
-            .addVersionSpecificSupport(VERSION_1, rfc6020case)
-            .addVersionSpecificSupport(VERSION_1_1, rfc7950case)
+            .addVersionSpecificSupport(VERSION_1, ChoiceStatementSupport.rfc6020Instance(config))
+            .addVersionSpecificSupport(VERSION_1_1, ChoiceStatementSupport.rfc7950Instance(config))
+            .addVersionSpecificSupport(VERSION_1, CaseStatementSupport.rfc6020Instance(config))
+            .addVersionSpecificSupport(VERSION_1_1, CaseStatementSupport.rfc7950Instance(config))
             .addSupport(new MustStatementSupport(xpathSupport, config))
             .addSupport(new MandatoryStatementSupport(config))
             .addSupport(new AnyxmlStatementSupport(config))