/* * The contents of this file are subject to the terms of the Common Development and * Distribution License (the License). You may not use this file except in compliance with the * License. * * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the * specific language governing permission and limitations under the License. * * When distributing Covered Software, include this CDDL Header Notice in each file and include * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions Copyright [year] [name of copyright owner]". * * Copyright 2006-2010 Sun Microsystems, Inc. * Portions Copyright 2011-2015 ForgeRock AS. */ package org.opends.server.replication.protocol; /** * The version utility class for the replication protocol. */ public class ProtocolVersion { /** * The constant for the first historical version of the replication protocol. */ public static final short REPLICATION_PROTOCOL_V1 = 1; /** * The constant for the real value of the first historical version of the * replication protocol (was used in start messages only). */ public static final short REPLICATION_PROTOCOL_V1_REAL = 49; /** * The constant for the second version of the replication protocol. * */ public static final short REPLICATION_PROTOCOL_V2 = 2; /** * The constant for the 3rd version of the replication protocol. * */ public static final short REPLICATION_PROTOCOL_V3 = 3; /** * The constant for the 4th version of the replication protocol. * */ public static final short REPLICATION_PROTOCOL_V4 = 4; /** * The constant for the 5th version of the replication protocol. * */ public static final short REPLICATION_PROTOCOL_V5 = 5; /** * The constant for the 6th version of the replication protocol. * */ public static final short REPLICATION_PROTOCOL_V6 = 6; /** * The constant for the 7th version of the replication protocol. * */ public static final short REPLICATION_PROTOCOL_V7 = 7; /** * The constant for the 8th version of the replication protocol. * */ public static final short REPLICATION_PROTOCOL_V8 = 8; /** * The replication protocol version used by the instance of RS/DS in this VM. */ private static final short CURRENT_VERSION = REPLICATION_PROTOCOL_V8; /** * Gets the current version of the replication protocol. * * @return The current version of the protocol. */ public static short getCurrentVersion() { return CURRENT_VERSION; } /** * Specifies the oldest version of the protocol from the provided one * and the current one. * * @param version The version to be compared to the current one. * @return The minimal protocol version. */ public static short getCompatibleVersion(short version) { return version < CURRENT_VERSION ? version : CURRENT_VERSION; } }