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 static java.util.Objects.requireNonNull;
12 import akka.actor.Props;
13 import javax.annotation.Nonnull;
14 import org.opendaylight.controller.cluster.access.client.AbstractClientActor;
15 import org.opendaylight.controller.cluster.access.client.ClientActorContext;
16 import org.opendaylight.controller.cluster.access.concepts.FrontendIdentifier;
17 import org.opendaylight.controller.cluster.access.concepts.FrontendType;
18 import org.opendaylight.controller.cluster.access.concepts.MemberName;
19 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
22 * A {@link AbstractClientActor} which acts as the point of contact for DistributedDataStore.
24 * @author Robert Varga
26 public final class SimpleDataStoreClientActor extends AbstractDataStoreClientActor {
27 private final String shardName;
29 private SimpleDataStoreClientActor(final FrontendIdentifier frontendId, final ActorUtils actorUtils,
30 final String shardName) {
31 super(frontendId, actorUtils);
32 this.shardName = requireNonNull(shardName);
36 AbstractDataStoreClientBehavior initialBehavior(final ClientActorContext context, final ActorUtils actorUtils) {
37 return new SimpleDataStoreClientBehavior(context, actorUtils, shardName);
40 public static Props props(@Nonnull final MemberName memberName, @Nonnull final String storeName,
41 final ActorUtils actorUtils, final String shardName) {
42 final String name = "datastore-" + storeName;
43 final FrontendIdentifier frontendId = FrontendIdentifier.create(memberName, FrontendType.forName(name));
44 return Props.create(SimpleDataStoreClientActor.class,
45 () -> new SimpleDataStoreClientActor(frontendId, actorUtils, shardName));