Adjust to xcontent being a separate lib (elastic/x-pack-elasticsearch#4259)

* Adjust to xcontent being a separate lib

This is the x-pack side of https://github.com/elastic/elasticsearch/pull/29300
where xcontent is now starting to be a separate jar/dependency

Original commit: elastic/x-pack-elasticsearch@1eb249565a
This commit is contained in:
Lee Hinman 2018-04-02 15:58:48 -06:00 committed by GitHub
parent b3cc7fc2c5
commit 0013de7aed
4 changed files with 9 additions and 6 deletions

View File

@ -19,8 +19,8 @@ import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.common.xcontent.json.JsonXContent;
@ -376,7 +376,7 @@ public class RoleDescriptor implements ToXContentObject {
} else if (Fields.QUERY.match(currentFieldName, parser.getDeprecationHandler())) {
if (token == XContentParser.Token.START_OBJECT) {
XContentBuilder builder = JsonXContent.contentBuilder();
XContentHelper.copyCurrentStructure(builder.generator(), parser);
builder.generator().copyCurrentStructure(parser);
query = BytesReference.bytes(builder);
} else if (token == XContentParser.Token.VALUE_STRING) {
final String text = parser.text();

View File

@ -13,8 +13,8 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.xpack.core.watcher.common.xcontent.XContentUtils;
@ -102,7 +102,7 @@ public class XContentSource implements ToXContent {
try (InputStream stream = bytes.streamInput();
XContentParser parser = parser(NamedXContentRegistry.EMPTY, stream)) {
parser.nextToken();
XContentHelper.copyCurrentStructure(builder.generator(), parser);
builder.generator().copyCurrentStructure(parser);
return builder;
}
}

View File

@ -22,6 +22,9 @@ dependencies {
compile (project(':libs:elasticsearch-core')) {
transitive = false
}
compile (project(':libs:x-content')) {
transitive = false
}
compile "org.apache.lucene:lucene-core:${versions.lucene}"
compile 'joda-time:joda-time:2.9.9'
runtime "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"

View File

@ -10,8 +10,8 @@ import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestController;
@ -105,7 +105,7 @@ public class RestExecuteWatchAction extends WatcherRestHandler implements RestRe
builder.setTriggerData(parser.map());
} else if (Field.WATCH.match(currentFieldName, parser.getDeprecationHandler())) {
XContentBuilder watcherSource = XContentBuilder.builder(parser.contentType().xContent());
XContentHelper.copyCurrentStructure(watcherSource.generator(), parser);
watcherSource.generator().copyCurrentStructure(parser);
builder.setWatchSource(BytesReference.bytes(watcherSource), parser.contentType());
} else if (Field.ACTION_MODES.match(currentFieldName, parser.getDeprecationHandler())) {
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {