Merge pull request elastic/elasticsearch#2046 from rjernst/camelcase2

Remove XContentBuilderString

Original commit: elastic/x-pack-elasticsearch@568479e315
This commit is contained in:
Ryan Ernst 2016-04-18 14:55:15 -07:00
commit f5035d3f1e
23 changed files with 168 additions and 202 deletions

View File

@ -13,7 +13,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
@ -315,23 +314,23 @@ public class License implements ToXContent {
version = this.version; version = this.version;
} }
if (restViewMode) { if (restViewMode) {
builder.field(XFields.STATUS, status().label()); builder.field(Fields.STATUS, status().label());
} }
builder.field(XFields.UID, uid); builder.field(Fields.UID, uid);
builder.field(XFields.TYPE, type); builder.field(Fields.TYPE, type);
if (version == VERSION_START) { if (version == VERSION_START) {
builder.field(XFields.SUBSCRIPTION_TYPE, subscriptionType); builder.field(Fields.SUBSCRIPTION_TYPE, subscriptionType);
} }
builder.dateValueField(XFields.ISSUE_DATE_IN_MILLIS, XFields.ISSUE_DATE, issueDate); builder.dateValueField(Fields.ISSUE_DATE_IN_MILLIS, Fields.ISSUE_DATE, issueDate);
if (version == VERSION_START) { if (version == VERSION_START) {
builder.field(XFields.FEATURE, feature); builder.field(Fields.FEATURE, feature);
} }
builder.dateValueField(XFields.EXPIRY_DATE_IN_MILLIS, XFields.EXPIRY_DATE, expiryDate); builder.dateValueField(Fields.EXPIRY_DATE_IN_MILLIS, Fields.EXPIRY_DATE, expiryDate);
builder.field(XFields.MAX_NODES, maxNodes); builder.field(Fields.MAX_NODES, maxNodes);
builder.field(XFields.ISSUED_TO, issuedTo); builder.field(Fields.ISSUED_TO, issuedTo);
builder.field(XFields.ISSUER, issuer); builder.field(Fields.ISSUER, issuer);
if (!licenseSpecMode && !restViewMode && signature != null) { if (!licenseSpecMode && !restViewMode && signature != null) {
builder.field(XFields.SIGNATURE, signature); builder.field(Fields.SIGNATURE, signature);
} }
if (restViewMode) { if (restViewMode) {
builder.humanReadable(previouslyHumanReadable); builder.humanReadable(previouslyHumanReadable);
@ -504,43 +503,27 @@ public class License implements ToXContent {
return result; return result;
} }
final static class Fields { public final static class Fields {
static final String STATUS = "status"; public static final String STATUS = "status";
static final String UID = "uid"; public static final String UID = "uid";
static final String TYPE = "type"; public static final String TYPE = "type";
static final String SUBSCRIPTION_TYPE = "subscription_type"; public static final String SUBSCRIPTION_TYPE = "subscription_type";
static final String ISSUE_DATE_IN_MILLIS = "issue_date_in_millis"; public static final String ISSUE_DATE_IN_MILLIS = "issue_date_in_millis";
static final String ISSUE_DATE = "issue_date"; public static final String ISSUE_DATE = "issue_date";
static final String FEATURE = "feature"; public static final String FEATURE = "feature";
static final String EXPIRY_DATE_IN_MILLIS = "expiry_date_in_millis"; public static final String EXPIRY_DATE_IN_MILLIS = "expiry_date_in_millis";
static final String EXPIRY_DATE = "expiry_date"; public static final String EXPIRY_DATE = "expiry_date";
static final String MAX_NODES = "max_nodes"; public static final String MAX_NODES = "max_nodes";
static final String ISSUED_TO = "issued_to"; public static final String ISSUED_TO = "issued_to";
static final String ISSUER = "issuer"; public static final String ISSUER = "issuer";
static final String VERSION = "version"; public static final String VERSION = "version";
static final String SIGNATURE = "signature"; public static final String SIGNATURE = "signature";
static final String LICENSES = "licenses"; public static final String LICENSES = "licenses";
static final String LICENSE = "license"; public static final String LICENSE = "license";
} }
public interface XFields {
XContentBuilderString STATUS = new XContentBuilderString(Fields.STATUS);
XContentBuilderString UID = new XContentBuilderString(Fields.UID);
XContentBuilderString TYPE = new XContentBuilderString(Fields.TYPE);
XContentBuilderString SUBSCRIPTION_TYPE = new XContentBuilderString(Fields.SUBSCRIPTION_TYPE);
XContentBuilderString ISSUE_DATE_IN_MILLIS = new XContentBuilderString(Fields.ISSUE_DATE_IN_MILLIS);
XContentBuilderString ISSUE_DATE = new XContentBuilderString(Fields.ISSUE_DATE);
XContentBuilderString FEATURE = new XContentBuilderString(Fields.FEATURE);
XContentBuilderString EXPIRY_DATE_IN_MILLIS = new XContentBuilderString(Fields.EXPIRY_DATE_IN_MILLIS);
XContentBuilderString EXPIRY_DATE = new XContentBuilderString(Fields.EXPIRY_DATE);
XContentBuilderString MAX_NODES = new XContentBuilderString(Fields.MAX_NODES);
XContentBuilderString ISSUED_TO = new XContentBuilderString(Fields.ISSUED_TO);
XContentBuilderString ISSUER = new XContentBuilderString(Fields.ISSUER);
XContentBuilderString SIGNATURE = new XContentBuilderString(Fields.SIGNATURE);
}
private static long parseDate(XContentParser parser, String description, boolean endOfTheDay) throws IOException { private static long parseDate(XContentParser parser, String description, boolean endOfTheDay) throws IOException {
if (parser.currentToken() == XContentParser.Token.VALUE_NUMBER) { if (parser.currentToken() == XContentParser.Token.VALUE_NUMBER) {
return parser.longValue(); return parser.longValue();

View File

@ -15,7 +15,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.graph.action.Connection.ConnectionId; import org.elasticsearch.graph.action.Connection.ConnectionId;
import org.elasticsearch.graph.action.Vertex.VertexId; import org.elasticsearch.graph.action.Vertex.VertexId;
@ -149,12 +148,12 @@ public class GraphExploreResponse extends ActionResponse implements ToXContent {
} }
static final class Fields { static final class Fields {
static final XContentBuilderString TOOK = new XContentBuilderString("took"); static final String TOOK = "took";
static final XContentBuilderString TIMED_OUT = new XContentBuilderString("timed_out"); static final String TIMED_OUT = "timed_out";
static final XContentBuilderString INDICES = new XContentBuilderString("_indices"); static final String INDICES = "_indices";
static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); static final String FAILURES = "failures";
static final XContentBuilderString VERTICES = new XContentBuilderString("vertices"); static final String VERTICES = "vertices";
static final XContentBuilderString CONNECTIONS = new XContentBuilderString("connections"); static final String CONNECTIONS = "connections";
} }

View File

@ -11,7 +11,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@ -229,12 +228,12 @@ public class MonitoringDoc implements Writeable<MonitoringDoc> {
} }
static final class Fields { static final class Fields {
static final XContentBuilderString UUID = new XContentBuilderString("uuid"); static final String UUID = "uuid";
static final XContentBuilderString HOST = new XContentBuilderString("host"); static final String HOST = "host";
static final XContentBuilderString TRANSPORT_ADDRESS = new XContentBuilderString("transport_address"); static final String TRANSPORT_ADDRESS = "transport_address";
static final XContentBuilderString IP = new XContentBuilderString("ip"); static final String IP = "ip";
static final XContentBuilderString NAME = new XContentBuilderString("name"); static final String NAME = "name";
static final XContentBuilderString ATTRIBUTES = new XContentBuilderString("attributes"); static final String ATTRIBUTES = "attributes";
} }
} }
} }

View File

@ -13,7 +13,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsException; import org.elasticsearch.common.settings.SettingsException;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils; import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
@ -128,9 +127,9 @@ public abstract class MonitoringIndexNameResolver<T extends MonitoringDoc> {
protected abstract void buildXContent(T document, XContentBuilder builder, ToXContent.Params params) throws IOException; protected abstract void buildXContent(T document, XContentBuilder builder, ToXContent.Params params) throws IOException;
public static final class Fields { public static final class Fields {
public static final XContentBuilderString CLUSTER_UUID = new XContentBuilderString("cluster_uuid"); public static final String CLUSTER_UUID = "cluster_uuid";
public static final XContentBuilderString TIMESTAMP = new XContentBuilderString("timestamp"); public static final String TIMESTAMP = "timestamp";
public static final XContentBuilderString SOURCE_NODE = new XContentBuilderString("source_node"); public static final String SOURCE_NODE = "source_node";
} }
/** /**

View File

@ -10,7 +10,6 @@ import org.elasticsearch.common.collect.MapBuilder;
import org.elasticsearch.common.hash.MessageDigests; import org.elasticsearch.common.hash.MessageDigests;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.license.core.License; import org.elasticsearch.license.core.License;
import org.elasticsearch.marvel.agent.collector.cluster.ClusterInfoMonitoringDoc; import org.elasticsearch.marvel.agent.collector.cluster.ClusterInfoMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -72,14 +71,14 @@ public class ClusterInfoResolver extends MonitoringIndexNameResolver.Data<Cluste
} }
static final class Fields { static final class Fields {
static final XContentBuilderString CLUSTER_NAME = new XContentBuilderString("cluster_name"); static final String CLUSTER_NAME = "cluster_name";
static final XContentBuilderString LICENSE = new XContentBuilderString("license"); static final String LICENSE = "license";
static final XContentBuilderString VERSION = new XContentBuilderString("version"); static final String VERSION = "version";
static final XContentBuilderString CLUSTER_STATS = new XContentBuilderString("cluster_stats"); static final String CLUSTER_STATS = "cluster_stats";
static final XContentBuilderString HKEY = new XContentBuilderString("hkey"); static final String HKEY = "hkey";
static final XContentBuilderString UID = new XContentBuilderString("uid"); static final String UID = "uid";
static final XContentBuilderString TYPE = new XContentBuilderString("type"); static final String TYPE = "type";
} }
} }

View File

@ -8,7 +8,6 @@ package org.elasticsearch.marvel.agent.resolver.cluster;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.cluster.ClusterStateNodeMonitoringDoc; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStateNodeMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -38,8 +37,8 @@ public class ClusterStateNodeResolver extends MonitoringIndexNameResolver.Timest
} }
static final class Fields { static final class Fields {
static final XContentBuilderString STATE_UUID = new XContentBuilderString("state_uuid"); static final String STATE_UUID = "state_uuid";
static final XContentBuilderString NODE = new XContentBuilderString("node"); static final String NODE = "node";
static final XContentBuilderString ID = new XContentBuilderString("id"); static final String ID = "id";
} }
} }

View File

@ -9,7 +9,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.cluster.ClusterStateMonitoringDoc; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStateMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -58,7 +57,7 @@ public class ClusterStateResolver extends MonitoringIndexNameResolver.Timestampe
} }
static final class Fields { static final class Fields {
static final XContentBuilderString CLUSTER_STATE = new XContentBuilderString(TYPE); static final String CLUSTER_STATE = TYPE;
static final XContentBuilderString STATUS = new XContentBuilderString("status"); static final String STATUS = "status";
} }
} }

View File

@ -9,7 +9,6 @@ import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.cluster.ClusterStatsMonitoringDoc; import org.elasticsearch.marvel.agent.collector.cluster.ClusterStatsMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -64,6 +63,6 @@ public class ClusterStatsResolver extends MonitoringIndexNameResolver.Timestampe
} }
static final class Fields { static final class Fields {
static final XContentBuilderString CLUSTER_STATS = new XContentBuilderString(TYPE); static final String CLUSTER_STATS = TYPE;
} }
} }

View File

@ -8,7 +8,6 @@ package org.elasticsearch.marvel.agent.resolver.cluster;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.agent.collector.cluster.DiscoveryNodeMonitoringDoc; import org.elasticsearch.marvel.agent.collector.cluster.DiscoveryNodeMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -55,10 +54,10 @@ public class DiscoveryNodeResolver extends MonitoringIndexNameResolver.Data<Disc
} }
static final class Fields { static final class Fields {
static final XContentBuilderString NODE = new XContentBuilderString(TYPE); static final String NODE = TYPE;
static final XContentBuilderString NAME = new XContentBuilderString("name"); static final String NAME = "name";
static final XContentBuilderString TRANSPORT_ADDRESS = new XContentBuilderString("transport_address"); static final String TRANSPORT_ADDRESS = "transport_address";
static final XContentBuilderString ATTRIBUTES = new XContentBuilderString("attributes"); static final String ATTRIBUTES = "attributes";
static final XContentBuilderString ID = new XContentBuilderString("id"); static final String ID = "id";
} }
} }

View File

@ -9,7 +9,6 @@ import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.indices.recovery.RecoveryState; import org.elasticsearch.indices.recovery.RecoveryState;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.indices.IndexRecoveryMonitoringDoc; import org.elasticsearch.marvel.agent.collector.indices.IndexRecoveryMonitoringDoc;
@ -62,8 +61,8 @@ public class IndexRecoveryResolver extends MonitoringIndexNameResolver.Timestamp
} }
static final class Fields { static final class Fields {
static final XContentBuilderString INDEX_RECOVERY = new XContentBuilderString(TYPE); static final String INDEX_RECOVERY = TYPE;
static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); static final String SHARDS = "shards";
static final XContentBuilderString INDEX_NAME = new XContentBuilderString("index_name"); static final String INDEX_NAME = "index_name";
} }
} }

View File

@ -9,7 +9,6 @@ import org.elasticsearch.action.admin.indices.stats.IndexStats;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.indices.IndexStatsMonitoringDoc; import org.elasticsearch.marvel.agent.collector.indices.IndexStatsMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -106,9 +105,9 @@ public class IndexStatsResolver extends MonitoringIndexNameResolver.Timestamped<
} }
static final class Fields { static final class Fields {
static final XContentBuilderString INDEX_STATS = new XContentBuilderString(TYPE); static final String INDEX_STATS = TYPE;
static final XContentBuilderString INDEX = new XContentBuilderString("index"); static final String INDEX = "index";
static final XContentBuilderString TOTAL = new XContentBuilderString("total"); static final String TOTAL = "total";
static final XContentBuilderString PRIMARIES = new XContentBuilderString("primaries"); static final String PRIMARIES = "primaries";
} }
} }

View File

@ -9,7 +9,6 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.indices.IndicesStatsMonitoringDoc; import org.elasticsearch.marvel.agent.collector.indices.IndicesStatsMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -67,6 +66,6 @@ public class IndicesStatsResolver extends MonitoringIndexNameResolver.Timestampe
} }
static final class Fields { static final class Fields {
static final XContentBuilderString INDICES_STATS = new XContentBuilderString(TYPE); static final String INDICES_STATS = TYPE;
} }
} }

View File

@ -9,7 +9,6 @@ import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.node.NodeStatsMonitoringDoc; import org.elasticsearch.marvel.agent.collector.node.NodeStatsMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -121,11 +120,11 @@ public class NodeStatsResolver extends MonitoringIndexNameResolver.Timestamped<N
} }
static final class Fields { static final class Fields {
static final XContentBuilderString NODE_STATS = new XContentBuilderString(TYPE); static final String NODE_STATS = TYPE;
static final XContentBuilderString NODE_ID = new XContentBuilderString("node_id"); static final String NODE_ID = "node_id";
static final XContentBuilderString NODE_MASTER = new XContentBuilderString("node_master"); static final String NODE_MASTER = "node_master";
static final XContentBuilderString MLOCKALL = new XContentBuilderString("mlockall"); static final String MLOCKALL = "mlockall";
static final XContentBuilderString DISK_THRESHOLD_ENABLED = new XContentBuilderString("disk_threshold_enabled"); static final String DISK_THRESHOLD_ENABLED = "disk_threshold_enabled";
static final XContentBuilderString DISK_THRESHOLD_WATERMARK_HIGH = new XContentBuilderString("disk_threshold_watermark_high"); static final String DISK_THRESHOLD_WATERMARK_HIGH = "disk_threshold_watermark_high";
} }
} }

View File

@ -9,7 +9,6 @@ import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.MonitoredSystem; import org.elasticsearch.marvel.MonitoredSystem;
import org.elasticsearch.marvel.agent.collector.shards.ShardMonitoringDoc; import org.elasticsearch.marvel.agent.collector.shards.ShardMonitoringDoc;
import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver; import org.elasticsearch.marvel.agent.resolver.MonitoringIndexNameResolver;
@ -60,13 +59,13 @@ public class ShardsResolver extends MonitoringIndexNameResolver.Timestamped<Shar
if (shardRouting != null) { if (shardRouting != null) {
// ShardRouting is rendered inside a startObject() / endObject() but without a name, // ShardRouting is rendered inside a startObject() / endObject() but without a name,
// so we must use XContentBuilder.field(String, ToXContent, ToXContent.Params) here // so we must use XContentBuilder.field(String, ToXContent, ToXContent.Params) here
builder.field(Fields.SHARD.value(), shardRouting, params); builder.field(Fields.SHARD, shardRouting, params);
} }
} }
static final class Fields { static final class Fields {
static final XContentBuilderString SHARD = new XContentBuilderString("shard"); static final String SHARD = "shard";
static final XContentBuilderString STATE_UUID = new XContentBuilderString("state_uuid"); static final String STATE_UUID = "state_uuid";
} }
/** /**

View File

@ -11,7 +11,6 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.marvel.action.MonitoringBulkRequestBuilder; import org.elasticsearch.marvel.action.MonitoringBulkRequestBuilder;
import org.elasticsearch.marvel.action.MonitoringBulkResponse; import org.elasticsearch.marvel.action.MonitoringBulkResponse;
import org.elasticsearch.marvel.client.MonitoringClient; import org.elasticsearch.marvel.client.MonitoringClient;
@ -79,8 +78,8 @@ public class RestMonitoringBulkAction extends MonitoringRestHandler {
} }
static final class Fields { static final class Fields {
static final XContentBuilderString TOOK = new XContentBuilderString("took"); static final String TOOK = "took";
static final XContentBuilderString ERRORS = new XContentBuilderString("errors"); static final String ERRORS = "errors";
static final XContentBuilderString ERROR = new XContentBuilderString("error"); static final String ERROR = "error";
} }
} }

View File

@ -58,9 +58,9 @@ public class MonitoringBulkTests extends MarvelIntegTestCase {
for (SearchHit searchHit : searchResponse.getHits()) { for (SearchHit searchHit : searchResponse.getHits()) {
Map<String, Object> source = searchHit.sourceAsMap(); Map<String, Object> source = searchHit.sourceAsMap();
assertNotNull(source.get(MonitoringBulkResolver.Fields.CLUSTER_UUID.value())); assertNotNull(source.get(MonitoringBulkResolver.Fields.CLUSTER_UUID));
assertNotNull(source.get(MonitoringBulkResolver.Fields.TIMESTAMP.value())); assertNotNull(source.get(MonitoringBulkResolver.Fields.TIMESTAMP));
assertNotNull(source.get(MonitoringBulkResolver.Fields.SOURCE_NODE.value())); assertNotNull(source.get(MonitoringBulkResolver.Fields.SOURCE_NODE));
} }
} }

View File

@ -148,9 +148,9 @@ public abstract class MonitoringIndexNameResolverTestCase<M extends MonitoringDo
assertNotNull(sourceFields); assertNotNull(sourceFields);
String[] commons = new String[]{ String[] commons = new String[]{
CLUSTER_UUID.value(), CLUSTER_UUID,
TIMESTAMP.value(), TIMESTAMP,
SOURCE_NODE.value(), SOURCE_NODE,
}; };
assertThat("source must contains default fields", sourceFields.keySet(), hasItems(commons)); assertThat("source must contains default fields", sourceFields.keySet(), hasItems(commons));

View File

@ -77,42 +77,42 @@ public class ClusterInfoTests extends MarvelIntegTestCase {
assertThat(response.getId(), equalTo(clusterUUID)); assertThat(response.getId(), equalTo(clusterUUID));
Map<String, Object> source = response.getSource(); Map<String, Object> source = response.getSource();
assertThat(source.get(MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value()), notNullValue()); assertThat(source.get(MonitoringIndexNameResolver.Fields.CLUSTER_UUID), notNullValue());
assertThat(source.get(MonitoringIndexNameResolver.Fields.TIMESTAMP.value()), notNullValue()); assertThat(source.get(MonitoringIndexNameResolver.Fields.TIMESTAMP), notNullValue());
assertThat(source.get(MonitoringIndexNameResolver.Fields.SOURCE_NODE.value()), notNullValue()); assertThat(source.get(MonitoringIndexNameResolver.Fields.SOURCE_NODE), notNullValue());
assertThat(source.get(ClusterInfoResolver.Fields.CLUSTER_NAME.value()), equalTo(cluster().getClusterName())); assertThat(source.get(ClusterInfoResolver.Fields.CLUSTER_NAME), equalTo(cluster().getClusterName()));
assertThat(source.get(ClusterInfoResolver.Fields.VERSION.value()), equalTo(Version.CURRENT.toString())); assertThat(source.get(ClusterInfoResolver.Fields.VERSION), equalTo(Version.CURRENT.toString()));
logger.debug("--> checking that the document contains license information"); logger.debug("--> checking that the document contains license information");
Object licenseObj = source.get(ClusterInfoResolver.Fields.LICENSE.value()); Object licenseObj = source.get(ClusterInfoResolver.Fields.LICENSE);
assertThat(licenseObj, instanceOf(Map.class)); assertThat(licenseObj, instanceOf(Map.class));
Map license = (Map) licenseObj; Map license = (Map) licenseObj;
assertThat(license, instanceOf(Map.class)); assertThat(license, instanceOf(Map.class));
String uid = (String) license.get(ClusterInfoResolver.Fields.UID.value()); String uid = (String) license.get(ClusterInfoResolver.Fields.UID);
assertThat(uid, not(isEmptyOrNullString())); assertThat(uid, not(isEmptyOrNullString()));
String type = (String) license.get(ClusterInfoResolver.Fields.TYPE.value()); String type = (String) license.get(ClusterInfoResolver.Fields.TYPE);
assertThat(type, not(isEmptyOrNullString())); assertThat(type, not(isEmptyOrNullString()));
String status = (String) license.get(License.XFields.STATUS.value()); String status = (String) license.get(License.Fields.STATUS);
assertThat(status, not(isEmptyOrNullString())); assertThat(status, not(isEmptyOrNullString()));
Long expiryDate = (Long) license.get(License.XFields.EXPIRY_DATE_IN_MILLIS.value()); Long expiryDate = (Long) license.get(License.Fields.EXPIRY_DATE_IN_MILLIS);
assertThat(expiryDate, greaterThan(0L)); assertThat(expiryDate, greaterThan(0L));
// We basically recompute the hash here // We basically recompute the hash here
String hkey = (String) license.get(ClusterInfoResolver.Fields.HKEY.value()); String hkey = (String) license.get(ClusterInfoResolver.Fields.HKEY);
String recalculated = ClusterInfoResolver.hash(status, uid, type, String.valueOf(expiryDate), clusterUUID); String recalculated = ClusterInfoResolver.hash(status, uid, type, String.valueOf(expiryDate), clusterUUID);
assertThat(hkey, equalTo(recalculated)); assertThat(hkey, equalTo(recalculated));
assertThat((String) license.get(License.XFields.ISSUER.value()), not(isEmptyOrNullString())); assertThat((String) license.get(License.Fields.ISSUER), not(isEmptyOrNullString()));
assertThat((String) license.get(License.XFields.ISSUED_TO.value()), not(isEmptyOrNullString())); assertThat((String) license.get(License.Fields.ISSUED_TO), not(isEmptyOrNullString()));
assertThat((Long) license.get(License.XFields.ISSUE_DATE_IN_MILLIS.value()), greaterThan(0L)); assertThat((Long) license.get(License.Fields.ISSUE_DATE_IN_MILLIS), greaterThan(0L));
assertThat((Integer) license.get(License.XFields.MAX_NODES.value()), greaterThan(0)); assertThat((Integer) license.get(License.Fields.MAX_NODES), greaterThan(0));
Object clusterStats = source.get(ClusterInfoResolver.Fields.CLUSTER_STATS.value()); Object clusterStats = source.get(ClusterInfoResolver.Fields.CLUSTER_STATS);
assertNotNull(clusterStats); assertNotNull(clusterStats);
assertThat(clusterStats, instanceOf(Map.class)); assertThat(clusterStats, instanceOf(Map.class));
assertThat(((Map) clusterStats).size(), greaterThan(0)); assertThat(((Map) clusterStats).size(), greaterThan(0));
@ -128,10 +128,10 @@ public class ClusterInfoTests extends MarvelIntegTestCase {
.setTypes(ClusterInfoResolver.TYPE) .setTypes(ClusterInfoResolver.TYPE)
.setQuery( .setQuery(
QueryBuilders.boolQuery() QueryBuilders.boolQuery()
.should(QueryBuilders.matchQuery(License.XFields.STATUS.value(), License.Status.ACTIVE.label())) .should(QueryBuilders.matchQuery(License.Fields.STATUS, License.Status.ACTIVE.label()))
.should(QueryBuilders.matchQuery(License.XFields.STATUS.value(), License.Status.INVALID.label())) .should(QueryBuilders.matchQuery(License.Fields.STATUS, License.Status.INVALID.label()))
.should(QueryBuilders.matchQuery(License.XFields.STATUS.value(), License.Status.EXPIRED.label())) .should(QueryBuilders.matchQuery(License.Fields.STATUS, License.Status.EXPIRED.label()))
.should(QueryBuilders.matchQuery(ClusterInfoResolver.Fields.CLUSTER_NAME.value(), .should(QueryBuilders.matchQuery(ClusterInfoResolver.Fields.CLUSTER_NAME,
cluster().getClusterName())) cluster().getClusterName()))
.minimumNumberShouldMatch(1) .minimumNumberShouldMatch(1)
).get(), 0L); ).get(), 0L);

View File

@ -122,13 +122,13 @@ public class ClusterStateTests extends MarvelIntegTestCase {
logger.debug("--> checking that every document contains the expected fields"); logger.debug("--> checking that every document contains the expected fields");
String[] filters = { String[] filters = {
MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value(), MonitoringIndexNameResolver.Fields.CLUSTER_UUID,
MonitoringIndexNameResolver.Fields.TIMESTAMP.value(), MonitoringIndexNameResolver.Fields.TIMESTAMP,
SOURCE_NODE.value(), SOURCE_NODE,
ClusterStateNodeResolver.Fields.STATE_UUID.value(), ClusterStateNodeResolver.Fields.STATE_UUID,
ClusterStateNodeResolver.Fields.NODE.value(), ClusterStateNodeResolver.Fields.NODE,
ClusterStateNodeResolver.Fields.NODE.value() + "." ClusterStateNodeResolver.Fields.NODE + "."
+ ClusterStateNodeResolver.Fields.ID.value(), + ClusterStateNodeResolver.Fields.ID,
}; };
for (SearchHit searchHit : response.getHits().getHits()) { for (SearchHit searchHit : response.getHits().getHits()) {
@ -143,7 +143,7 @@ public class ClusterStateTests extends MarvelIntegTestCase {
assertThat(client().prepareSearch().setSize(0) assertThat(client().prepareSearch().setSize(0)
.setIndices(timestampedIndex) .setIndices(timestampedIndex)
.setTypes(ClusterStateNodeResolver.TYPE) .setTypes(ClusterStateNodeResolver.TYPE)
.setQuery(QueryBuilders.matchQuery(SOURCE_NODE.value() + ".attributes.custom", randomInt)) .setQuery(QueryBuilders.matchQuery(SOURCE_NODE + ".attributes.custom", randomInt))
.get().getHits().getTotalHits(), greaterThan(0L)); .get().getHits().getTotalHits(), greaterThan(0L));
logger.debug("--> cluster state nodes successfully collected"); logger.debug("--> cluster state nodes successfully collected");
@ -167,18 +167,18 @@ public class ClusterStateTests extends MarvelIntegTestCase {
logger.debug("--> checking that every document contains the expected fields"); logger.debug("--> checking that every document contains the expected fields");
String[] filters = { String[] filters = {
MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value(), MonitoringIndexNameResolver.Fields.CLUSTER_UUID,
MonitoringIndexNameResolver.Fields.TIMESTAMP.value(), MonitoringIndexNameResolver.Fields.TIMESTAMP,
MonitoringIndexNameResolver.Fields.SOURCE_NODE.value(), MonitoringIndexNameResolver.Fields.SOURCE_NODE,
DiscoveryNodeResolver.Fields.NODE.value(), DiscoveryNodeResolver.Fields.NODE,
DiscoveryNodeResolver.Fields.NODE.value() + "." DiscoveryNodeResolver.Fields.NODE + "."
+ DiscoveryNodeResolver.Fields.ID.value(), + DiscoveryNodeResolver.Fields.ID,
DiscoveryNodeResolver.Fields.NODE.value() + "." DiscoveryNodeResolver.Fields.NODE + "."
+ DiscoveryNodeResolver.Fields.NAME.value(), + DiscoveryNodeResolver.Fields.NAME,
DiscoveryNodeResolver.Fields.NODE.value() + "." DiscoveryNodeResolver.Fields.NODE + "."
+ DiscoveryNodeResolver.Fields.ATTRIBUTES.value(), + DiscoveryNodeResolver.Fields.ATTRIBUTES,
DiscoveryNodeResolver.Fields.NODE.value() + "." DiscoveryNodeResolver.Fields.NODE + "."
+ DiscoveryNodeResolver.Fields.TRANSPORT_ADDRESS.value(), + DiscoveryNodeResolver.Fields.TRANSPORT_ADDRESS,
}; };
for (SearchHit searchHit : response.getHits().getHits()) { for (SearchHit searchHit : response.getHits().getHits()) {

View File

@ -80,12 +80,12 @@ public class IndexRecoveryTests extends MarvelIntegTestCase {
logger.debug("--> checking that every document contains the expected fields"); logger.debug("--> checking that every document contains the expected fields");
String[] filters = { String[] filters = {
MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value(), MonitoringIndexNameResolver.Fields.CLUSTER_UUID,
MonitoringIndexNameResolver.Fields.TIMESTAMP.value(), MonitoringIndexNameResolver.Fields.TIMESTAMP,
MonitoringIndexNameResolver.Fields.SOURCE_NODE.value(), MonitoringIndexNameResolver.Fields.SOURCE_NODE,
IndexRecoveryResolver.Fields.INDEX_RECOVERY.value(), IndexRecoveryResolver.Fields.INDEX_RECOVERY,
IndexRecoveryResolver.Fields.INDEX_RECOVERY.value() + "." IndexRecoveryResolver.Fields.INDEX_RECOVERY + "."
+ IndexRecoveryResolver.Fields.SHARDS.value(), + IndexRecoveryResolver.Fields.SHARDS,
}; };
for (SearchHit searchHit : response.getHits().getHits()) { for (SearchHit searchHit : response.getHits().getHits()) {

View File

@ -41,7 +41,6 @@ import org.elasticsearch.common.util.concurrent.AbstractRunnable;
import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.gateway.GatewayService;
import org.elasticsearch.node.Node; import org.elasticsearch.node.Node;
@ -937,25 +936,25 @@ public class IndexAuditTrail extends AbstractComponent implements AuditTrail, Cl
} }
interface Field { interface Field {
XContentBuilderString TIMESTAMP = new XContentBuilderString("@timestamp"); String TIMESTAMP = new String("@timestamp");
XContentBuilderString NODE_NAME = new XContentBuilderString("node_name"); String NODE_NAME = new String("node_name");
XContentBuilderString NODE_HOST_NAME = new XContentBuilderString("node_host_name"); String NODE_HOST_NAME = new String("node_host_name");
XContentBuilderString NODE_HOST_ADDRESS = new XContentBuilderString("node_host_address"); String NODE_HOST_ADDRESS = new String("node_host_address");
XContentBuilderString LAYER = new XContentBuilderString("layer"); String LAYER = new String("layer");
XContentBuilderString TYPE = new XContentBuilderString("event_type"); String TYPE = new String("event_type");
XContentBuilderString ORIGIN_ADDRESS = new XContentBuilderString("origin_address"); String ORIGIN_ADDRESS = new String("origin_address");
XContentBuilderString ORIGIN_TYPE = new XContentBuilderString("origin_type"); String ORIGIN_TYPE = new String("origin_type");
XContentBuilderString PRINCIPAL = new XContentBuilderString("principal"); String PRINCIPAL = new String("principal");
XContentBuilderString RUN_AS_PRINCIPAL = new XContentBuilderString("run_as_principal"); String RUN_AS_PRINCIPAL = new String("run_as_principal");
XContentBuilderString RUN_BY_PRINCIPAL = new XContentBuilderString("run_by_principal"); String RUN_BY_PRINCIPAL = new String("run_by_principal");
XContentBuilderString ACTION = new XContentBuilderString("action"); String ACTION = new String("action");
XContentBuilderString INDICES = new XContentBuilderString("indices"); String INDICES = new String("indices");
XContentBuilderString REQUEST = new XContentBuilderString("request"); String REQUEST = new String("request");
XContentBuilderString REQUEST_BODY = new XContentBuilderString("request_body"); String REQUEST_BODY = new String("request_body");
XContentBuilderString URI = new XContentBuilderString("uri"); String URI = new String("uri");
XContentBuilderString REALM = new XContentBuilderString("realm"); String REALM = new String("realm");
XContentBuilderString TRANSPORT_PROFILE = new XContentBuilderString("transport_profile"); String TRANSPORT_PROFILE = new String("transport_profile");
XContentBuilderString RULE = new XContentBuilderString("rule"); String RULE = new String("rule");
} }
public enum State { public enum State {

View File

@ -8,7 +8,6 @@ package org.elasticsearch.watcher.actions.hipchat.service;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.watcher.support.http.HttpRequest; import org.elasticsearch.watcher.support.http.HttpRequest;
import org.elasticsearch.watcher.support.http.HttpResponse; import org.elasticsearch.watcher.support.http.HttpResponse;
@ -65,7 +64,7 @@ public class SentMessages implements ToXContent, Iterable<SentMessages.SentMessa
public enum TargetType { public enum TargetType {
ROOM, USER; ROOM, USER;
final XContentBuilderString fieldName = new XContentBuilderString(name().toLowerCase(Locale.ROOT)); final String fieldName = new String(name().toLowerCase(Locale.ROOT));
} }
final String targetName; final String targetName;
@ -155,12 +154,12 @@ public class SentMessages implements ToXContent, Iterable<SentMessages.SentMessa
} }
interface Field { interface Field {
XContentBuilderString ACCOUNT = new XContentBuilderString("account"); String ACCOUNT = new String("account");
XContentBuilderString SENT_MESSAGES = new XContentBuilderString("sent_messages"); String SENT_MESSAGES = new String("sent_messages");
XContentBuilderString STATUS = new XContentBuilderString("status"); String STATUS = new String("status");
XContentBuilderString REASON = new XContentBuilderString("reason"); String REASON = new String("reason");
XContentBuilderString REQUEST = new XContentBuilderString("request"); String REQUEST = new String("request");
XContentBuilderString RESPONSE = new XContentBuilderString("response"); String RESPONSE = new String("response");
XContentBuilderString MESSAGE = new XContentBuilderString("message"); String MESSAGE = new String("message");
} }
} }

View File

@ -8,7 +8,6 @@ package org.elasticsearch.watcher.actions.slack.service;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentBuilderString;
import org.elasticsearch.watcher.actions.slack.service.message.SlackMessage; import org.elasticsearch.watcher.actions.slack.service.message.SlackMessage;
import org.elasticsearch.watcher.support.http.HttpRequest; import org.elasticsearch.watcher.support.http.HttpRequest;
import org.elasticsearch.watcher.support.http.HttpResponse; import org.elasticsearch.watcher.support.http.HttpResponse;
@ -138,13 +137,13 @@ public class SentMessages implements ToXContent, Iterable<SentMessages.SentMessa
} }
interface Field { interface Field {
XContentBuilderString ACCOUNT = new XContentBuilderString("account"); String ACCOUNT = new String("account");
XContentBuilderString SENT_MESSAGES = new XContentBuilderString("sent_messages"); String SENT_MESSAGES = new String("sent_messages");
XContentBuilderString STATUS = new XContentBuilderString("status"); String STATUS = new String("status");
XContentBuilderString REASON = new XContentBuilderString("reason"); String REASON = new String("reason");
XContentBuilderString REQUEST = new XContentBuilderString("request"); String REQUEST = new String("request");
XContentBuilderString RESPONSE = new XContentBuilderString("response"); String RESPONSE = new String("response");
XContentBuilderString MESSAGE = new XContentBuilderString("message"); String MESSAGE = new String("message");
XContentBuilderString TO = new XContentBuilderString("to"); String TO = new String("to");
} }
} }