From 5f0488294169c571a33bdb76ff19a3ca3e1e6bb6 Mon Sep 17 00:00:00 2001 From: Moiz Raja Date: Tue, 8 Jul 2014 17:20:55 -0700 Subject: [PATCH] Make CompositeModification serializable using protocol buffers Change-Id: I3e91452b0244c6adec84c000e83d7f993b2a59b7 Signed-off-by: Moiz Raja --- .../controller/cluster/datastore/Shard.java | 25 +- .../cluster/datastore/ShardTransaction.java | 4 +- .../messages/RegisterChangeListener.java | 8 +- .../modification/DeleteModification.java | 14 + .../ImmutableCompositeModification.java | 40 +- .../modification/MergeModification.java | 54 +- .../datastore/modification/Modification.java | 3 +- .../MutableCompositeModification.java | 34 +- .../modification/WriteModification.java | 36 +- .../datastore/BasicIntegrationTest.java | 1 + .../modification/DeleteModificationTest.java | 4 +- .../modification/MergeModificationTest.java | 4 +- .../MutableCompositeModificationTest.java | 4 +- .../modification/WriteModificationTest.java | 4 +- .../persistent/PersistentMessages.java | 1853 +++++++++++++++++ .../src/main/resources/Persistent.proto | 18 + 16 files changed, 2059 insertions(+), 47 deletions(-) create mode 100644 opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java create mode 100644 opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java index 71e881c696..5cc14e67e7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java @@ -30,6 +30,7 @@ import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeList import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply; import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext; import org.opendaylight.controller.cluster.datastore.modification.Modification; +import org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener; import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction; @@ -59,7 +60,7 @@ public class Shard extends UntypedProcessor { private final InMemoryDOMDataStore store; - private final Map + private final Map modificationToCohort = new HashMap<>(); private final LoggingAdapter log = @@ -97,6 +98,11 @@ public class Shard extends UntypedProcessor { public void onReceive(Object message) throws Exception { log.debug("Received message {}", message); + if(!recoveryFinished()){ + // FIXME : Properly handle recovery + return; + } + if (message instanceof CreateTransactionChain) { createTransactionChain(); } else if (message instanceof RegisterChangeListener) { @@ -106,11 +112,11 @@ public class Shard extends UntypedProcessor { } else if (message instanceof ForwardedCommitTransaction) { handleForwardedCommit((ForwardedCommitTransaction) message); } else if (message instanceof Persistent) { - commit((Modification) ((Persistent) message).payload()); + commit(((Persistent)message).payload()); } else if (message instanceof CreateTransaction) { createTransaction((CreateTransaction) message); } else if(message instanceof NonPersistent){ - commit((Modification) ((NonPersistent) message).payload()); + commit(((NonPersistent)message).payload()); } } @@ -124,9 +130,10 @@ public class Shard extends UntypedProcessor { getSelf()); } - private void commit(Modification modification) { + private void commit(Object serialized) { + Modification modification = MutableCompositeModification.fromSerializable(serialized, schemaContext); DOMStoreThreePhaseCommitCohort cohort = - modificationToCohort.remove(modification); + modificationToCohort.remove(serialized); if (cohort == null) { log.error( "Could not find cohort for modification : " + modification); @@ -150,13 +157,15 @@ public class Shard extends UntypedProcessor { } private void handleForwardedCommit(ForwardedCommitTransaction message) { + Object serializedModification = message.getModification().toSerializable(); + modificationToCohort - .put(message.getModification(), message.getCohort()); + .put(serializedModification , message.getCohort()); if(persistent) { - getSelf().forward(Persistent.create(message.getModification()), + getSelf().forward(Persistent.create(serializedModification), getContext()); } else { - getSelf().forward(NonPersistent.create(message.getModification()), + getSelf().forward(NonPersistent.create(serializedModification), getContext()); } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java index 33e1369443..835ad68bf2 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardTransaction.java @@ -172,14 +172,14 @@ public class ShardTransaction extends AbstractUntypedActor { private void writeData(WriteData message) { modification.addModification( - new WriteModification(message.getPath(), message.getData())); + new WriteModification(message.getPath(), message.getData(),schemaContext)); transaction.write(message.getPath(), message.getData()); getSender().tell(new WriteDataReply(), getSelf()); } private void mergeData(MergeData message) { modification.addModification( - new MergeModification(message.getPath(), message.getData())); + new MergeModification(message.getPath(), message.getData(), schemaContext)); transaction.merge(message.getPath(), message.getData()); getSender().tell(new MergeDataReply(), getSelf()); } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java index 7c9e4f0665..9363a20ca6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/RegisterChangeListener.java @@ -12,7 +12,8 @@ import akka.actor.ActorPath; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; -public class RegisterChangeListener { +public class RegisterChangeListener implements SerializableMessage { + private final InstanceIdentifier path; private final ActorPath dataChangeListenerPath; private final AsyncDataBroker.DataChangeScope scope; @@ -38,4 +39,9 @@ public class RegisterChangeListener { public ActorPath getDataChangeListenerPath() { return dataChangeListenerPath; } + + + @Override public Object toSerializable() { + throw new UnsupportedOperationException("foo"); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java index 063ec3e1fc..f7d8b87ff6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModification.java @@ -8,6 +8,8 @@ package org.opendaylight.controller.cluster.datastore.modification; +import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; @@ -23,4 +25,16 @@ public class DeleteModification extends AbstractModification { public void apply(DOMStoreWriteTransaction transaction) { transaction.delete(path); } + + @Override public Object toSerializable() { + return PersistentMessages.Modification.newBuilder() + .setType(this.getClass().toString()) + .setPath(this.path.toString()) + .build(); + } + + public static DeleteModification fromSerializable(Object serializable){ + PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; + return new DeleteModification(InstanceIdentifierUtils.from(o.getPath())); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/ImmutableCompositeModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/ImmutableCompositeModification.java index 5a15d76d27..2d11500eb7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/ImmutableCompositeModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/ImmutableCompositeModification.java @@ -8,25 +8,39 @@ package org.opendaylight.controller.cluster.datastore.modification; +import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import java.util.List; -public class ImmutableCompositeModification implements CompositeModification{ +public class ImmutableCompositeModification implements CompositeModification { - private final CompositeModification modification; + private final CompositeModification modification; - public ImmutableCompositeModification(CompositeModification modification){ - this.modification = modification; - } + public ImmutableCompositeModification(CompositeModification modification) { + this.modification = modification; + } - @Override - public List getModifications() { - return modification.getModifications(); - } + @Override + public List getModifications() { + return modification.getModifications(); + } - @Override - public void apply(DOMStoreWriteTransaction transaction) { - modification.apply(transaction); - } + @Override + public void apply(DOMStoreWriteTransaction transaction) { + modification.apply(transaction); + } + + @Override public Object toSerializable() { + + PersistentMessages.CompositeModification.Builder builder = + PersistentMessages.CompositeModification.newBuilder(); + + for (Modification m : modification.getModifications()) { + builder.addModification( + (PersistentMessages.Modification) m.toSerializable()); + } + + return builder.build(); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java index 0457a78280..b484f85491 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MergeModification.java @@ -8,24 +8,58 @@ package org.opendaylight.controller.cluster.datastore.modification; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; +import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** * MergeModification stores all the parameters required to merge data into the specified path */ -public class MergeModification extends AbstractModification{ - private final NormalizedNode data; +public class MergeModification extends AbstractModification { + private final NormalizedNode data; + private final SchemaContext schemaContext; - public MergeModification(InstanceIdentifier path, NormalizedNode data) { - super(path); - this.data = data; - } + public MergeModification(InstanceIdentifier path, NormalizedNode data, + SchemaContext schemaContext) { + super(path); + this.data = data; + this.schemaContext = schemaContext; + } + + @Override + public void apply(DOMStoreWriteTransaction transaction) { + transaction.merge(path, data); + } + + @Override public Object toSerializable() { + NormalizedNodeMessages.Container encode = + new NormalizedNodeToNodeCodec(schemaContext).encode( + InstanceIdentifierUtils.from(path.toString()), data); + + return PersistentMessages.Modification.newBuilder() + .setType(this.getClass().toString()) + .setPath(this.path.toString()) + .setData(encode.getNormalizedNode()) + .build(); + + } + + public static MergeModification fromSerializable( + Object serializable, + SchemaContext schemaContext) { + PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; + + InstanceIdentifier path = InstanceIdentifierUtils.from(o.getPath()); + NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode( + path, o.getData()); + + return new MergeModification(path, data, schemaContext); + } - @Override - public void apply(DOMStoreWriteTransaction transaction) { - transaction.merge(path, data); - } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/Modification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/Modification.java index 60dbf0f4b1..ed9b1fe3b9 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/Modification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/Modification.java @@ -8,6 +8,7 @@ package org.opendaylight.controller.cluster.datastore.modification; +import org.opendaylight.controller.cluster.datastore.messages.SerializableMessage; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; /** @@ -24,7 +25,7 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; * which can then be applied to a write transaction *

*/ -public interface Modification { +public interface Modification extends SerializableMessage { /** * Apply the modification to the specified transaction * @param transaction diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModification.java index 9f37ba42d3..1a005d856e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModification.java @@ -8,9 +8,10 @@ package org.opendaylight.controller.cluster.datastore.modification; +import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -20,7 +21,7 @@ import java.util.List; * CompositeModification {@link org.opendaylight.controller.cluster.datastore.modification.MutableCompositeModification#addModification(Modification)} */ public class MutableCompositeModification - implements CompositeModification, Serializable { + implements CompositeModification { private static final long serialVersionUID = 1163377899140186790L; @@ -46,4 +47,33 @@ public class MutableCompositeModification public List getModifications() { return Collections.unmodifiableList(modifications); } + + @Override public Object toSerializable() { + PersistentMessages.CompositeModification.Builder builder = + PersistentMessages.CompositeModification.newBuilder(); + + for (Modification m : modifications) { + builder.addModification( + (PersistentMessages.Modification) m.toSerializable()); + } + + return builder.build(); + } + + public static MutableCompositeModification fromSerializable(Object serializable, SchemaContext schemaContext){ + PersistentMessages.CompositeModification o = (PersistentMessages.CompositeModification) serializable; + MutableCompositeModification compositeModification = new MutableCompositeModification(); + + for(PersistentMessages.Modification m : o.getModificationList()){ + if(m.getType().equals(DeleteModification.class.toString())){ + compositeModification.addModification(DeleteModification.fromSerializable(m)); + } else if(m.getType().equals(WriteModification.class.toString())){ + compositeModification.addModification(WriteModification.fromSerializable(m, schemaContext)); + } else if(m.getType().equals(MergeModification.class.toString())){ + compositeModification.addModification(MergeModification.fromSerializable(m, schemaContext)); + } + } + + return compositeModification; + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java index 1b2a87f42b..0f81c7cefe 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/modification/WriteModification.java @@ -8,9 +8,14 @@ package org.opendaylight.controller.cluster.datastore.modification; +import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec; +import org.opendaylight.controller.cluster.datastore.utils.InstanceIdentifierUtils; +import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages; +import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages; import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction; import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; /** * WriteModification stores all the parameters required to write data to the specified path @@ -18,15 +23,42 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; public class WriteModification extends AbstractModification { private final NormalizedNode data; + private final SchemaContext schemaContext; - public WriteModification(InstanceIdentifier path, NormalizedNode data) { + public WriteModification(InstanceIdentifier path, NormalizedNode data, SchemaContext schemaContext) { super(path); this.data = data; - } + this.schemaContext = schemaContext; + } @Override public void apply(DOMStoreWriteTransaction transaction) { transaction.write(path, data); } + @Override public Object toSerializable() { + NormalizedNodeMessages.Container encode = + new NormalizedNodeToNodeCodec(schemaContext).encode( + InstanceIdentifierUtils.from(path.toString()), data); + + + return PersistentMessages.Modification.newBuilder() + .setType(this.getClass().toString()) + .setPath(this.path.toString()) + .setData(encode.getNormalizedNode()) + .build(); + + } + + public static WriteModification fromSerializable( + Object serializable, + SchemaContext schemaContext) { + PersistentMessages.Modification o = (PersistentMessages.Modification) serializable; + + InstanceIdentifier path = InstanceIdentifierUtils.from(o.getPath()); + NormalizedNode data = new NormalizedNodeToNodeCodec(schemaContext).decode( + path, o.getData()); + + return new WriteModification(path, data, schemaContext); + } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java index e275bc5f12..6b9f00e00e 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/BasicIntegrationTest.java @@ -39,6 +39,7 @@ public class BasicIntegrationTest extends AbstractActorTest { @Test public void integrationTest() throws Exception{ + // System.setProperty("shard.persistent", "true"); // This test will // - create a Shard // - initiate a transaction diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModificationTest.java index c1f9f3a631..b33f902929 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/DeleteModificationTest.java @@ -15,7 +15,7 @@ public class DeleteModificationTest extends AbstractModificationTest{ public void testApply() throws Exception { //Write something into the datastore DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction(); - WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)); + WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()); writeModification.apply(writeTransaction); commitTransaction(writeTransaction); @@ -32,4 +32,4 @@ public class DeleteModificationTest extends AbstractModificationTest{ data = readData(TestModel.TEST_PATH); Assert.assertFalse(data.isPresent()); } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java index fd125fb79d..9af3439ae1 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MergeModificationTest.java @@ -16,7 +16,7 @@ public class MergeModificationTest extends AbstractModificationTest{ //Write something into the datastore DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction(); - MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)); + MergeModification writeModification = new MergeModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()); writeModification.apply(writeTransaction); commitTransaction(writeTransaction); @@ -25,4 +25,4 @@ public class MergeModificationTest extends AbstractModificationTest{ Assert.assertTrue(data.isPresent()); } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java index e30936b327..7a21c8cdc5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/MutableCompositeModificationTest.java @@ -14,7 +14,7 @@ public class MutableCompositeModificationTest extends AbstractModificationTest { public void testApply() throws Exception { MutableCompositeModification compositeModification = new MutableCompositeModification(); - compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME))); + compositeModification.addModification(new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext())); DOMStoreReadWriteTransaction transaction = store.newReadWriteTransaction(); compositeModification.apply(transaction); @@ -25,4 +25,4 @@ public class MutableCompositeModificationTest extends AbstractModificationTest { Assert.assertNotNull(data.get()); Assert.assertEquals(TestModel.TEST_QNAME, data.get().getNodeType()); } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java index e206bf8196..75d8c00db8 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/WriteModificationTest.java @@ -14,7 +14,7 @@ public class WriteModificationTest extends AbstractModificationTest{ public void testApply() throws Exception { //Write something into the datastore DOMStoreReadWriteTransaction writeTransaction = store.newReadWriteTransaction(); - WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME)); + WriteModification writeModification = new WriteModification(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME), TestModel.createTestContext()); writeModification.apply(writeTransaction); commitTransaction(writeTransaction); @@ -23,4 +23,4 @@ public class WriteModificationTest extends AbstractModificationTest{ Assert.assertTrue(data.isPresent()); } -} \ No newline at end of file +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java new file mode 100644 index 0000000000..a48e0ab6da --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/java/org/opendaylight/controller/protobuff/messages/persistent/PersistentMessages.java @@ -0,0 +1,1853 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Persistent.proto + +package org.opendaylight.controller.protobuff.messages.persistent; + +public final class PersistentMessages { + private PersistentMessages() { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + } + + public interface ModificationOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string type = 1; + + /** + * required string type = 1; + */ + boolean hasType(); + + /** + * required string type = 1; + */ + java.lang.String getType(); + + /** + * required string type = 1; + */ + com.google.protobuf.ByteString + getTypeBytes(); + + // required string path = 2; + + /** + * required string path = 2; + */ + boolean hasPath(); + + /** + * required string path = 2; + */ + java.lang.String getPath(); + + /** + * required string path = 2; + */ + com.google.protobuf.ByteString + getPathBytes(); + + // optional .org.opendaylight.controller.mdsal.Node data = 3; + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + boolean hasData(); + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData(); + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder(); + } + + + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.Modification} + */ + public static final class Modification extends + com.google.protobuf.GeneratedMessage + implements ModificationOrBuilder { + // Use Modification.newBuilder() to construct. + private Modification( + com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + + private Modification(boolean noInit) { + this.unknownFields = + com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + + private static final Modification defaultInstance; + + public static Modification getDefaultInstance() { + return defaultInstance; + } + + public Modification getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + + private Modification( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + type_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + path_ = input.readBytes(); + break; + } + case 26: { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder + subBuilder = null; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + subBuilder = data_.toBuilder(); + } + data_ = input.readMessage( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.PARSER, + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(data_); + data_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000004; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.class, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public Modification parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Modification(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // required string type = 1; + public static final int TYPE_FIELD_NUMBER = 1; + private java.lang.Object type_; + + /** + * required string type = 1; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + + /** + * required string type = 1; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + type_ = s; + } + return s; + } + } + + /** + * required string type = 1; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required string path = 2; + public static final int PATH_FIELD_NUMBER = 2; + private java.lang.Object path_; + + /** + * required string path = 2; + */ + public boolean hasPath() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + + /** + * required string path = 2; + */ + public java.lang.String getPath() { + java.lang.Object ref = path_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + path_ = s; + } + return s; + } + } + + /** + * required string path = 2; + */ + public com.google.protobuf.ByteString + getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional .org.opendaylight.controller.mdsal.Node data = 3; + public static final int DATA_FIELD_NUMBER = 3; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + data_; + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public boolean hasData() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData() { + return data_; + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder() { + return data_; + } + + private void initFields() { + type_ = ""; + path_ = ""; + data_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + .getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) + return isInitialized == 1; + + if (!hasType()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasPath()) { + memoizedIsInitialized = 0; + return false; + } + if (hasData()) { + if (!getData().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getTypeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, getPathBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeMessage(3, data_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) + return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getTypeBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, getPathBytes()); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(3, data_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseDelimitedFrom( + java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { + return Builder.create(); + } + + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification prototype) { + return newBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return newBuilder(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.Modification} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.class, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder.class); + } + + // Construct using org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getDataFieldBuilder(); + } + } + + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + type_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + path_ = ""; + bitField0_ = (bitField0_ & ~0x00000002); + if (dataBuilder_ == null) { + data_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + .getDefaultInstance(); + } else { + dataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_Modification_descriptor; + } + + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification + .getDefaultInstance(); + } + + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification build() { + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification + result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification buildPartial() { + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification + result = + new org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification( + this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.type_ = type_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.path_ = path_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + if (dataBuilder_ == null) { + result.data_ = data_; + } else { + result.data_ = dataBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification) { + return mergeFrom( + (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification other) { + if (other + == org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification + .getDefaultInstance()) + return this; + if (other.hasType()) { + bitField0_ |= 0x00000001; + type_ = other.type_; + onChanged(); + } + if (other.hasPath()) { + bitField0_ |= 0x00000002; + path_ = other.path_; + onChanged(); + } + if (other.hasData()) { + mergeData(other.getData()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasType()) { + + return false; + } + if (!hasPath()) { + + return false; + } + if (hasData()) { + if (!getData().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification + parsedMessage = null; + try { + parsedMessage = + PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification) e + .getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + // required string type = 1; + private java.lang.Object type_ = ""; + + /** + * required string type = 1; + */ + public boolean hasType() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + + /** + * required string type = 1; + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + type_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * required string type = 1; + */ + public com.google.protobuf.ByteString + getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * required string type = 1; + */ + public Builder setType( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + type_ = value; + onChanged(); + return this; + } + + /** + * required string type = 1; + */ + public Builder clearType() { + bitField0_ = (bitField0_ & ~0x00000001); + type_ = getDefaultInstance().getType(); + onChanged(); + return this; + } + + /** + * required string type = 1; + */ + public Builder setTypeBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + type_ = value; + onChanged(); + return this; + } + + // required string path = 2; + private java.lang.Object path_ = ""; + + /** + * required string path = 2; + */ + public boolean hasPath() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + + /** + * required string path = 2; + */ + public java.lang.String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + path_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + + /** + * required string path = 2; + */ + public com.google.protobuf.ByteString + getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + /** + * required string path = 2; + */ + public Builder setPath( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + path_ = value; + onChanged(); + return this; + } + + /** + * required string path = 2; + */ + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000002); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + + /** + * required string path = 2; + */ + public Builder setPathBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + path_ = value; + onChanged(); + return this; + } + + // optional .org.opendaylight.controller.mdsal.Node data = 3; + private org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + data_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + .getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> + dataBuilder_; + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public boolean hasData() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node getData() { + if (dataBuilder_ == null) { + return data_; + } else { + return dataBuilder_.getMessage(); + } + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public Builder setData( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (dataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + data_ = value; + onChanged(); + } else { + dataBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + return this; + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public Builder setData( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder builderForValue) { + if (dataBuilder_ == null) { + data_ = builderForValue.build(); + onChanged(); + } else { + dataBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + return this; + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public Builder mergeData( + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node value) { + if (dataBuilder_ == null) { + if (((bitField0_ & 0x00000004) == 0x00000004) && + data_ + != org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + .getDefaultInstance()) { + data_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + .newBuilder(data_).mergeFrom(value) + .buildPartial(); + } else { + data_ = value; + } + onChanged(); + } else { + dataBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + return this; + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public Builder clearData() { + if (dataBuilder_ == null) { + data_ = + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node + .getDefaultInstance(); + onChanged(); + } else { + dataBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder getDataBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getDataFieldBuilder().getBuilder(); + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + public org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder getDataOrBuilder() { + if (dataBuilder_ != null) { + return dataBuilder_.getMessageOrBuilder(); + } else { + return data_; + } + } + + /** + * optional .org.opendaylight.controller.mdsal.Node data = 3; + */ + private com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder> + getDataFieldBuilder() { + if (dataBuilder_ == null) { + dataBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>( + data_, + getParentForChildren(), + isClean()); + data_ = null; + } + return dataBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.Modification) + } + + + static { + defaultInstance = new Modification(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.Modification) + } + + + public interface CompositeModificationOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + java.util.List + getModificationList(); + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification( + int index); + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + int getModificationCount(); + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + java.util.List + getModificationOrBuilderList(); + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder( + int index); + } + + + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CompositeModification} + */ + public static final class CompositeModification extends + com.google.protobuf.GeneratedMessage + implements CompositeModificationOrBuilder { + // Use CompositeModification.newBuilder() to construct. + private CompositeModification( + com.google.protobuf.GeneratedMessage.Builder builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + + private CompositeModification(boolean noInit) { + this.unknownFields = + com.google.protobuf.UnknownFieldSet.getDefaultInstance(); + } + + private static final CompositeModification defaultInstance; + + public static CompositeModification getDefaultInstance() { + return defaultInstance; + } + + public CompositeModification getDefaultInstanceForType() { + return defaultInstance; + } + + private final com.google.protobuf.UnknownFieldSet unknownFields; + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + + private CompositeModification( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + if (!((mutable_bitField0_ & 0x00000001) + == 0x00000001)) { + modification_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + modification_.add(input.readMessage( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.PARSER, + extensionRegistry)); + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { + modification_ = + java.util.Collections.unmodifiableList(modification_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.Builder.class); + } + + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public CompositeModification parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CompositeModification(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + // repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + public static final int MODIFICATION_FIELD_NUMBER = 1; + private java.util.List + modification_; + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public java.util.List getModificationList() { + return modification_; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public java.util.List + getModificationOrBuilderList() { + return modification_; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public int getModificationCount() { + return modification_.size(); + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification( + int index) { + return modification_.get(index); + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder( + int index) { + return modification_.get(index); + } + + private void initFields() { + modification_ = java.util.Collections.emptyList(); + } + + private byte memoizedIsInitialized = -1; + + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) + return isInitialized == 1; + + for (int i = 0; i < getModificationCount(); i++) { + if (!getModification(i).isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + for (int i = 0; i < modification_.size(); i++) { + output.writeMessage(1, modification_.get(i)); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) + return size; + + size = 0; + for (int i = 0; i < modification_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, modification_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseDelimitedFrom( + java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + + public static org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { + return Builder.create(); + } + + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification prototype) { + return newBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return newBuilder(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + + /** + * Protobuf type {@code org.opendaylight.controller.mdsal.CompositeModification} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModificationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.class, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.Builder.class); + } + + // Construct using org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getModificationFieldBuilder(); + } + } + + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (modificationBuilder_ == null) { + modification_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + modificationBuilder_.clear(); + } + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor; + } + + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification getDefaultInstanceForType() { + return org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification + .getDefaultInstance(); + } + + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification build() { + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification + result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification buildPartial() { + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification + result = + new org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification( + this); + int from_bitField0_ = bitField0_; + if (modificationBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001)) { + modification_ = java.util.Collections + .unmodifiableList(modification_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.modification_ = modification_; + } else { + result.modification_ = modificationBuilder_.build(); + } + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification) { + return mergeFrom( + (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification other) { + if (other + == org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification + .getDefaultInstance()) + return this; + if (modificationBuilder_ == null) { + if (!other.modification_.isEmpty()) { + if (modification_.isEmpty()) { + modification_ = other.modification_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureModificationIsMutable(); + modification_.addAll(other.modification_); + } + onChanged(); + } + } else { + if (!other.modification_.isEmpty()) { + if (modificationBuilder_.isEmpty()) { + modificationBuilder_.dispose(); + modificationBuilder_ = null; + modification_ = other.modification_; + bitField0_ = (bitField0_ & ~0x00000001); + modificationBuilder_ = + com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? + getModificationFieldBuilder() : null; + } else { + modificationBuilder_ + .addAllMessages(other.modification_); + } + } + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + for (int i = 0; i < getModificationCount(); i++) { + if (!getModification(i).isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification + parsedMessage = null; + try { + parsedMessage = + PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.CompositeModification) e + .getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + // repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + private java.util.List + modification_ = + java.util.Collections.emptyList(); + + private void ensureModificationIsMutable() { + if (!((bitField0_ & 0x00000001) == 0x00000001)) { + modification_ = + new java.util.ArrayList( + modification_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> + modificationBuilder_; + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public java.util.List getModificationList() { + if (modificationBuilder_ == null) { + return java.util.Collections + .unmodifiableList(modification_); + } else { + return modificationBuilder_.getMessageList(); + } + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public int getModificationCount() { + if (modificationBuilder_ == null) { + return modification_.size(); + } else { + return modificationBuilder_.getCount(); + } + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification getModification( + int index) { + if (modificationBuilder_ == null) { + return modification_.get(index); + } else { + return modificationBuilder_.getMessage(index); + } + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder setModification( + int index, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) { + if (modificationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureModificationIsMutable(); + modification_.set(index, value); + onChanged(); + } else { + modificationBuilder_.setMessage(index, value); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder setModification( + int index, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) { + if (modificationBuilder_ == null) { + ensureModificationIsMutable(); + modification_.set(index, builderForValue.build()); + onChanged(); + } else { + modificationBuilder_ + .setMessage(index, builderForValue.build()); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder addModification( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) { + if (modificationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureModificationIsMutable(); + modification_.add(value); + onChanged(); + } else { + modificationBuilder_.addMessage(value); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder addModification( + int index, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification value) { + if (modificationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureModificationIsMutable(); + modification_.add(index, value); + onChanged(); + } else { + modificationBuilder_.addMessage(index, value); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder addModification( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) { + if (modificationBuilder_ == null) { + ensureModificationIsMutable(); + modification_.add(builderForValue.build()); + onChanged(); + } else { + modificationBuilder_.addMessage(builderForValue.build()); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder addModification( + int index, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder builderForValue) { + if (modificationBuilder_ == null) { + ensureModificationIsMutable(); + modification_.add(index, builderForValue.build()); + onChanged(); + } else { + modificationBuilder_ + .addMessage(index, builderForValue.build()); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder addAllModification( + java.lang.Iterable values) { + if (modificationBuilder_ == null) { + ensureModificationIsMutable(); + super.addAll(values, modification_); + onChanged(); + } else { + modificationBuilder_.addAllMessages(values); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder clearModification() { + if (modificationBuilder_ == null) { + modification_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + modificationBuilder_.clear(); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public Builder removeModification(int index) { + if (modificationBuilder_ == null) { + ensureModificationIsMutable(); + modification_.remove(index); + onChanged(); + } else { + modificationBuilder_.remove(index); + } + return this; + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder getModificationBuilder( + int index) { + return getModificationFieldBuilder().getBuilder(index); + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder getModificationOrBuilder( + int index) { + if (modificationBuilder_ == null) { + return modification_.get(index); + } else { + return modificationBuilder_.getMessageOrBuilder(index); + } + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public java.util.List + getModificationOrBuilderList() { + if (modificationBuilder_ != null) { + return modificationBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections + .unmodifiableList(modification_); + } + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder addModificationBuilder() { + return getModificationFieldBuilder().addBuilder( + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification + .getDefaultInstance()); + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder addModificationBuilder( + int index) { + return getModificationFieldBuilder().addBuilder( + index, + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification + .getDefaultInstance()); + } + + /** + * repeated .org.opendaylight.controller.mdsal.Modification modification = 1; + */ + public java.util.List + getModificationBuilderList() { + return getModificationFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder> + getModificationFieldBuilder() { + if (modificationBuilder_ == null) { + modificationBuilder_ = + new com.google.protobuf.RepeatedFieldBuilder< + org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>( + modification_, + ((bitField0_ & 0x00000001) == 0x00000001), + getParentForChildren(), + isClean()); + modification_ = null; + } + return modificationBuilder_; + } + + // @@protoc_insertion_point(builder_scope:org.opendaylight.controller.mdsal.CompositeModification) + } + + + static { + defaultInstance = new CompositeModification(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.opendaylight.controller.mdsal.CompositeModification) + } + + + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_Modification_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + + static { + java.lang.String[] descriptorData = { + "\n\020Persistent.proto\022!org.opendaylight.con" + + "troller.mdsal\032\014Common.proto\"a\n\014Modificat" + + "ion\022\014\n\004type\030\001 \002(\t\022\014\n\004path\030\002 \002(\t\0225\n\004data\030" + + + "\003 \001(\0132\'.org.opendaylight.controller.mdsa" + + "l.Node\"^\n\025CompositeModification\022E\n\014modif" + + "ication\030\001 \003(\0132/.org.opendaylight.control" + + "ler.mdsal.ModificationBO\n9org.opendaylig" + + "ht.controller.protobuff.messages.persist" + + "entB\022PersistentMessages" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner + assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_org_opendaylight_controller_mdsal_Modification_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_opendaylight_controller_mdsal_Modification_fieldAccessorTable = + new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_Modification_descriptor, + new java.lang.String[] {"Type", "Path", "Data",}); + internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_org_opendaylight_controller_mdsal_CompositeModification_fieldAccessorTable = + new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_opendaylight_controller_mdsal_CompositeModification_descriptor, + new java.lang.String[] {"Modification",}); + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages + .getDescriptor(), + }, assigner + ); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto new file mode 100644 index 0000000000..5b49503d42 --- /dev/null +++ b/opendaylight/md-sal/sal-protocolbuffer-encoding/src/main/resources/Persistent.proto @@ -0,0 +1,18 @@ +package org.opendaylight.controller.mdsal; + +import "Common.proto"; + +option java_package = "org.opendaylight.controller.protobuff.messages.persistent"; +option java_outer_classname = "PersistentMessages"; + + +message Modification { + required string type=1; + required string path=2; + optional Node data=3; +} + + +message CompositeModification { + repeated Modification modification=1; +} -- 2.36.6