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.access.client;
10 import static java.util.Objects.requireNonNull;
12 import akka.actor.ActorSystem;
13 import akka.persistence.SnapshotSelectionCriteria;
14 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
17 * The initial context for an actor.
19 * @author Robert Varga
21 final class InitialClientActorContext extends AbstractClientActorContext {
22 private final AbstractClientActor actor;
24 InitialClientActorContext(final AbstractClientActor actor, final String persistenceId) {
25 super(actor.self(), persistenceId);
26 this.actor = requireNonNull(actor);
29 void saveSnapshot(final ClientIdentifier snapshot) {
30 actor.saveSnapshot(snapshot);
33 void deleteSnapshots(final SnapshotSelectionCriteria criteria) {
34 actor.deleteSnapshots(criteria);
37 ClientActorBehavior<?> createBehavior(final ClientIdentifier clientId) {
38 final ActorSystem system = actor.getContext().system();
39 final ClientActorContext context = new ClientActorContext(self(), persistenceId(), system,
40 clientId, actor.getClientActorConfig());
42 return actor.initialBehavior(context);