X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDataTreeCandidatePayload.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDataTreeCandidatePayload.java;h=0000000000000000000000000000000000000000;hp=d11ce38d72e7a6edd60711d446f268c90e457569;hb=5c08efbf3a3d046a7650f1b32a6cacfb1e4a6d0d;hpb=3eee17a3bbd0f7ca65aa812164b0fe3df7b79cfc diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java deleted file mode 100644 index d11ce38d72..0000000000 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeCandidatePayload.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2015 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; - -import com.google.common.base.Preconditions; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; -import java.io.Externalizable; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectOutput; -import org.opendaylight.controller.cluster.datastore.persisted.DataTreeCandidateInputOutput; -import org.opendaylight.controller.cluster.raft.persisted.MigratedSerializable; -import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate; - -/** - * Payload wrapper for a DataTreeCandidatePayload. - * - * @deprecated Deprecated in Boron in favor of CommitTransactionPayload - */ -@Deprecated -final class DataTreeCandidatePayload extends Payload implements Externalizable, MigratedSerializable { - private static final long serialVersionUID = 1L; - - private transient byte[] serialized; - - // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't - // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection. - @SuppressWarnings("checkstyle:RedundantModifier") - public DataTreeCandidatePayload() { - // Required by Externalizable - } - - private DataTreeCandidatePayload(final byte[] serialized) { - this.serialized = Preconditions.checkNotNull(serialized); - } - - /** - * Creates a DataTreeCandidatePayload. - * - * @deprecated Use CommitTransactionPayload instead - */ - @Deprecated - static DataTreeCandidatePayload create(final DataTreeCandidate candidate) { - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - try { - DataTreeCandidateInputOutput.writeDataTreeCandidate(out, candidate); - } catch (IOException e) { - throw new IllegalArgumentException(String.format("Failed to serialize candidate %s", candidate), e); - } - - return new DataTreeCandidatePayload(out.toByteArray()); - } - - public DataTreeCandidate getCandidate() throws IOException { - return DataTreeCandidateInputOutput.readDataTreeCandidate(ByteStreams.newDataInput(serialized)); - } - - @Override - public int size() { - return serialized.length; - } - - @Override - public void writeExternal(final ObjectOutput out) throws IOException { - out.writeByte((byte)serialVersionUID); - out.writeInt(serialized.length); - out.write(serialized); - } - - @Override - public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { - final long version = in.readByte(); - Preconditions.checkArgument(version == serialVersionUID, "Unsupported serialization version %s", version); - - final int length = in.readInt(); - serialized = new byte[length]; - in.readFully(serialized); - } - - @Override - public boolean isMigrated() { - return true; - } - - @Deprecated - @Override - public Object writeReplace() { - // this is fine - return this; - } -}