Merge "BUG-2288: deprecate old binding Notification API elements"
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / messages / LocalPrimaryShardFound.java
1 /*
2  * Copyright (c) 2015 Brocade Communications 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 package org.opendaylight.controller.cluster.datastore.messages;
9
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12 import org.apache.commons.lang3.ObjectUtils;
13 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
14
15 /**
16  * Local message sent in reply to FindPrimaryShard to indicate the primary shard is local to the caller.
17  *
18  * @author Thomas Pantelis
19  */
20 public class LocalPrimaryShardFound {
21
22     private final String primaryPath;
23     private final DataTree localShardDataTree;
24
25     public LocalPrimaryShardFound(@Nonnull String primaryPath, @Nonnull DataTree localShardDataTree) {
26         this.primaryPath = Preconditions.checkNotNull(primaryPath);
27         this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree);
28     }
29
30     public @Nonnull String getPrimaryPath() {
31         return primaryPath;
32     }
33
34     public @Nonnull DataTree getLocalShardDataTree() {
35         return localShardDataTree;
36     }
37
38     @Override
39     public String toString() {
40         StringBuilder builder = new StringBuilder();
41         builder.append("LocalPrimaryShardFound [primaryPath=").append(primaryPath).append(", localShardDataTree=")
42                 .append(ObjectUtils.identityToString(localShardDataTree)).append("]");
43         return builder.toString();
44     }
45 }