2 * Copyright (c) 2014 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.dummy.datastore;
10 import akka.actor.Props;
11 import akka.actor.UntypedAbstractActor;
13 public final class DummyShardManager extends UntypedAbstractActor {
14 public DummyShardManager(final Configuration configuration, final String memberName, final String[] shardNames,
16 new DummyShardsCreator(configuration, getContext(), memberName, shardNames, type).create();
20 public void onReceive(final Object message) {
24 public static Props props(final Configuration configuration, final String memberName, final String[] shardNames,
26 return Props.create(DummyShardManager.class, configuration, memberName, shardNames, type);
29 private static class DummyShardsCreator {
30 private final Configuration configuration;
31 private final ActorContext actorSystem;
32 private final String memberName;
33 private final String[] shardNames;
34 private final String type;
36 DummyShardsCreator(final Configuration configuration, final ActorContext actorSystem, final String memberName,
37 final String[] shardNames, final String type) {
38 this.configuration = configuration;
39 this.actorSystem = actorSystem;
40 this.memberName = memberName;
41 this.shardNames = shardNames;
46 for (String shardName : shardNames) {
47 String shardId = memberName + "-shard-" + shardName + "-" + type;
48 actorSystem.actorOf(DummyShard.props(configuration, shardId), shardId);