636dd1e34f576d70842f288efe755ed12ac2b86f
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / actors / client / InitialClientActorContext.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.datastore.actors.client;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
12
13 /**
14  *
15  * @author Robert Varga
16  */
17 final class InitialClientActorContext extends AbstractClientActorContext {
18     private final AbstractClientActor actor;
19
20     InitialClientActorContext(final AbstractClientActor actor, final String persistenceId) {
21         super(actor.self(), persistenceId);
22         this.actor = Preconditions.checkNotNull(actor);
23     }
24
25     void saveSnapshot(final ClientIdentifier snapshot) {
26         actor.saveSnapshot(snapshot);
27     }
28
29     ClientActorBehavior createBehavior(final ClientActorContext context) {
30         return actor.initialBehavior(context);
31     }
32
33     void stash() {
34         actor.stash();
35     }
36
37     void unstash() {
38         actor.unstashAll();
39     }
40 }