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
9 package org.opendaylight.controller.dummy.datastore;
11 import akka.actor.ActorContext;
12 import akka.actor.Props;
13 import akka.actor.UntypedActor;
15 public class DummyShardManager extends UntypedActor {
16 public DummyShardManager(Configuration configuration, String memberName, String[] shardNames,
18 new DummyShardsCreator(configuration, context(), memberName, shardNames, type).create();
22 public void onReceive(Object message) {
26 public static Props props(Configuration configuration, String memberName, String[] shardNames, String type) {
27 return Props.create(DummyShardManager.class, configuration, memberName, shardNames, type);
30 private static class DummyShardsCreator {
31 private final Configuration configuration;
32 private final ActorContext actorSystem;
33 private final String memberName;
34 private final String[] shardNames;
35 private final String type;
37 DummyShardsCreator(Configuration configuration, ActorContext actorSystem, String memberName,
38 String[] shardNames, String type) {
39 this.configuration = configuration;
40 this.actorSystem = actorSystem;
41 this.memberName = memberName;
42 this.shardNames = shardNames;
47 for (String shardName : shardNames) {
48 String shardId = memberName + "-shard-" + shardName + "-" + type;
49 actorSystem.actorOf(DummyShard.props(configuration, shardId), shardId);