import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Decoded;
import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec;
import org.opendaylight.controller.cluster.datastore.node.NormalizedNodeToNodeCodec.Decoded;
import org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
/**
* MergeModification stores all the parameters required to merge data into the specified path
*/
public class MergeModification extends WriteModification {
/**
* MergeModification stores all the parameters required to merge data into the specified path
*/
public class MergeModification extends WriteModification {
- public MergeModification(YangInstanceIdentifier path, NormalizedNode data,
- SchemaContext schemaContext) {
- super(path, data, schemaContext);
+ public MergeModification() {
+ }
+
+ public MergeModification(final YangInstanceIdentifier path, final NormalizedNode<?, ?> data) {
+ super(path, data);
- public void apply(DOMStoreWriteTransaction transaction) {
- transaction.merge(path, data);
+ public void apply(final DOMStoreWriteTransaction transaction) {
+ transaction.merge(getPath(), getData());
- Decoded decoded = new NormalizedNodeToNodeCodec(schemaContext).decode(o.getPath(), o.getData());
- return new MergeModification(decoded.getDecodedPath(), decoded.getDecodedNode(), schemaContext);
+ Decoded decoded = new NormalizedNodeToNodeCodec(null).decode(o.getPath(), o.getData());
+ return new MergeModification(decoded.getDecodedPath(), decoded.getDecodedNode());
+ }
+
+ public static MergeModification fromStream(ObjectInput in) throws ClassNotFoundException, IOException {
+ MergeModification mod = new MergeModification();
+ mod.readExternal(in);
+ return mod;