X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmessages%2FPrimaryShardInfo.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmessages%2FPrimaryShardInfo.java;h=bbeb1aa84bbe728ffe073e9a3cc5402161fde676;hb=9d77fd7cf8aa00f063ed4a7875738f53b92518e9;hp=0000000000000000000000000000000000000000;hpb=e20fff4d018e95cefd1934d2be31e5cd692fe7fa;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java new file mode 100644 index 0000000000..bbeb1aa84b --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/PrimaryShardInfo.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.cluster.datastore.messages; + +import akka.actor.ActorSelection; +import com.google.common.base.Optional; +import com.google.common.base.Preconditions; +import javax.annotation.Nonnull; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree; + +/** + * Local message DTO that contains information about the primary shard. + * + * @author Thomas Pantelis + */ +public class PrimaryShardInfo { + private final ActorSelection primaryShardActor; + private final Optional localShardDataTree; + + public PrimaryShardInfo(@Nonnull ActorSelection primaryShardActor, @Nonnull Optional localShardDataTree) { + this.primaryShardActor = Preconditions.checkNotNull(primaryShardActor); + this.localShardDataTree = Preconditions.checkNotNull(localShardDataTree); + } + + /** + * Returns an ActorSelection representing the primary shard actor. + */ + public @Nonnull ActorSelection getPrimaryShardActor() { + return primaryShardActor; + } + + /** + * Returns an Optional whose value contains the primary shard's DataTree if the primary shard is local + * to the caller. Otherwise the Optional value is absent. + */ + public @Nonnull Optional getLocalShardDataTree() { + return localShardDataTree; + } +}