X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmessages%2FFindPrimary.java;h=f584467ee91b37f2b0866cb9a39556eba3c9ace8;hp=0920c284ad5206a2678697d14447a4cf11e38cf2;hb=c222e37f2a0f0f3f6266242fbea2d3b018f4e6e3;hpb=0bdf3307bc17f562c84cceeacd29f42409bfff34 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java index 0920c284ad..f584467ee9 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/FindPrimary.java @@ -1,13 +1,22 @@ +/* + * Copyright (c) 2014 Cisco 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 com.google.common.base.Preconditions; +import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages; /** * The FindPrimary message is used to locate the primary of any given shard * - * TODO : Make this serializable */ -public class FindPrimary{ +public class FindPrimary implements SerializableMessage{ + public static final Class SERIALIZABLE_CLASS = ShardManagerMessages.FindPrimary.class; private final String shardName; public FindPrimary(String shardName){ @@ -20,4 +29,13 @@ public class FindPrimary{ public String getShardName() { return shardName; } + + @Override + public Object toSerializable() { + return ShardManagerMessages.FindPrimary.newBuilder().setShardName(shardName).build(); + } + + public static FindPrimary fromSerializable(Object message){ + return new FindPrimary(((ShardManagerMessages.FindPrimary)message).getShardName()); + } }