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.access.commands;
10 import akka.actor.ActorRef;
11 import java.io.DataInput;
12 import java.io.IOException;
13 import java.io.ObjectInput;
14 import java.io.ObjectOutput;
15 import org.opendaylight.controller.cluster.access.ABIVersion;
16 import org.opendaylight.controller.cluster.access.concepts.AbstractRequestProxy;
17 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
18 import org.opendaylight.yangtools.concepts.WritableObjects;
21 * Externalizable proxy for use with {@link ConnectClientRequest}. It implements the initial (Boron) serialization
24 * @author Robert Varga
26 final class ConnectClientRequestProxyV1 extends AbstractRequestProxy<ClientIdentifier, ConnectClientRequest> {
27 private ABIVersion minVersion;
28 private ABIVersion maxVersion;
29 private long resumeSequence;
31 public ConnectClientRequestProxyV1() {
35 ConnectClientRequestProxyV1(final ConnectClientRequest request) {
37 this.minVersion = request.getMinVersion();
38 this.maxVersion = request.getMaxVersion();
39 this.resumeSequence = request.getResumeSequence();
43 public void writeExternal(final ObjectOutput out) throws IOException {
44 super.writeExternal(out);
45 minVersion.writeTo(out);
46 maxVersion.writeTo(out);
47 WritableObjects.writeLong(out, resumeSequence);
51 public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
52 super.readExternal(in);
53 minVersion = ABIVersion.inexactReadFrom(in);
54 maxVersion = ABIVersion.inexactReadFrom(in);
55 resumeSequence = WritableObjects.readLong(in);
59 protected ConnectClientRequest createRequest(final ClientIdentifier target, final ActorRef replyTo) {
60 return new ConnectClientRequest(target, replyTo, minVersion, maxVersion, resumeSequence);
64 protected ClientIdentifier readTarget(final DataInput in) throws IOException {
65 return ClientIdentifier.readFrom(in);