import static org.opendaylight.yangtools.yang.common.YangVersion.VERSION_1_1;
import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.common.YangVersion;
-import org.opendaylight.yangtools.yang.model.api.meta.StatementDefinition;
import org.opendaylight.yangtools.yang.parser.openconfig.stmt.OpenConfigVersionSupport;
-import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.ChildSchemaNodeNamespace;
-import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.SchemaNodeIdentifierBuildNamespace;
+import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.ModuleQNameToPrefix;
import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.URIStringToImportPrefix;
+import org.opendaylight.yangtools.yang.parser.rfc7950.namespace.YangNamespaceContextNamespace;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.XPathSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.action.ActionStatementSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.anydata.AnydataStatementSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.anyxml.AnyxmlStatementSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.argument.ArgumentStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.augment.AugmentImplicitHandlingNamespace;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.augment.AugmentStatementRFC6020Support;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.augment.AugmentStatementRFC7950Support;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.base.BaseStatementSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.leaf_list.LeafListStatementRFC6020Support;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.leaf_list.LeafListStatementRFC7950Support;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.length.LengthStatementSupport;
+import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.list.ConfigListWarningNamespace;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.list.ListStatementRFC6020Support;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.list.ListStatementRFC7950Support;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.mandatory.MandatoryStatementSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yang_version.YangVersionStatementSupport;
import org.opendaylight.yangtools.yang.parser.rfc7950.stmt.yin_element.YinElementStatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.ExtensionNamespace;
+import org.opendaylight.yangtools.yang.parser.spi.FeatureNamespace;
import org.opendaylight.yangtools.yang.parser.spi.GroupingNamespace;
import org.opendaylight.yangtools.yang.parser.spi.IdentityNamespace;
import org.opendaylight.yangtools.yang.parser.spi.ModuleNamespace;
import org.opendaylight.yangtools.yang.parser.spi.NamespaceToModule;
import org.opendaylight.yangtools.yang.parser.spi.PreLinkageModuleNamespace;
+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.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.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.AugmentToChoiceNamespace;
import org.opendaylight.yangtools.yang.parser.spi.source.BelongsToModuleContext;
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.ModulesDeviatedByModules;
import org.opendaylight.yangtools.yang.parser.spi.source.PrefixToModule;
import org.opendaylight.yangtools.yang.parser.spi.source.QNameToStatementDefinition;
-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.reactor.CrossSourceStatementReactor;
+import org.opendaylight.yangtools.yang.xpath.api.YangXPathParserFactory;
/**
* Utility class holding entrypoints for assembling RFC6020/RFC7950 statement {@link CrossSourceStatementReactor}s.
*/
@Beta
public final class RFC7950Reactors {
- private static final Set<YangVersion> SUPPORTED_VERSIONS = Sets.immutableEnumSet(VERSION_1, VERSION_1_1);
+ private static final ImmutableSet<YangVersion> SUPPORTED_VERSIONS = Sets.immutableEnumSet(VERSION_1, VERSION_1_1);
private static final StatementSupportBundle INIT_BUNDLE = StatementSupportBundle.builder(SUPPORTED_VERSIONS)
.addSupport(ValidationBundlesNamespace.BEHAVIOUR)
.build();
private static final StatementSupportBundle PRE_LINKAGE_BUNDLE = StatementSupportBundle.derivedFrom(INIT_BUNDLE)
- .addVersionSpecificSupport(VERSION_1, new ModuleStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new ModuleStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new SubmoduleStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new SubmoduleStatementRFC7950Support())
- .addSupport(new NamespaceStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new ImportStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new ImportStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new IncludeStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new IncludeStatementRFC7950Support())
- .addSupport(new BelongsToStatementSupport())
- .addSupport(new PrefixStatementSupport())
- .addSupport(new YangVersionStatementSupport())
- .addSupport(new RevisionStatementSupport())
- .addSupport(new RevisionDateStatementSupport())
+ .addVersionSpecificSupport(VERSION_1, ModuleStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, ModuleStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, SubmoduleStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, SubmoduleStatementRFC7950Support.getInstance())
+ .addSupport(NamespaceStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, ImportStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, ImportStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, IncludeStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, IncludeStatementRFC7950Support.getInstance())
+ .addSupport(BelongsToStatementSupport.getInstance())
+ .addSupport(PrefixStatementSupport.getInstance())
+ .addSupport(YangVersionStatementSupport.getInstance())
+ .addSupport(RevisionStatementSupport.getInstance())
+ .addSupport(RevisionDateStatementSupport.getInstance())
.addSupport(ModuleNameToNamespace.BEHAVIOUR)
.addSupport(PreLinkageModuleNamespace.BEHAVIOUR)
.addSupport(ImpPrefixToNamespace.BEHAVIOUR)
private static final StatementSupportBundle LINKAGE_BUNDLE = StatementSupportBundle
.derivedFrom(PRE_LINKAGE_BUNDLE)
- .addSupport(new DescriptionStatementSupport())
- .addSupport(new ReferenceStatementSupport())
- .addSupport(new ContactStatementSupport())
- .addSupport(new OrganizationStatementSupport())
+ .addSupport(DescriptionStatementSupport.getInstance())
+ .addSupport(ReferenceStatementSupport.getInstance())
+ .addSupport(ContactStatementSupport.getInstance())
+ .addSupport(OrganizationStatementSupport.getInstance())
.addSupport(ModuleNamespace.BEHAVIOUR)
.addSupport(ModuleNamespaceForBelongsTo.BEHAVIOUR)
.addSupport(SubmoduleNamespace.BEHAVIOUR)
.addSupport(ModuleCtxToSourceIdentifier.BEHAVIOUR)
.addSupport(ModuleQNameToModuleName.BEHAVIOUR)
.addSupport(PrefixToModule.BEHAVIOUR)
- .addSupport(QNameCacheNamespace.getInstance())
.addSupport(ImportedModuleContext.BEHAVIOUR)
.addSupport(IncludedModuleContext.BEHAVIOUR)
.addSupport(IncludedSubmoduleNameToModuleCtx.BEHAVIOUR)
.addSupport(ImportPrefixToModuleCtx.BEHAVIOUR)
.addSupport(BelongsToPrefixToModuleCtx.BEHAVIOUR)
+ .addSupport(ModuleQNameToPrefix.BEHAVIOUR)
.addSupport(URIStringToImportPrefix.BEHAVIOUR)
.addSupport(BelongsToModuleContext.BEHAVIOUR)
.addSupport(QNameToStatementDefinition.BEHAVIOUR)
private static final StatementSupportBundle STMT_DEF_BUNDLE = StatementSupportBundle
.derivedFrom(LINKAGE_BUNDLE)
- .addSupport(new YinElementStatementSupport())
- .addSupport(new ArgumentStatementSupport())
- .addSupport(new ExtensionStatementSupport())
- .addSupport(new ChildSchemaNodeNamespace<>())
- .addSupport(new SchemaNodeIdentifierBuildNamespace())
+ .addSupport(YinElementStatementSupport.getInstance())
+ .addSupport(ArgumentStatementSupport.getInstance())
+ .addSupport(ExtensionStatementSupport.getInstance())
+ .addSupport(SchemaTreeNamespace.getInstance())
.addSupport(ExtensionNamespace.BEHAVIOUR)
- .addSupport(new TypedefStatementSupport())
+ .addSupport(TypedefStatementSupport.getInstance())
.addSupport(TypeNamespace.BEHAVIOUR)
- .addVersionSpecificSupport(VERSION_1, new IdentityStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new IdentityStatementRFC7950Support())
+ .addVersionSpecificSupport(VERSION_1, IdentityStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, IdentityStatementRFC7950Support.getInstance())
.addSupport(IdentityNamespace.BEHAVIOUR)
- .addSupport(new DefaultStatementSupport())
- .addSupport(new StatusStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new TypeStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new TypeStatementRFC7950Support())
- .addSupport(new UnitsStatementSupport())
- .addSupport(new RequireInstanceStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new BitStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new BitStatementRFC7950Support())
- .addSupport(new PathStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new EnumStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new EnumStatementRFC7950Support())
- .addSupport(new LengthStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new PatternStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new PatternStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1_1, new ModifierStatementSupport())
- .addSupport(new RangeStatementSupport())
- .addSupport(new KeyStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new ContainerStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new ContainerStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new GroupingStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new GroupingStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new ListStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new ListStatementRFC7950Support())
- .addSupport(new UniqueStatementSupport())
- .addVersionSpecificSupport(VERSION_1_1, new ActionStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new RpcStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new RpcStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new InputStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new InputStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new OutputStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new OutputStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new NotificationStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new NotificationStatementRFC7950Support())
- .addSupport(new FractionDigitsStatementSupport())
- .addSupport(new BaseStatementSupport())
- .addSupport(DerivedIdentitiesNamespace.BEHAVIOUR)
+ .addSupport(DefaultStatementSupport.getInstance())
+ .addSupport(StatusStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, TypeStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, TypeStatementRFC7950Support.getInstance())
+ .addSupport(UnitsStatementSupport.getInstance())
+ .addSupport(RequireInstanceStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, BitStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, BitStatementRFC7950Support.getInstance())
+ .addSupport(PathStatementSupport.strictInstance())
+ .addVersionSpecificSupport(VERSION_1, EnumStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, EnumStatementRFC7950Support.getInstance())
+ .addSupport(LengthStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, PatternStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, PatternStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, ModifierStatementSupport.getInstance())
+ .addSupport(RangeStatementSupport.getInstance())
+ .addSupport(KeyStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, ContainerStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, ContainerStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, GroupingStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, GroupingStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, ListStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, ListStatementRFC7950Support.getInstance())
+ .addSupport(ConfigListWarningNamespace.BEHAVIOUR)
+ .addSupport(UniqueStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, ActionStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, RpcStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, RpcStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, InputStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, InputStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, OutputStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, OutputStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, NotificationStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, NotificationStatementRFC7950Support.getInstance())
+ .addSupport(FractionDigitsStatementSupport.getInstance())
+ .addSupport(BaseStatementSupport.getInstance())
.addSupport(StatementDefinitionNamespace.BEHAVIOUR)
.build();
- private static final StatementSupportBundle FULL_DECL_BUNDLE = StatementSupportBundle
- .derivedFrom(STMT_DEF_BUNDLE)
- .addSupport(new LeafStatementSupport())
- .addSupport(new ConfigStatementSupport())
- .addSupport(new DeviationStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new DeviateStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new DeviateStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new ChoiceStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new ChoiceStatementRFC7950Support())
- .addVersionSpecificSupport(VERSION_1, new CaseStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new CaseStatementRFC7950Support())
- .addSupport(new MustStatementSupport())
- .addSupport(new MandatoryStatementSupport())
- .addSupport(new AnyxmlStatementSupport())
- .addVersionSpecificSupport(VERSION_1_1, new AnydataStatementSupport())
- .addSupport(new IfFeatureStatementSupport())
- .addSupport(new UsesStatementSupport())
- .addSupport(GroupingNamespace.BEHAVIOUR)
- .addSupport(new ErrorMessageStatementSupport())
- .addSupport(new ErrorAppTagStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new LeafListStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new LeafListStatementRFC7950Support())
- .addSupport(new PresenceStatementSupport())
- .addSupport(new MaxElementsStatementSupport())
- .addSupport(new MinElementsStatementSupport())
- .addSupport(new OrderedByStatementSupport())
- .addSupport(new WhenStatementSupport())
- .addVersionSpecificSupport(VERSION_1, new AugmentStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new AugmentStatementRFC7950Support())
- .addSupport(AugmentToChoiceNamespace.BEHAVIOUR)
- .addVersionSpecificSupport(VERSION_1, new RefineStatementRFC6020Support())
- .addVersionSpecificSupport(VERSION_1_1, new RefineStatementRFC7950Support())
- .addSupport(new FeatureStatementSupport())
- .addSupport(new PositionStatementSupport())
- .addSupport(new ValueStatementSupport())
- .addSupport(StmtOrderingNamespace.BEHAVIOUR)
- .build();
-
- private static final Map<ModelProcessingPhase, StatementSupportBundle> RFC7950_BUNDLES =
- ImmutableMap.<ModelProcessingPhase, StatementSupportBundle>builder()
- .put(ModelProcessingPhase.INIT, INIT_BUNDLE)
- .put(ModelProcessingPhase.SOURCE_PRE_LINKAGE, PRE_LINKAGE_BUNDLE)
- .put(ModelProcessingPhase.SOURCE_LINKAGE, LINKAGE_BUNDLE)
- .put(ModelProcessingPhase.STATEMENT_DEFINITION, STMT_DEF_BUNDLE)
- .put(ModelProcessingPhase.FULL_DECLARATION, FULL_DECL_BUNDLE)
- .put(ModelProcessingPhase.EFFECTIVE_MODEL, FULL_DECL_BUNDLE)
- .build();
-
- private 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();
-
- private static final CrossSourceStatementReactor DEFAULT_RFC6020_RFC7950_REACTOR = defaultReactorBuilder().build();
- private static final CrossSourceStatementReactor VANILLA_RFC6020_RFC7950_REACTOR = vanillaReactorBuilder().build();
private RFC7950Reactors() {
- throw new UnsupportedOperationException();
+ // Hidden on purpose
}
/**
*
* @return A shared reactor instance.
*/
- public static CrossSourceStatementReactor defaultReactor() {
- return DEFAULT_RFC6020_RFC7950_REACTOR;
+ public static @NonNull CrossSourceStatementReactor defaultReactor() {
+ return ServiceLoaderState.DefaultReactor.INSTANCE;
}
/**
*
* @return A new {@link CustomCrossSourceStatementReactorBuilder}.
*/
- public static CustomCrossSourceStatementReactorBuilder defaultReactorBuilder() {
- return vanillaReactorBuilder()
+ public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder() {
+ return addExtensions(vanillaReactorBuilder());
+ }
+
+ public static @NonNull CustomCrossSourceStatementReactorBuilder defaultReactorBuilder(
+ final YangXPathParserFactory xpathFactory) {
+ return addExtensions(vanillaReactorBuilder(xpathFactory));
+ }
+
+ private static @NonNull CustomCrossSourceStatementReactorBuilder addExtensions(
+ final @NonNull CustomCrossSourceStatementReactorBuilder builder) {
+ return builder
// Semantic version support
.addStatementSupport(ModelProcessingPhase.SOURCE_LINKAGE, OpenConfigVersionSupport.getInstance())
.addNamespaceSupport(ModelProcessingPhase.SOURCE_LINKAGE, SemanticVersionNamespace.BEHAVIOUR)
*
* @return A shared reactor instance.
*/
- public static CrossSourceStatementReactor vanillaReactor() {
- return VANILLA_RFC6020_RFC7950_REACTOR;
+ public static @NonNull CrossSourceStatementReactor vanillaReactor() {
+ return ServiceLoaderState.VanillaReactor.INSTANCE;
}
/**
*
* @return A new {@link CustomCrossSourceStatementReactorBuilder}.
*/
- public static CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder() {
- return addDefaultRFC7950Bundles(new CustomCrossSourceStatementReactorBuilder(SUPPORTED_VERSIONS));
+ public static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder() {
+ return vanillaReactorBuilder(ServiceLoaderState.XPath.INSTANCE);
+ }
+
+ public static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder(
+ final @NonNull YangXPathParserFactory xpathFactory) {
+ return vanillaReactorBuilder(new XPathSupport(xpathFactory));
+ }
+
+ private static @NonNull CustomCrossSourceStatementReactorBuilder vanillaReactorBuilder(
+ final @NonNull XPathSupport xpathSupport) {
+ final StatementSupportBundle fullDeclarationBundle = fullDeclarationBundle(xpathSupport);
+ return new CustomCrossSourceStatementReactorBuilder(SUPPORTED_VERSIONS)
+ .addAllSupports(ModelProcessingPhase.INIT, INIT_BUNDLE)
+ .addAllSupports(ModelProcessingPhase.SOURCE_PRE_LINKAGE, PRE_LINKAGE_BUNDLE)
+ .addAllSupports(ModelProcessingPhase.SOURCE_LINKAGE, LINKAGE_BUNDLE)
+ .addAllSupports(ModelProcessingPhase.STATEMENT_DEFINITION, STMT_DEF_BUNDLE)
+ .addAllSupports(ModelProcessingPhase.FULL_DECLARATION, fullDeclarationBundle)
+ .addAllSupports(ModelProcessingPhase.EFFECTIVE_MODEL, fullDeclarationBundle)
+ .addValidationBundle(ValidationBundleType.SUPPORTED_REFINE_SUBSTATEMENTS,
+ YangValidationBundles.SUPPORTED_REFINE_SUBSTATEMENTS)
+ .addValidationBundle(ValidationBundleType.SUPPORTED_AUGMENT_TARGETS,
+ YangValidationBundles.SUPPORTED_AUGMENT_TARGETS)
+
+ // FIXME: 7.0.0: we do not seem to need this validation bundle
+ .addValidationBundle(ValidationBundleType.SUPPORTED_CASE_SHORTHANDS,
+ YangValidationBundles.SUPPORTED_CASE_SHORTHANDS)
+
+ .addValidationBundle(ValidationBundleType.SUPPORTED_DATA_NODES,
+ YangValidationBundles.SUPPORTED_DATA_NODES);
}
- private static CustomCrossSourceStatementReactorBuilder addDefaultRFC7950Bundles(
- final CustomCrossSourceStatementReactorBuilder builder) {
- RFC7950_BUNDLES.entrySet().forEach(entry -> builder.addAllSupports(entry.getKey(), entry.getValue()));
- RFC6020_VALIDATION_BUNDLE.entrySet().forEach(
- entry -> builder.addValidationBundle(entry.getKey(), entry.getValue()));
- return builder;
+ private static @NonNull StatementSupportBundle fullDeclarationBundle(final XPathSupport xpathSupport) {
+ return StatementSupportBundle
+ .derivedFrom(STMT_DEF_BUNDLE)
+ .addSupport(LeafStatementSupport.getInstance())
+ .addSupport(ConfigStatementSupport.getInstance())
+ .addSupport(DeviationStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, DeviateStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, DeviateStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, ChoiceStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, ChoiceStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, CaseStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, CaseStatementRFC7950Support.getInstance())
+ .addSupport(MustStatementSupport.createInstance(xpathSupport))
+ .addSupport(MandatoryStatementSupport.getInstance())
+ .addSupport(AnyxmlStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, AnydataStatementSupport.getInstance())
+ .addSupport(FeatureNamespace.BEHAVIOUR)
+ .addSupport(IfFeatureStatementSupport.getInstance())
+ .addSupport(UsesStatementSupport.getInstance())
+ .addSupport(GroupingNamespace.BEHAVIOUR)
+ .addSupport(ErrorMessageStatementSupport.getInstance())
+ .addSupport(ErrorAppTagStatementSupport.getInstance())
+ .addVersionSpecificSupport(VERSION_1, LeafListStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, LeafListStatementRFC7950Support.getInstance())
+ .addSupport(PresenceStatementSupport.getInstance())
+ .addSupport(MaxElementsStatementSupport.getInstance())
+ .addSupport(MinElementsStatementSupport.getInstance())
+ .addSupport(OrderedByStatementSupport.getInstance())
+ .addSupport(WhenStatementSupport.createInstance(xpathSupport))
+ .addSupport(AugmentImplicitHandlingNamespace.BEHAVIOUR)
+ .addVersionSpecificSupport(VERSION_1, AugmentStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, AugmentStatementRFC7950Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1, RefineStatementRFC6020Support.getInstance())
+ .addVersionSpecificSupport(VERSION_1_1, RefineStatementRFC7950Support.getInstance())
+ .addSupport(FeatureStatementSupport.getInstance())
+ .addSupport(PositionStatementSupport.getInstance())
+ .addSupport(ValueStatementSupport.getInstance())
+ .addSupport(YangNamespaceContextNamespace.BEHAVIOUR)
+ .build();
}
}