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.datastore.actors.client;
10 import akka.actor.ActorSystem;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
16 * @author Robert Varga
18 final class InitialClientActorContext extends AbstractClientActorContext {
19 private final AbstractClientActor actor;
21 InitialClientActorContext(final AbstractClientActor actor, final String persistenceId) {
22 super(actor.self(), persistenceId);
23 this.actor = Preconditions.checkNotNull(actor);
26 void saveSnapshot(final ClientIdentifier snapshot) {
27 actor.saveSnapshot(snapshot);
30 ClientActorBehavior createBehavior(final ClientIdentifier clientId) {
31 final ActorSystem system = actor.getContext().system();
32 final ClientActorContext context = new ClientActorContext(self(), system.scheduler(), system.dispatcher(),
33 persistenceId(), clientId);
35 return actor.initialBehavior(context);