/** * Construct immutable leaf node. * * @param name Identifier of leaf node * @param value Value of leaf node * @param <T> Type of leaf node value * @return Leaf node with supplied identifier and value */ public static <T> LeafNode<T> leafNode(final NodeIdentifier name, final T value) { return ImmutableLeafNodeBuilder.<T>create() .withNodeIdentifier(name) .withValue(value) .build(); }
public static DataContainerChild<?, ?> toFilterStructure(final YangInstanceIdentifier identifier, final SchemaContext ctx) { final NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, DOMSource, AnyXmlNode> anyXmlBuilder = Builders.anyXmlBuilder().withNodeIdentifier(toId(NETCONF_FILTER_QNAME)); anyXmlBuilder.withAttributes(Collections.singletonMap(NETCONF_TYPE_QNAME, SUBTREE)); final NormalizedNode<?, ?> filterContent = ImmutableNodes.fromInstanceId(ctx, identifier); final Element element = XmlUtil.createElement(BLANK_DOCUMENT, NETCONF_FILTER_QNAME.getLocalName(), Optional.of(NETCONF_FILTER_QNAME.getNamespace().toString())); element.setAttributeNS(NETCONF_FILTER_QNAME.getNamespace().toString(), NETCONF_TYPE_QNAME.getLocalName(), "subtree"); try { writeNormalizedNode(filterContent, new DOMResult(element), SchemaPath.ROOT, ctx); } catch (IOException | XMLStreamException e) { throw new IllegalStateException("Unable to serialize filter element for path " + identifier, e); } anyXmlBuilder.withValue(new DOMSource(element)); return anyXmlBuilder.build(); }
@Override NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> getBuilder(final PathArgument node) { checkArgument(node instanceof NodeWithValue); return Builders.leafSetEntryBuilder().withNodeIdentifier((NodeWithValue<?>) node) .withValue(((NodeWithValue<?>) node).getValue()); } }
public static DataContainerChild<?, ?> getSourceNode(final QName datastore) { return Builders.containerBuilder().withNodeIdentifier(toId(NETCONF_SOURCE_QNAME)) .withChild( Builders.choiceBuilder().withNodeIdentifier(toId(ConfigSource.QNAME)).withChild( Builders.leafBuilder().withNodeIdentifier(toId(datastore)).build()).build() ).build(); }
@Override NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>> getBuilder(final PathArgument node) { return Builders.leafBuilder().withNodeIdentifier(getIdentifier()); } }
fakeOperationsSchemaNodeBuilder.addChildNode(fakeRpcSchemaNode); final LeafNode<Object> leaf = Builders.leafBuilder(fakeRpcSchemaNode).build(); operationsAsData.add(leaf);
@Override final NormalizedNode<?, ?> create(final PathArgument first, final Iterator<PathArgument> others, final Optional<NormalizedNode<?, ?>> deepestChild, final Optional<Entry<QName, ModifyAction>> operation) { final NormalizedNodeAttrBuilder<? extends PathArgument, Object, ? extends NormalizedNode<? extends PathArgument, Object>> builder = getBuilder(first); if (deepestChild.isPresent()) { builder.withValue(deepestChild.get().getValue()); } addModifyOpIfPresent(operation, builder); return builder.build(); }
@Override NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> getBuilder(final PathArgument node) { checkArgument(node instanceof NodeWithValue); return Builders.leafSetEntryBuilder().withNodeIdentifier((NodeWithValue<?>) node) .withValue(((NodeWithValue<?>) node).getValue()); } }
public static DataContainerChild<?, ?> getTargetNode(final QName datastore) { return Builders.containerBuilder().withNodeIdentifier(toId(NETCONF_TARGET_QNAME)) .withChild( Builders.choiceBuilder().withNodeIdentifier(toId(ConfigTarget.QNAME)).withChild( Builders.leafBuilder().withNodeIdentifier(toId(datastore)).build()).build() ).build(); }
@Override public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) { NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>> builder = Builders.leafBuilder() .withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument())); return deSerializer.buildNormalizedNode(builder, node); } });
/** * Construct immutable leaf node. * * @param name Identifier of leaf node * @param value Value of leaf node * @param <T> Type of leaf node value * @return Leaf node with supplied identifier and value */ public static <T> LeafNode<T> leafNode(final NodeIdentifier name, final T value) { return ImmutableLeafNodeBuilder.<T>create() .withNodeIdentifier(name) .withValue(value) .build(); }
@Override final NormalizedNode<?, ?> create(final PathArgument first, final Iterator<PathArgument> others, final Optional<NormalizedNode<?, ?>> deepestChild, final Optional<Entry<QName, ModifyAction>> operation) { final NormalizedNodeAttrBuilder<? extends PathArgument, Object, ? extends NormalizedNode<? extends PathArgument, Object>> builder = getBuilder(first); if (deepestChild.isPresent()) { builder.withValue(deepestChild.get().getValue()); } addModifyOpIfPresent(operation, builder); return builder.build(); }
@Override public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) { NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> builder = Builders.leafSetEntryBuilder().withNodeIdentifier(deSerializer.toNodeWithValue( node.getPathArgument())); return deSerializer.buildNormalizedNode(builder, node); } });
@Override public void anyxmlNode(final NodeIdentifier name, final Object value) { checkDataNodeContainer(); final AnyXmlNode node = ImmutableAnyXmlNodeBuilder.create().withNodeIdentifier(name) .withValue((DOMSource) value).build(); writeChild(node); nextSchema = null; }
final DataSchemaNode nameSchemaNode = Iterables.getFirst(instanceDataChildrenByName, null); Preconditions.checkState(nameSchemaNode instanceof LeafSchemaNode); streamNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) nameSchemaNode).withValue(streamName) .build()); Preconditions.checkState(descriptionSchemaNode instanceof LeafSchemaNode); streamNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) nameSchemaNode) .withValue("DESCRIPTION_PLACEHOLDER").build()); Preconditions.checkState(replaySupportSchemaNode instanceof LeafSchemaNode); streamNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) replaySupportSchemaNode) .withValue(Boolean.valueOf(true)).build()); Preconditions.checkState(replayLogCreationTimeSchemaNode instanceof LeafSchemaNode); streamNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) replayLogCreationTimeSchemaNode) .withValue("").build()); Preconditions.checkState(eventsSchemaNode instanceof LeafSchemaNode); streamNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) eventsSchemaNode) .withValue("").build());
@Override public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) { NormalizedNodeAttrBuilder<NodeIdentifier, DOMSource, AnyXmlNode> builder = Builders.anyXmlBuilder() .withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument())); return deSerializer.buildNormalizedNode(builder, node); } });
@Override public void anyxmlNode(final NodeIdentifier name, final Object value) { checkDataNodeContainer(); final AnyXmlNode node = ImmutableAnyXmlNodeBuilder.create().withNodeIdentifier(name) .withValue((DOMSource) value).build(); writeChild(node); nextSchema = null; }
final DataSchemaNode nameSchemaNode = Iterables.getFirst(instanceDataChildrenByName, null); Preconditions.checkState(nameSchemaNode instanceof LeafSchemaNode); moduleNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) nameSchemaNode).withValue(module.getName()) .build()); Preconditions.checkState(revisionSchemaNode instanceof LeafSchemaNode); final String revision = SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()); moduleNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) revisionSchemaNode).withValue(revision) .build()); Preconditions.checkState(namespaceSchemaNode instanceof LeafSchemaNode); moduleNodeValues.withChild(Builders.leafBuilder((LeafSchemaNode) namespaceSchemaNode) .withValue(module.getNamespace().toString()).build()); for (final FeatureDefinition feature : module.getFeatures()) { featuresBuilder.withChild(Builders.leafSetEntryBuilder(((LeafListSchemaNode) featureSchemaNode)) .withValue(feature.getQName().getLocalName()).build());
@Override NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>> getBuilder(final PathArgument node) { return Builders.leafBuilder().withNodeIdentifier(getIdentifier()); } }