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 static java.util.Objects.requireNonNull;
12 import akka.actor.ActorPath;
13 import akka.actor.ActorRef;
14 import java.io.Externalizable;
15 import java.io.IOException;
16 import java.io.ObjectInput;
17 import java.io.ObjectOutput;
18 import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
22 * Request a {@link org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener} registration be made on the
25 public final class RegisterDataTreeChangeListener implements Externalizable {
26 private static final long serialVersionUID = 1L;
28 private ActorRef dataTreeChangeListenerPath;
29 private YangInstanceIdentifier path;
30 private boolean registerOnAllInstances;
32 public RegisterDataTreeChangeListener() {
36 public RegisterDataTreeChangeListener(final YangInstanceIdentifier path, final ActorRef dataTreeChangeListenerPath,
37 final boolean registerOnAllInstances) {
38 this.path = requireNonNull(path);
39 this.dataTreeChangeListenerPath = requireNonNull(dataTreeChangeListenerPath);
40 this.registerOnAllInstances = registerOnAllInstances;
43 public YangInstanceIdentifier getPath() {
47 public ActorPath getListenerActorPath() {
48 return dataTreeChangeListenerPath.path();
51 public boolean isRegisterOnAllInstances() {
52 return registerOnAllInstances;
56 public void writeExternal(final ObjectOutput out) throws IOException {
57 out.writeObject(dataTreeChangeListenerPath);
58 SerializationUtils.writePath(out, path);
59 out.writeBoolean(registerOnAllInstances);
63 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
64 dataTreeChangeListenerPath = (ActorRef) in.readObject();
65 path = SerializationUtils.readPath(in);
66 registerOnAllInstances = in.readBoolean();
70 public String toString() {
71 return "RegisterDataTreeChangeListener [path=" + path + ", registerOnAllInstances=" + registerOnAllInstances
72 + ", dataTreeChangeListenerPath=" + dataTreeChangeListenerPath + "]";