/** * Returns an AugmentationSchemaNode as effective in a parent node. * * @param schema Augmentation schema * @param parent Parent schema * @return Adjusted Augmentation schema * @throws NullPointerException if any of the arguments is null * @deprecated Use {@link EffectiveAugmentationSchema#create(AugmentationSchemaNode, DataNodeContainer)} instead. */ @Deprecated public static AugmentationSchemaNode augmentationProxy(final AugmentationSchemaNode schema, final DataNodeContainer parent) { return EffectiveAugmentationSchema.create(schema, parent); }
private static DataNodeContainer augmentationProxy(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { final Set<DataSchemaNode> children = new HashSet<>(); for (final DataSchemaNode augNode : augmentation.getChildNodes()) { children.add(schema.getDataChildByName(augNode.getQName())); } return new EffectiveAugmentationSchema(augmentation, children); }
/** * Returns an AugmentationSchemaNode as effective in a parent node. * * @param schema Augmentation schema * @param parent Parent schema * @return Adjusted Augmentation schema * @throws NullPointerException if any of the arguments is null */ public static AugmentationSchemaNode create(final AugmentationSchemaNode schema, final DataNodeContainer parent) { Set<DataSchemaNode> children = new HashSet<>(); for (DataSchemaNode augNode : schema.getChildNodes()) { children.add(parent.getDataChildByName(augNode.getQName())); } return new EffectiveAugmentationSchema(schema, children); }
/** * Returns an AugmentationSchemaNode as effective in a parent node. * * @param schema Augmentation schema * @param parent Parent schema * @return Adjusted Augmentation schema * @throws NullPointerException if any of the arguments is null */ public static AugmentationSchemaNode create(final AugmentationSchemaNode schema, final DataNodeContainer parent) { Set<DataSchemaNode> children = new HashSet<>(); for (DataSchemaNode augNode : schema.getChildNodes()) { children.add(parent.getDataChildByName(augNode.getQName())); } return new EffectiveAugmentationSchema(schema, children); }
/** * Returns an AugmentationSchemaNode as effective in a parent node. * * @param schema Augmentation schema * @param parent Parent schema * @return Adjusted Augmentation schema * @throws NullPointerException if any of the arguments is null * @deprecated Use {@link EffectiveAugmentationSchema#create(AugmentationSchemaNode, DataNodeContainer)} instead. */ @Deprecated public static AugmentationSchemaNode augmentationProxy(final AugmentationSchemaNode schema, final DataNodeContainer parent) { return EffectiveAugmentationSchema.create(schema, parent); }
public Entry<AugmentationIdentifier, AugmentationSchema> getResolvedAugmentationSchema(final DataNodeContainer target, final Class<? extends Augmentation<?>> aug) { final AugmentationSchema origSchema = getAugmentationDefinition(aug); Preconditions.checkArgument(origSchema != null, "Augmentation %s is not known in current schema context",aug); /* * FIXME: Validate augmentation schema lookup * * Currently this algorithm, does not verify if instantiated child nodes * are real one derived from augmentation schema. The problem with * full validation is, if user used copy builders, he may use * augmentation which was generated for different place. * * If this augmentations have same definition, we emit same identifier * with data and it is up to underlying user to validate data. * */ final Set<QName> childNames = new HashSet<>(); final Set<DataSchemaNode> realChilds = new HashSet<>(); for (final DataSchemaNode child : origSchema.getChildNodes()) { realChilds.add(target.getDataChildByName(child.getQName())); childNames.add(child.getQName()); } final AugmentationIdentifier identifier = new AugmentationIdentifier(childNames); final AugmentationSchema proxy = new EffectiveAugmentationSchema(origSchema, realChilds); return new AbstractMap.SimpleEntry<>(identifier, proxy); }
AugmentationNormalization(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { super(DataSchemaContextNode.augmentationIdentifierFrom(augmentation), EffectiveAugmentationSchema.create(augmentation, schema)); }
final AugmentationSchemaNode proxy = new EffectiveAugmentationSchema(origSchemas.stream().findFirst().get(), realChilds); return new SimpleEntry<>(identifier, proxy);
AugmentationNormalization(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { super(DataSchemaContextNode.augmentationIdentifierFrom(augmentation), EffectiveAugmentationSchema.create(augmentation, schema)); }
final AugmentationSchemaNode proxy = new EffectiveAugmentationSchema(origSchema, realChilds); return new SimpleEntry<>(identifier, proxy);
AugmentationContextNode(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { super(augmentationIdentifierFrom(augmentation), EffectiveAugmentationSchema.create(augmentation, schema), null); }
AugmentationContextNode(final AugmentationSchemaNode augmentation, final DataNodeContainer schema) { super(augmentationIdentifierFrom(augmentation), EffectiveAugmentationSchema.create(augmentation, schema), null); }
public AugmentationSchemaNode startAugmentationNode(final AugmentationIdentifier identifier) { LOG.debug("Enter augmentation {}", identifier); Object parent = getParent(); checkArgument(parent instanceof AugmentationTarget, "Augmentation not allowed under %s", parent); if (parent instanceof ChoiceSchemaNode) { final QName name = Iterables.get(identifier.getPossibleChildNames(), 0); parent = findCaseByChild((ChoiceSchemaNode) parent, name); } checkArgument(parent instanceof DataNodeContainer, "Augmentation allowed only in DataNodeContainer", parent); final AugmentationSchemaNode schema = SchemaUtils.findSchemaForAugment((AugmentationTarget) parent, identifier.getPossibleChildNames()); final AugmentationSchemaNode resolvedSchema = EffectiveAugmentationSchema.create(schema, (DataNodeContainer) parent); schemaStack.push(resolvedSchema); return resolvedSchema; }
public AugmentationSchemaNode startAugmentationNode(final AugmentationIdentifier identifier) { LOG.debug("Enter augmentation {}", identifier); Object parent = getParent(); checkArgument(parent instanceof AugmentationTarget, "Augmentation not allowed under %s", parent); if (parent instanceof ChoiceSchemaNode) { final QName name = Iterables.get(identifier.getPossibleChildNames(), 0); parent = findCaseByChild((ChoiceSchemaNode) parent, name); } checkArgument(parent instanceof DataNodeContainer, "Augmentation allowed only in DataNodeContainer", parent); final AugmentationSchemaNode schema = SchemaUtils.findSchemaForAugment((AugmentationTarget) parent, identifier.getPossibleChildNames()); final AugmentationSchemaNode resolvedSchema = EffectiveAugmentationSchema.create(schema, (DataNodeContainer) parent); schemaStack.push(resolvedSchema); return resolvedSchema; }
AugmentationModificationStrategy(final AugmentationSchemaNode schema, final DataNodeContainer resolved, final DataTreeConfiguration treeConfig) { super(EffectiveAugmentationSchema.create(schema, resolved), AugmentationNode.class, treeConfig); emptyNode = Builders.augmentationBuilder() .withNodeIdentifier(DataSchemaContextNode.augmentationIdentifierFrom(schema)) .build(); }
AugmentationModificationStrategy(final AugmentationSchemaNode schema, final DataNodeContainer resolved, final DataTreeConfiguration treeConfig) { super(EffectiveAugmentationSchema.create(schema, resolved), AugmentationNode.class, treeConfig); emptyNode = Builders.augmentationBuilder() .withNodeIdentifier(DataSchemaContextNode.augmentationIdentifierFrom(schema)) .build(); }