Commit b1badd92 authored by chiaming2000's avatar chiaming2000
Browse files

Added API to obtain current client library supported protocol version.

Application may obtain the Java client supported protocol version
through the ClientConfiguration.getProtocolVersion() API.
parent 19fcf137
Loading
Loading
Loading
Loading
+31 −18
Original line number Diff line number Diff line
@@ -44,6 +44,16 @@ public class ClientConfiguration extends Properties {
	// default request timeout is set to 30000 milli seconds
	private static final long DEFAULT_REQUEST_TIMEOUT = 30000L;
	
	 /**
     * current supported kinetic protocol version on kinetic-protocol repo.
     */
    public static final String PROTOCOL_VERSION = "2.0.2";
    
    /**
     * current supported protocol source commit hash on kinetic-protocol repo.
     */
    public static final String PROTOCOL_SOURCE_HASH = "f6e21e281272b46c620284781cdb3a36a6c7a564";

	// kinetic server host
	private String host = "localhost";

@@ -418,23 +428,26 @@ public class ClientConfiguration extends Properties {
	}

	/**
	 * Get if v2 protocol is used to established the connection.
	 * <p>
     * Get Kinetic protocol version supported by the current API implementation.  
     * The protocol version is defined at the kinetic-protocol repository.
     *
     * @return Kinetic protocol version supported by the current API implementation. 
     * 
	 * @return true if v2 protocol is used.
     * @see <a href="https://github.com/Seagate/kinetic-protocol">kinetic-protocol</a>
     */
	//public boolean getUseV2Protocol() {
	//	return this.useV2Protocol;
	//}
    public static String getProtocolVersion() {
        return PROTOCOL_VERSION;
    }

    /**
	 * Set if v2 protocol is to be used to communicate with the simulator/drive.
     * Get the supported protocol source commit hash at the kinetic-protocol repository.
     * 
	 * @param flag
	 *            true if v2 protocol is used.
     * @return protocol source commit hash value at the kinetic-protocol repository.
     * 
     * @see <a href="https://github.com/Seagate/kinetic-protocol">kinetic-protocol</a>
     */
	//public void setUseV2Protocol(boolean flag) {
	//	this.useV2Protocol = flag;
	//}
    public static String getProtocolSourceHash() {
        return PROTOCOL_SOURCE_HASH;
    }

}
+27 −67
Original line number Diff line number Diff line
@@ -189,24 +189,24 @@ public class SimulatorConfiguration extends Properties {
    private static int maxMessageSize = -1;
    
    /**
     * simulator version.
     * current simulator version.
     */
    private static String simulatorVersion = "0.6.0.3-SNAPSHOT";
    public static final String SIMULATOR_VERSION = "0.6.0.3-SNAPSHOT";
    
    /**
     * simulator source commit hash.
     */
    private static String simulatorSourceHash = "e012f899368372a958f3962bd75bd87becbc35b1";
    public static final String SIMULATOR_SOURCE_HASH = "e012f899368372a958f3962bd75bd87becbc35b1";
    
    /**
     * protocol version.
     * current supported protocol version defined at kinetic-protocol repository.
     */
    private static String protocolVersion = "2.0.2";
    public static final String PROTOCOL_VERSION = "2.0.2";
    
    /**
     * protocol source commit hash.
     * current supported protocol source commit hash value obtained from kinetic-protocol repository.
     */
    private static String protocolSourceHash = "f6e21e281272b46c620284781cdb3a36a6c7a564";
    public static final String PROTOCOL_SOURCE_HASH = "f6e21e281272b46c620284781cdb3a36a6c7a564";
    
    /**
     * heart beat provider.
@@ -749,90 +749,50 @@ public class SimulatorConfiguration extends Properties {
    }

    /**
     * Get simulator version.
     * Get the current simulator version.
     *
     * Returns simulator version now.
     *
     * @return default value
     * @return current simulator version.
     */
    public static String getSimulatorVersion() {
        return simulatorVersion;
        return SIMULATOR_VERSION;
    }

    /**
     * Set simulator version now, in string.
     *
     * @param simulatorVersion
     *            set simulator version.
     */
    public static void setSimulatorVersion(String simulatorVersion) {
        SimulatorConfiguration.simulatorVersion = simulatorVersion;
    }

    /**
     * Get simulator source hash.
     * 
     * Returns simulator source hash now.
     * Get the simulator source commit hash at he github repository.
     *
     * @return default value 
     * @return simulator source hash commit value
     * @see <a href="https://github.com/Seagate/kinetic-protocol">kinetic-java</a>
     */
    public static String getSimulatorSourceHash() {
        return simulatorSourceHash;
        return SIMULATOR_SOURCE_HASH;
    }

    /**
     * Set simulator source hash now, in string.
     *
     * @param simulatorSourceHash
     *            set simulator source hash.
     */
    public static void setSimulatorSourceHash(String simulatorSourceHash) {
        SimulatorConfiguration.simulatorSourceHash = simulatorSourceHash;
    }

    /**
     * Get protocol file version.
     * Get Kinetic protocol version supported by the current API implementation.  
     * The protocol version is defined at the kinetic-protocol repository.
     * <p>
     * <a href="https://github.com/Seagate/kinetic-protocol">kinetic-protocol</a>
     * <p>
     *
     * Returns protocol file now.
     * @return Kinetic protocol version supported by the current API implementation. 
     * 
     * @return default value 
     * @see <a href="https://github.com/Seagate/kinetic-protocol">kinetic-protocol</a>
     */
    public static String getProtocolVersion() {
        return protocolVersion;
    }

    /**
     * Set protocol file version now, in string.
     *
     * @param protocolVersion
     *            set protocol file version.
     */
    public static void setProtocolVersion(String protocolVersion) {
        SimulatorConfiguration.protocolVersion = protocolVersion;
        return PROTOCOL_VERSION;
    }

    /**
     * Get protocol file source hash.
     * Get the supported protocol source commit hash at the kinetic-protocol repository.
     * 
     * Returns protocol file source hash now.
     * @return protocol source commit hash value at the kinetic-protocol repository.
     * 
     * @return default value 
     * @see <a href="https://github.com/Seagate/kinetic-protocol">kinetic-protocol</a>
     */
    public static String getProtocolSourceHash() {
        return protocolSourceHash;
        return PROTOCOL_SOURCE_HASH;
    }

    /**
     * Set protocol source hash now, in string.
     *
     * @param protocolSourceHash
     *            set protocol source hash.
     */
    public static void setProtocolSourceHash(String protocolSourceHash) {
        SimulatorConfiguration.protocolSourceHash = protocolSourceHash;
    }


	/**
	 * Set the heartbeat provider for the simulator.
	 *