2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.cluster.databroker.actors.dds;
10 import akka.actor.Props;
11 import com.google.common.base.Preconditions;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.controller.cluster.access.client.AbstractClientActor;
14 import org.opendaylight.controller.cluster.access.client.ClientActorContext;
15 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
16 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
17 import org.opendaylight.controller.cluster.access.concepts.MemberName;
18 import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
21 * A {@link AbstractClientActor} which acts as the point of contact for DistributedDataStore.
23 * @author Robert Varga
25 public final class SimpleDataStoreClientActor extends AbstractDataStoreClientActor {
26 private final String shardName;
28 private SimpleDataStoreClientActor(final FrontendIdentifier frontendId, final ActorContext actorContext,
29 final String shardName) {
30 super(frontendId, actorContext);
31 this.shardName = Preconditions.checkNotNull(shardName);
35 AbstractDataStoreClientBehavior initialBehavior(final ClientActorContext context, final ActorContext actorContext) {
36 return new SimpleDataStoreClientBehavior(context, actorContext, shardName);
39 public static Props props(@Nonnull final MemberName memberName, @Nonnull final String storeName,
40 final ActorContext ctx, final String shardName) {
41 final String name = "datastore-" + storeName;
42 final FrontendIdentifier frontendId = FrontendIdentifier.create(memberName, FrontendType.forName(name));
43 return Props.create(SimpleDataStoreClientActor.class,
44 () -> new SimpleDataStoreClientActor(frontendId, ctx, shardName));