/* * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.controller.cluster.datastore.messages; import akka.actor.ActorPath; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.serialization.Serialization; import org.opendaylight.controller.protobuff.messages.registration.ListenerRegistrationMessages; public class RegisterChangeListenerReply implements SerializableMessage{ public static final Class SERIALIZABLE_CLASS = ListenerRegistrationMessages.RegisterChangeListenerReply.class; private final ActorRef listenerRegistration; public RegisterChangeListenerReply(final ActorRef listenerRegistration) { this.listenerRegistration = listenerRegistration; } public ActorPath getListenerRegistrationPath() { return listenerRegistration.path(); } @Override public ListenerRegistrationMessages.RegisterChangeListenerReply toSerializable() { return ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder() .setListenerRegistrationPath(Serialization.serializedActorPath(listenerRegistration)).build(); } public static RegisterChangeListenerReply fromSerializable(final ActorSystem actorSystem,final Object serializable){ ListenerRegistrationMessages.RegisterChangeListenerReply o = (ListenerRegistrationMessages.RegisterChangeListenerReply) serializable; return new RegisterChangeListenerReply( actorSystem.provider().resolveActorRef(o.getListenerRegistrationPath()) ); } }