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 akka.persistence.SnapshotSelectionCriteria;
12 import com.google.common.base.Preconditions;
13 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
17 * @author Robert Varga
19 final class InitialClientActorContext extends AbstractClientActorContext {
20 private final AbstractClientActor actor;
22 InitialClientActorContext(final AbstractClientActor actor, final String persistenceId) {
23 super(actor.self(), persistenceId);
24 this.actor = Preconditions.checkNotNull(actor);
27 void saveSnapshot(final ClientIdentifier snapshot) {
28 actor.saveSnapshot(snapshot);
31 void deleteSnapshots(SnapshotSelectionCriteria criteria) {
32 actor.deleteSnapshots(criteria);
35 ClientActorBehavior createBehavior(final ClientIdentifier clientId) {
36 final ActorSystem system = actor.getContext().system();
37 final ClientActorContext context = new ClientActorContext(self(), system.scheduler(), system.dispatcher(),
38 persistenceId(), clientId);
40 return actor.initialBehavior(context);