@Override public final void onFullDefinitionDeclared( final Mutable<String, TypeStatement, EffectiveStatement<String, TypeStatement>> stmt) { super.onFullDefinitionDeclared(stmt); // if it is yang built-in type, no prerequisite is needed, so simply return if (BUILT_IN_TYPES.containsKey(stmt.getStatementArgument())) { return; } final QName typeQName = StmtContextUtils.parseNodeIdentifier(stmt, stmt.getStatementArgument()); final ModelActionBuilder typeAction = stmt.newInferenceAction(ModelProcessingPhase.EFFECTIVE_MODEL); final Prerequisite<StmtContext<?, ?, ?>> typePrereq = typeAction.requiresCtx(stmt, TypeNamespace.class, typeQName, ModelProcessingPhase.EFFECTIVE_MODEL); typeAction.mutatesEffectiveCtx(stmt.getParentContext()); /* * If the type does not exist, throw new InferenceException. * Otherwise perform no operation. */ typeAction.apply(new InferenceAction() { @Override public void apply(final InferenceContext ctx) { // Intentional NOOP } @Override public void prerequisiteFailed(final Collection<? extends Prerequisite<?>> failed) { InferenceException.throwIf(failed.contains(typePrereq), stmt.getStatementSourceReference(), "Type [%s] was not found.", typeQName); } }); }
GroupingNamespace.class, groupingName, ModelProcessingPhase.EFFECTIVE_MODEL); final Prerequisite<? extends StmtContext.Mutable<?, ?, ?>> targetNodePre = usesAction.mutatesEffectiveCtx( usesNode.getParentContext());
return false; } while ((targetCtx = targetCtx.getParentContext()) != root);
@Override public void onStatementDefinitionDeclared( final Mutable<QName, BaseStatement, EffectiveStatement<QName, BaseStatement>> baseStmtCtx) { final Mutable<?, ?, ?> baseParentCtx = baseStmtCtx.getParentContext(); if (StmtContextUtils.producesDeclared(baseParentCtx, IdentityStatement.class)) {
@Override public void onFullDefinitionDeclared(final Mutable<QName, TypedefStatement, EffectiveStatement<QName, TypedefStatement>> stmt) { super.onFullDefinitionDeclared(stmt); if (stmt != null) { final Mutable<?, ?, ?> parent = stmt.getParentContext(); if (parent != null) { // Shadowing check: make sure we do not trample on pre-existing definitions. This catches sibling // declarations and parent declarations which have already been declared. checkConflict(parent, stmt); parent.addContext(TypeNamespace.class, stmt.coerceStatementArgument(), stmt); } } }
@Override default Mutable<?, ?, ?> coerceParentContext() { return verifyNotNull(getParentContext(), "Root context %s does not have a parent", this); }
@Override public final void onFullDefinitionDeclared(final Mutable<QName, GroupingStatement, EffectiveStatement<QName, GroupingStatement>> stmt) { super.onFullDefinitionDeclared(stmt); if (stmt != null) { final Mutable<?, ?, ?> parent = stmt.getParentContext(); if (parent != null) { // Shadowing check: make sure we do not trample on pre-existing definitions. This catches sibling // declarations and parent declarations which have already been declared. checkConflict(parent, stmt); parent.addContext(GroupingNamespace.class, stmt.coerceStatementArgument(), stmt); } } }
@Override public void onLinkageDeclared(final Mutable<SemVer, OpenConfigVersionStatement, EffectiveStatement<SemVer, OpenConfigVersionStatement>> stmt) { stmt.addToNs(SemanticVersionNamespace.class, stmt.getParentContext(), stmt.getStatementArgument()); }
@Override public void onFullDefinitionDeclared(final Mutable<String, YangDataStatement, EffectiveStatement<String, YangDataStatement>> ctx) { // as per https://tools.ietf.org/html/rfc8040#section-8, // yang-data is ignored unless it appears as a top-level statement if (ctx.coerceParentContext().getParentContext() != null) { ctx.setIsSupportedToBuildEffective(false); } }
@Override public void onFullDefinitionDeclared(final Mutable<String, YangDataStatement, EffectiveStatement<String, YangDataStatement>> ctx) { // as per https://tools.ietf.org/html/rfc8040#section-8, // yang-data is ignored unless it appears as a top-level statement if (ctx.coerceParentContext().getParentContext() != null) { ctx.setIsSupportedToBuildEffective(false); } }