2 * Copyright (c) 2015 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.messages;
10 import akka.actor.ActorRef;
11 import com.google.common.base.Preconditions;
12 import java.io.Externalizable;
13 import java.io.IOException;
14 import java.io.ObjectInput;
15 import java.io.ObjectOutput;
16 import org.opendaylight.controller.cluster.datastore.utils.SerializationUtils;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 * Request a {@link org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener} registration be made on the shard
23 public final class RegisterDataTreeChangeListener implements Externalizable, ListenerRegistrationMessage {
24 private static final long serialVersionUID = 1L;
25 private ActorRef dataTreeChangeListenerPath;
26 private YangInstanceIdentifier path;
27 private boolean registerOnAllInstances;
29 public RegisterDataTreeChangeListener(final YangInstanceIdentifier path, final ActorRef dataTreeChangeListenerPath,
30 final boolean registerOnAllInstances) {
31 this.path = Preconditions.checkNotNull(path);
32 this.dataTreeChangeListenerPath = Preconditions.checkNotNull(dataTreeChangeListenerPath);
33 this.registerOnAllInstances = registerOnAllInstances;
37 public YangInstanceIdentifier getPath() {
41 public ActorRef getDataTreeChangeListenerPath() {
42 return dataTreeChangeListenerPath;
46 public boolean isRegisterOnAllInstances() {
47 return registerOnAllInstances;
51 public void writeExternal(final ObjectOutput out) throws IOException {
52 out.writeObject(dataTreeChangeListenerPath);
53 SerializationUtils.serializePath(path, out);
54 out.writeBoolean(registerOnAllInstances);
58 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
59 dataTreeChangeListenerPath = (ActorRef) in.readObject();
60 path = SerializationUtils.deserializePath(in);
61 registerOnAllInstances = in.readBoolean();