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 com.google.common.annotations.Beta;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
14 import org.opendaylight.yangtools.concepts.Identifiable;
17 * A behavior, which handles messages sent to a {@link AbstractClientActor}.
19 * @param <T> Frontend type
21 * @author Robert Varga
24 public abstract class ClientActorBehavior extends RecoveredClientActorBehavior<ClientActorContext>
25 implements Identifiable<ClientIdentifier> {
26 protected ClientActorBehavior(final @Nonnull ClientActorContext context) {
31 final ClientActorBehavior onReceiveCommand(final Object command) {
32 // TODO: any client-common logic (such as validation and common dispatch) needs to go here
33 return onCommand(command);
37 public final @Nonnull ClientIdentifier getIdentifier() {
38 return context().getIdentifier();
42 * Override this method to handle any command which is not handled by the base behavior.
45 * @return Next behavior to use, null if this actor should shut down.
47 protected abstract @Nullable ClientActorBehavior onCommand(@Nonnull Object command);