YANGTOOLS-706: split out rfc8040-model-api
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / YangInferencePipeline.java
index aeeb70b316a2585968617185636fbfeca345d938..a45090486beac98f856bd2dc4a0bee5201389720 100644 (file)
@@ -31,24 +31,22 @@ import org.opendaylight.yangtools.yang.parser.spi.TypeNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.DerivedIdentitiesNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
 import org.opendaylight.yangtools.yang.parser.spi.meta.QNameCacheNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.OpenconfigVersionModuleNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.OpenconfigVersionNamespace;
+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.AnyxmlSchemaLocationNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.source.AugmentToChoiceNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToModuleContext;
-import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToPrefixToModuleIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToPrefixToModuleCtx;
 import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToPrefixToModuleName;
-import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToModuleIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.source.ImpPrefixToOpenconfigVerModuleIdentifier;
+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.IncludedSubmoduleNameToIdentifier;
-import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleIdentifier;
+import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameToModuleCtx;
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
-import org.opendaylight.yangtools.yang.parser.spi.source.ModuleIdentifierToModuleQName;
+import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToSourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNamespaceForBelongsTo;
@@ -60,6 +58,9 @@ import org.opendaylight.yangtools.yang.parser.spi.source.StmtOrderingNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.source.SupportedFeaturesNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace.ValidationBundleType;
+import org.opendaylight.yangtools.yang.parser.stmt.anyxmlschema.AnyxmlSchemaLocationNamespace;
+import org.opendaylight.yangtools.yang.parser.stmt.anyxmlschema.AnyxmlSchemaLocationSupport;
+import org.opendaylight.yangtools.yang.parser.stmt.openconfig.OpenconfigVersionSupport;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.ActionStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.AnydataStatementImpl;
@@ -86,6 +87,7 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.RefineStatementRfc795
 import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.RpcStatementRfc7950Support;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.SubmoduleStatementRfc7950Support;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc7950.TypeStatementRfc7950Support;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc8040.YangDataStatementSupport;
 
 public final class YangInferencePipeline {
     public static final Set<YangVersion> SUPPORTED_VERSIONS = Sets.immutableEnumSet(VERSION_1, VERSION_1_1);
@@ -107,6 +109,7 @@ public final class YangInferencePipeline {
             .addVersionSpecificSupport(VERSION_1_1, new ImportStatementRfc7950Support())
             .addVersionSpecificSupport(VERSION_1, new IncludeStatementImpl.Definition())
             .addVersionSpecificSupport(VERSION_1_1, new IncludeStatementRfc7950Support())
+            .addSupport(new BelongsToStatementImpl.Definition())
             .addSupport(new PrefixStatementImpl.Definition())
             .addSupport(new YangVersionStatementImpl.Definition())
             .addSupport(new RevisionStatementImpl.Definition())
@@ -123,30 +126,28 @@ public final class YangInferencePipeline {
             .addSupport(new ReferenceStatementImpl.Definition())
             .addSupport(new ContactStatementImpl.Definition())
             .addSupport(new OrganizationStatementImpl.Definition())
-            .addSupport(new BelongsToStatementImpl.Definition())
             .addSupport(global(ModuleNamespace.class))
             .addSupport(global(ModuleNamespaceForBelongsTo.class))
             .addSupport(global(SubmoduleNamespace.class))
             .addSupport(global(NamespaceToModule.class))
             .addSupport(global(ModuleNameToModuleQName.class))
-            .addSupport(global(ModuleCtxToModuleIdentifier.class))
+            .addSupport(global(ModuleCtxToSourceIdentifier.class))
             .addSupport(global(ModuleQNameToModuleName.class))
             .addSupport(global(PrefixToModule.class))
-            .addSupport(global(ModuleIdentifierToModuleQName.class))
             .addSupport(QNameCacheNamespace.getInstance())
             .addSupport(sourceLocal(ImportedModuleContext.class))
             .addSupport(sourceLocal(IncludedModuleContext.class))
-            .addSupport(sourceLocal(IncludedSubmoduleNameToIdentifier.class))
-            .addSupport(sourceLocal(ImpPrefixToModuleIdentifier.class))
-            .addSupport(sourceLocal(BelongsToPrefixToModuleIdentifier.class))
+            .addSupport(sourceLocal(IncludedSubmoduleNameToModuleCtx.class))
+            .addSupport(sourceLocal(ImportPrefixToModuleCtx.class))
+            .addSupport(sourceLocal(BelongsToPrefixToModuleCtx.class))
             .addSupport(sourceLocal(URIStringToImpPrefix.class))
             .addSupport(sourceLocal(BelongsToModuleContext.class))
             .addSupport(sourceLocal(QNameToStatementDefinition.class))
             .addSupport(sourceLocal(BelongsToPrefixToModuleName.class))
-            .addSupport(new OpenconfigVersionStatementImpl.OpenconfigVersionSupport())
-            .addSupport(global(OpenconfigVersionNamespace.class))
-            .addSupport(global(OpenconfigVersionModuleNamespace.class))
-            .addSupport(sourceLocal(ImpPrefixToOpenconfigVerModuleIdentifier.class))
+            .addSupport(OpenconfigVersionSupport.getInstance())
+            .addSupport(global(SemanticVersionNamespace.class))
+            .addSupport(global(SemanticVersionModuleNamespace.class))
+            .addSupport(sourceLocal(ImportPrefixToSemVerSourceIdentifier.class))
             .build();
 
     public static final StatementSupportBundle STMT_DEF_BUNDLE = StatementSupportBundle
@@ -236,13 +237,14 @@ public final class YangInferencePipeline {
             .addSupport(new FeatureStatementImpl.Definition())
             .addSupport(new PositionStatementImpl.Definition())
             .addSupport(new ValueStatementImpl.Definition())
-            .addSupport(new AnyxmlSchemaLocationStatementImpl.AnyxmlSchemaLocationSupport())
+            .addSupport(AnyxmlSchemaLocationSupport.getInstance())
             .addSupport(treeScoped(AnyxmlSchemaLocationNamespace.class))
+            .addSupport(YangDataStatementSupport.getInstance())
             .addSupport(global(StmtOrderingNamespace.class))
             .build();
 
-    public static final Map<ModelProcessingPhase, StatementSupportBundle> RFC6020_BUNDLES = ImmutableMap
-            .<ModelProcessingPhase, StatementSupportBundle> builder()
+    public static final Map<ModelProcessingPhase, StatementSupportBundle> RFC6020_BUNDLES =
+            ImmutableMap.<ModelProcessingPhase, StatementSupportBundle>builder()
             .put(ModelProcessingPhase.INIT, INIT_BUNDLE)
             .put(ModelProcessingPhase.SOURCE_PRE_LINKAGE, PRE_LINKAGE_BUNDLE)
             .put(ModelProcessingPhase.SOURCE_LINKAGE, LINKAGE_BUNDLE)
@@ -251,25 +253,23 @@ public final class YangInferencePipeline {
             .put(ModelProcessingPhase.EFFECTIVE_MODEL, FULL_DECL_BUNDLE)
             .build();
 
-    public static final Map<ValidationBundleType, Collection<StatementDefinition>> RFC6020_VALIDATION_BUNDLE = ImmutableMap
-            .<ValidationBundleType, Collection<StatementDefinition>> builder()
-            .put(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS, YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
+    public static final Map<ValidationBundleType, Collection<StatementDefinition>> RFC6020_VALIDATION_BUNDLE =
+            ImmutableMap.<ValidationBundleType, Collection<StatementDefinition>>builder()
+            .put(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
+                YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
             .put(ValidationBundleType.SUPPORTED_AUGMENT_TARGETS, YangValidationBundles.SUPPORTED_AUGMENT_TARGETS)
             .put(ValidationBundleType.SUPPORTED_CASE_SHORTHANDS, YangValidationBundles.SUPPORTED_CASE_SHORTHANDS)
             .put(ValidationBundleType.SUPPORTED_DATA_NODES, YangValidationBundles.SUPPORTED_DATA_NODES)
             .build();
 
-    public static final CrossSourceStatementReactor RFC6020_REACTOR = CrossSourceStatementReactor
-            .builder()
+    public static final CrossSourceStatementReactor RFC6020_REACTOR = CrossSourceStatementReactor.builder()
             .setBundle(ModelProcessingPhase.INIT, INIT_BUNDLE)
             .setBundle(ModelProcessingPhase.SOURCE_PRE_LINKAGE, PRE_LINKAGE_BUNDLE)
             .setBundle(ModelProcessingPhase.SOURCE_LINKAGE, LINKAGE_BUNDLE)
-            .setBundle(ModelProcessingPhase.STATEMENT_DEFINITION,
-                    STMT_DEF_BUNDLE)
+            .setBundle(ModelProcessingPhase.STATEMENT_DEFINITION, STMT_DEF_BUNDLE)
             .setBundle(ModelProcessingPhase.FULL_DECLARATION, FULL_DECL_BUNDLE)
             .setBundle(ModelProcessingPhase.EFFECTIVE_MODEL, FULL_DECL_BUNDLE)
-            .setValidationBundle(
-                    ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
+            .setValidationBundle(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
                     YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
             .setValidationBundle(ValidationBundleType.SUPPORTED_AUGMENT_TARGETS,
                     YangValidationBundles.SUPPORTED_AUGMENT_TARGETS)