Changed es version from string to class Version

This commit is contained in:
Martijn van Groningen 2012-12-06 15:35:30 +01:00
parent 22f99e848f
commit 966fdfdfb8
1 changed files with 7 additions and 6 deletions

View File

@ -20,6 +20,7 @@
package org.elasticsearch.action.admin.cluster.node.info; package org.elasticsearch.action.admin.cluster.node.info;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.nodes.NodeOperationResponse; import org.elasticsearch.action.support.nodes.NodeOperationResponse;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
@ -49,7 +50,7 @@ public class NodeInfo extends NodeOperationResponse {
@Nullable @Nullable
private String hostname; private String hostname;
private String version; private Version version;
@Nullable @Nullable
private Settings settings; private Settings settings;
@ -78,7 +79,7 @@ public class NodeInfo extends NodeOperationResponse {
NodeInfo() { NodeInfo() {
} }
public NodeInfo(@Nullable String hostname, String version, DiscoveryNode node, @Nullable ImmutableMap<String, String> serviceAttributes, @Nullable Settings settings, public NodeInfo(@Nullable String hostname, Version version, DiscoveryNode node, @Nullable ImmutableMap<String, String> serviceAttributes, @Nullable Settings settings,
@Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable NetworkInfo network, @Nullable OsInfo os, @Nullable ProcessInfo process, @Nullable JvmInfo jvm, @Nullable ThreadPoolInfo threadPool, @Nullable NetworkInfo network,
@Nullable TransportInfo transport, @Nullable HttpInfo http) { @Nullable TransportInfo transport, @Nullable HttpInfo http) {
super(node); super(node);
@ -114,14 +115,14 @@ public class NodeInfo extends NodeOperationResponse {
/** /**
* The current ES version * The current ES version
*/ */
public String version() { public Version version() {
return version; return version;
} }
/** /**
* The current ES version * The current ES version
*/ */
public String getVersion() { public Version getVersion() {
return version(); return version();
} }
@ -263,7 +264,7 @@ public class NodeInfo extends NodeOperationResponse {
if (in.readBoolean()) { if (in.readBoolean()) {
hostname = in.readUTF(); hostname = in.readUTF();
} }
version = in.readOptionalString(); version = Version.readVersion(in);
if (in.readBoolean()) { if (in.readBoolean()) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
int size = in.readVInt(); int size = in.readVInt();
@ -307,7 +308,7 @@ public class NodeInfo extends NodeOperationResponse {
out.writeBoolean(true); out.writeBoolean(true);
out.writeUTF(hostname); out.writeUTF(hostname);
} }
out.writeOptionalString(version); out.writeVInt(version.id);
if (serviceAttributes() == null) { if (serviceAttributes() == null) {
out.writeBoolean(false); out.writeBoolean(false);
} else { } else {