public static void serializePathAndNode(YangInstanceIdentifier path, NormalizedNode<?, ?> node, DataOutput out) { Preconditions.checkNotNull(path); Preconditions.checkNotNull(node); try { NormalizedNodeDataOutput streamWriter = streamWriter(out); streamWriter.writeNormalizedNode(node); streamWriter.writeYangInstanceIdentifier(path); } catch (IOException e) { throw new IllegalArgumentException(String.format("Error serializing path %s and Node %s", path, node), e); } }
void writeTo(final NormalizedNodeDataOutput out) throws IOException { out.writeByte(getType()); out.writeYangInstanceIdentifier(path); }
@Override public void writeExternal(final ObjectOutput out) throws IOException { out.writeObject(Serialization.serializedActorPath(rpcInvoker)); final NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(out); nnout.writeInt(rpcs.size()); for (DOMRpcIdentifier id : rpcs) { nnout.writeSchemaPath(id.getType()); nnout.writeYangInstanceIdentifier(id.getContextReference()); } }
public static void writeDataTreeCandidate(final DataOutput out, DataTreeCandidate candidate) throws IOException { try (final NormalizedNodeDataOutput writer = NormalizedNodeInputOutput.newDataOutput(out)) { writer.writeYangInstanceIdentifier(candidate.getRootPath()); writer.writeByte(APPEARED); writeChildren(writer, node.getChildNodes()); break; case DELETE: writer.writeByte(DELETE); break; case DISAPPEARED: writer.writeByte(DISAPPEARED); writeChildren(writer, node.getChildNodes()); break; case SUBTREE_MODIFIED: writer.writeByte(SUBTREE_MODIFIED); writeChildren(writer, node.getChildNodes()); break; case UNMODIFIED: writer.writeByte(UNMODIFIED); break; case WRITE: writer.writeByte(WRITE); writer.writeNormalizedNode(node.getDataAfter().get()); break; default:
public static void serializePath(YangInstanceIdentifier path, DataOutput out) { Preconditions.checkNotNull(path); try { NormalizedNodeDataOutput streamWriter = streamWriter(out); streamWriter.writeYangInstanceIdentifier(path); } catch (IOException e) { throw new IllegalArgumentException(String.format("Error serializing path %s", path), e); } }
public static void serializeNormalizedNode(NormalizedNode<?, ?> node, DataOutput out) { try { out.writeBoolean(node != null); if(node != null) { NormalizedNodeDataOutput streamWriter = streamWriter(out); streamWriter.writeNormalizedNode(node); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Error serializing NormalizedNode %s", node), e); } }
switch (node.getModificationType()) { case APPEARED: out.writeByte(APPEARED); out.writePathArgument(node.getIdentifier()); writeChildren(out, node.getChildNodes()); break; case DELETE: out.writeByte(DELETE); out.writePathArgument(node.getIdentifier()); break; case DISAPPEARED: out.writeByte(DISAPPEARED); out.writePathArgument(node.getIdentifier()); writeChildren(out, node.getChildNodes()); break; case SUBTREE_MODIFIED: out.writeByte(SUBTREE_MODIFIED); out.writePathArgument(node.getIdentifier()); writeChildren(out, node.getChildNodes()); break; case WRITE: out.writeByte(WRITE); out.writeNormalizedNode(node.getDataAfter().get()); break; case UNMODIFIED: out.writeByte(UNMODIFIED); break; default:
private static void writeChildren(final NormalizedNodeDataOutput out, final Collection<DataTreeCandidateNode> children) throws IOException { out.writeInt(children.size()); for (DataTreeCandidateNode child : children) { writeNode(out, child); } }
@Test public void testSchemaPathSerialization() throws Exception { final SchemaPath expected = SchemaPath.create(true, TestModel.ANY_XML_QNAME); ByteArrayOutputStream bos = new ByteArrayOutputStream(); NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(ByteStreams.newDataOutput(bos)); nnout.writeSchemaPath(expected); NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput( bos.toByteArray())); SchemaPath actual = nnin.readSchemaPath(); assertEquals(expected, actual); }
public static void serializePath(YangInstanceIdentifier path, DataOutput out) { Preconditions.checkNotNull(path); try { NormalizedNodeDataOutput streamWriter = streamWriter(out); streamWriter.writeYangInstanceIdentifier(path); } catch (IOException e) { throw new IllegalArgumentException(String.format("Error serializing path %s", path), e); } }
public static void serializeNormalizedNode(NormalizedNode<?, ?> node, DataOutput out) { try { out.writeBoolean(node != null); if (node != null) { NormalizedNodeDataOutput streamWriter = streamWriter(out); streamWriter.writeNormalizedNode(node); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Error serializing NormalizedNode %s", node), e); } }
public static void serializePathAndNode(YangInstanceIdentifier path, NormalizedNode<?, ?> node, DataOutput out) { Preconditions.checkNotNull(path); Preconditions.checkNotNull(node); try { NormalizedNodeDataOutput streamWriter = streamWriter(out); streamWriter.writeNormalizedNode(node); streamWriter.writeYangInstanceIdentifier(path); } catch (IOException e) { throw new IllegalArgumentException(String.format("Error serializing path %s and Node %s", path, node), e); } }
@Override public final void writeExternal(final ObjectOutput out) throws IOException { super.writeExternal(out); try (NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(out)) { nnout.writeYangInstanceIdentifier(path); } }
@Override final void writeTo(final NormalizedNodeDataOutput out) throws IOException { super.writeTo(out); out.writeNormalizedNode(data); } }
void writeTo(final NormalizedNodeDataOutput out) throws IOException { out.writeByte(getType()); out.writeYangInstanceIdentifier(path); }
out.writeInt(createdData.size()); for(Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> e: createdData.entrySet()) { streamWriter.writeYangInstanceIdentifier(e.getKey()); streamWriter.writeNormalizedNode(e.getValue()); out.writeInt(updatedData.size()); for(Map.Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> e: updatedData.entrySet()) { streamWriter.writeYangInstanceIdentifier(e.getKey()); streamWriter.writeNormalizedNode(originalData.get(e.getKey())); streamWriter.writeNormalizedNode(e.getValue()); out.writeInt(removed.size()); for(YangInstanceIdentifier path: removed) { streamWriter.writeYangInstanceIdentifier(path); streamWriter.writeNormalizedNode(originalData.get(path)); out.writeBoolean(originalSubtree != null); if(originalSubtree != null) { streamWriter.writeNormalizedNode(originalSubtree); out.writeBoolean(updatedSubtree != null); if(updatedSubtree != null) { streamWriter.writeNormalizedNode(updatedSubtree);
@Override public final void writeExternal(final ObjectOutput out) throws IOException { super.writeExternal(out); try (NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(out)) { nnout.writeYangInstanceIdentifier(path); } }
@Override final void writeTo(final NormalizedNodeDataOutput out) throws IOException { super.writeTo(out); out.writeNormalizedNode(data); } }
@Override public void writeExternal(final ObjectOutput out) throws IOException { final NormalizedNodeDataOutput dataOutput = NormalizedNodeInputOutput.newDataOutput(out); final NormalizedNodeWriter normalizedNodeWriter = NormalizedNodeWriter.forStreamWriter((NormalizedNodeStreamWriter) dataOutput); dataOutput.writeYangInstanceIdentifier(identifier); normalizedNodeWriter.write(node); }
@Override public void writeExternal(final ObjectOutput out) throws IOException { super.writeExternal(out); if (data.isPresent()) { out.writeBoolean(true); try (NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(out)) { nnout.writeNormalizedNode(data.get()); } } else { out.writeBoolean(false); } }