2 * Copyright (c) 2014 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
9 package org.opendaylight.controller.cluster.datastore.messages;
11 import akka.actor.ActorPath;
12 import akka.actor.ActorRef;
13 import akka.actor.ActorSystem;
14 import akka.serialization.Serialization;
15 import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages;
17 public class RegisterChangeListenerReply implements SerializableMessage{
18 public static final Class<ListenerRegistrationMessages.RegisterChangeListenerReply> SERIALIZABLE_CLASS =
19 ListenerRegistrationMessages.RegisterChangeListenerReply.class;
20 private final ActorRef listenerRegistration;
22 public RegisterChangeListenerReply(final ActorRef listenerRegistration) {
23 this.listenerRegistration = listenerRegistration;
26 public ActorPath getListenerRegistrationPath() {
27 return listenerRegistration.path();
31 public ListenerRegistrationMessages.RegisterChangeListenerReply toSerializable() {
32 return ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder()
33 .setListenerRegistrationPath(Serialization.serializedActorPath(listenerRegistration)).build();
36 public static RegisterChangeListenerReply fromSerializable(final ActorSystem actorSystem,final Object serializable){
37 ListenerRegistrationMessages.RegisterChangeListenerReply o = (ListenerRegistrationMessages.RegisterChangeListenerReply) serializable;
38 return new RegisterChangeListenerReply(
39 actorSystem.provider().resolveActorRef(o.getListenerRegistrationPath())