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

The following examples show how to use org.elasticsearch.common.xcontent.NamedXContentRegistry#Entry . These examples are extracted from open source projects. 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 Project: crate   File: SQLPlugin.java    License: 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
@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
@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 Project: crate   File: ClusterModule.java    License: 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 Project: crate   File: EnterpriseUsersExtension.java    License: 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
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return Collections.singletonList(new NamedXContentRegistry.Entry(
        MetaData.Custom.class,
        new ParseField(LicenseKey.WRITEABLE_TYPE),
        LicenseKey::fromXContent
    ));
}
 
Example 7
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return ImmutableList.of(AnomalyDetector.XCONTENT_REGISTRY, AnomalyResult.XCONTENT_REGISTRY);
}
 
Example 8
Source Project: crate   File: PluginLoaderPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public List<NamedXContentRegistry.Entry> getNamedXContent() {
    return sqlPlugin.getNamedXContent();
}
 
Example 9
Source Project: crate   File: IndicesModule.java    License: Apache License 2.0 4 votes vote down vote up
public List<NamedXContentRegistry.Entry> getNamedXContents() {
    return Collections.emptyList();
}
 
Example 10
Source Project: crate   File: NetworkModule.java    License: Apache License 2.0 4 votes vote down vote up
public static List<NamedXContentRegistry.Entry> getNamedXContents() {
    return Collections.unmodifiableList(NAMED_XCONTENTS);
}
 
Example 11
Source Project: crate   File: CustomMetaDataTest.java    License: 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 Project: crate   File: Plugin.java    License: 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 Project: crate   File: LicenseExtension.java    License: Apache License 2.0 votes vote down vote up
List<NamedXContentRegistry.Entry> getNamedXContent(); 
Example 14
Source Project: crate   File: UserExtension.java    License: Apache License 2.0 votes vote down vote up
List<NamedXContentRegistry.Entry> getNamedXContent();