Merge "Fixed for bug 1197"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / ModifyData.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.cluster.datastore.messages;
10
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
15
16 public abstract class ModifyData implements SerializableMessage {
17     protected final YangInstanceIdentifier path;
18     protected final NormalizedNode<?, ?> data;
19     protected final SchemaContext schemaContext;
20
21     public ModifyData(YangInstanceIdentifier path, NormalizedNode<?, ?> data,
22         SchemaContext context) {
23         Preconditions.checkNotNull(context,
24             "Cannot serialize an object which does not have a schema schemaContext");
25
26
27         this.path = path;
28         this.data = data;
29         this.schemaContext = context;
30     }
31
32     public YangInstanceIdentifier getPath() {
33         return path;
34     }
35
36     public NormalizedNode<?, ?> getData() {
37         return data;
38     }
39
40 }