Java Code Examples for org.elasticsearch.common.xcontent.NamedXContentRegistry#Entry

The following examples show how to use org.elasticsearch.common.xcontent.NamedXContentRegistry#Entry . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SQLPlugin.java    From crate with Apache License 2.0 6 votes vote down vote up
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    List<NamedXContentRegistry.Entry> entries = new ArrayList<>();
    entries.add(new NamedXContentRegistry.Entry(
        MetaData.Custom.class,
        new ParseField(UserDefinedFunctionsMetaData.TYPE),
        UserDefinedFunctionsMetaData::fromXContent
    ));
    entries.add(new NamedXContentRegistry.Entry(
        MetaData.Custom.class,
        new ParseField(ViewsMetaData.TYPE),
        ViewsMetaData::fromXContent
    ));

    if (userExtension != null) {
        entries.addAll(userExtension.getNamedXContent());
    }
    if (licenseExtension != null) {
        entries.addAll(licenseExtension.getNamedXContent());
    }
    return entries;
}
 
Example 2
Source File: AnomalyDetectorProfileRunnerTests.java    From anomaly-detection with Apache License 2.0 5 votes vote down vote up
@Override
protected NamedXContentRegistry xContentRegistry() {
    SearchModule searchModule = new SearchModule(Settings.EMPTY, false, Collections.emptyList());
    List<NamedXContentRegistry.Entry> entries = searchModule.getNamedXContents();
    entries.addAll(Arrays.asList(AnomalyDetector.XCONTENT_REGISTRY, AnomalyResult.XCONTENT_REGISTRY));
    return new NamedXContentRegistry(entries);
}
 
Example 3
Source File: LtrQueryParserPlugin.java    From elasticsearch-learning-to-rank with Apache License 2.0 5 votes vote down vote up
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return unmodifiableList(asList(
            new NamedXContentRegistry.Entry(StorableElement.class,
                    new ParseField(StoredFeature.TYPE),
                    (CheckedFunction<XContentParser, StorableElement, IOException>) StoredFeature::parse),
            new NamedXContentRegistry.Entry(StorableElement.class,
                    new ParseField(StoredFeatureSet.TYPE),
                    (CheckedFunction<XContentParser, StorableElement, IOException>) StoredFeatureSet::parse),
            new NamedXContentRegistry.Entry(StorableElement.class,
                    new ParseField(StoredLtrModel.TYPE),
                    (CheckedFunction<XContentParser, StorableElement, IOException>) StoredLtrModel::parse)
    ));
}
 
Example 4
Source File: ClusterModule.java    From crate with Apache License 2.0 5 votes vote down vote up
public static List<NamedXContentRegistry.Entry> getNamedXWriteables() {
    List<NamedXContentRegistry.Entry> entries = new ArrayList<>();
    // Metadata
    entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(RepositoriesMetaData.TYPE),
        RepositoriesMetaData::fromXContent));
    entries.add(new NamedXContentRegistry.Entry(MetaData.Custom.class, new ParseField(IndexGraveyard.TYPE),
        IndexGraveyard::fromXContent));
    return entries;
}
 
Example 5
Source File: EnterpriseUsersExtension.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    List<NamedXContentRegistry.Entry> entries = new ArrayList<>(2);
    entries.add(new NamedXContentRegistry.Entry(
        MetaData.Custom.class,
        new ParseField(UsersMetaData.TYPE),
        UsersMetaData::fromXContent
    ));
    entries.add(new NamedXContentRegistry.Entry(
        MetaData.Custom.class,
        new ParseField(UsersPrivilegesMetaData.TYPE),
        UsersPrivilegesMetaData::fromXContent
    ));
    return entries;
}
 
Example 6
Source File: EnterpriseLicenseExtension.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return Collections.singletonList(new NamedXContentRegistry.Entry(
        MetaData.Custom.class,
        new ParseField(LicenseKey.WRITEABLE_TYPE),
        LicenseKey::fromXContent
    ));
}
 
Example 7
Source File: AnomalyDetectorPlugin.java    From anomaly-detection with Apache License 2.0 4 votes vote down vote up
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return ImmutableList.of(AnomalyDetector.XCONTENT_REGISTRY, AnomalyResult.XCONTENT_REGISTRY);
}
 
Example 8
Source File: PluginLoaderPlugin.java    From crate with Apache License 2.0 4 votes vote down vote up
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return sqlPlugin.getNamedXContent();
}
 
Example 9
Source File: IndicesModule.java    From crate with Apache License 2.0 4 votes vote down vote up
public List<NamedXContentRegistry.Entry> getNamedXContents() {
    return Collections.emptyList();
}
 
Example 10
Source File: NetworkModule.java    From crate with Apache License 2.0 4 votes vote down vote up
public static List<NamedXContentRegistry.Entry> getNamedXContents() {
    return Collections.unmodifiableList(NAMED_XCONTENTS);
}
 
Example 11
Source File: CustomMetaDataTest.java    From crate with Apache License 2.0 4 votes vote down vote up
private NamedXContentRegistry getNamedXContentRegistry() {
    List<NamedXContentRegistry.Entry> registry = new ArrayList<>();
    registry.addAll(new SQLPlugin(Settings.EMPTY).getNamedXContent());
    registry.addAll(ClusterModule.getNamedXWriteables());
    return new NamedXContentRegistry(registry);
}
 
Example 12
Source File: Plugin.java    From crate with Apache License 2.0 2 votes vote down vote up
/**
 * Returns parsers for named objects this plugin will parse from {@link XContentParser#namedObject(Class, String, Object)}.
 * @see NamedWriteableRegistry
 */
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return Collections.emptyList();
}
 
Example 13
Source File: LicenseExtension.java    From crate with Apache License 2.0 votes vote down vote up
List<NamedXContentRegistry.Entry> getNamedXContent(); 
Example 14
Source File: UserExtension.java    From crate with Apache License 2.0 votes vote down vote up
List<NamedXContentRegistry.Entry> getNamedXContent();