[Stable plugin api] Extensible annotation (#89903)

This commits adds an Extensible annotation aimed to mark things that can be loaded by a component loader.
It also marks Analyzer api components (AnalyzerFactory, CharFilterFactory, TokenFilterFactory and TokenizerFactory) with this annotation.

relates #88980
This commit is contained in:
Przemyslaw Gomulka 2022-09-09 10:41:27 +02:00 committed by GitHub
parent bae3284c69
commit 31cba2d085
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 4 deletions

View file

@ -1,7 +1,3 @@
import org.elasticsearch.gradle.transform.UnzipTransform
import java.util.stream.Collectors
/* /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License * or more contributor license agreements. Licensed under the Elastic License

View file

@ -9,11 +9,13 @@
package org.elasticsearch.plugin.analysis.api; package org.elasticsearch.plugin.analysis.api;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.elasticsearch.plugin.api.Extensible;
import org.elasticsearch.plugin.api.Nameable; import org.elasticsearch.plugin.api.Nameable;
/** /**
* An analysis component used to create Analyzers. * An analysis component used to create Analyzers.
*/ */
@Extensible
public interface AnalyzerFactory extends Nameable { public interface AnalyzerFactory extends Nameable {
/** /**
* Returns a lucene org.apache.lucene.analysis.Analyzer instance. * Returns a lucene org.apache.lucene.analysis.Analyzer instance.

View file

@ -8,6 +8,7 @@
package org.elasticsearch.plugin.analysis.api; package org.elasticsearch.plugin.analysis.api;
import org.elasticsearch.plugin.api.Extensible;
import org.elasticsearch.plugin.api.Nameable; import org.elasticsearch.plugin.api.Nameable;
import java.io.Reader; import java.io.Reader;
@ -16,6 +17,7 @@ import java.io.Reader;
* An analysis component used to create char filters. * An analysis component used to create char filters.
* *
*/ */
@Extensible
public interface CharFilterFactory extends Nameable { public interface CharFilterFactory extends Nameable {
/** /**
* Wraps the given Reader with a CharFilter. * Wraps the given Reader with a CharFilter.

View file

@ -9,11 +9,13 @@
package org.elasticsearch.plugin.analysis.api; package org.elasticsearch.plugin.analysis.api;
import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStream;
import org.elasticsearch.plugin.api.Extensible;
import org.elasticsearch.plugin.api.Nameable; import org.elasticsearch.plugin.api.Nameable;
/** /**
* An analysis component used to create token filters. * An analysis component used to create token filters.
*/ */
@Extensible
public interface TokenFilterFactory extends Nameable { public interface TokenFilterFactory extends Nameable {
/** /**

View file

@ -9,11 +9,13 @@
package org.elasticsearch.plugin.analysis.api; package org.elasticsearch.plugin.analysis.api;
import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.Tokenizer;
import org.elasticsearch.plugin.api.Extensible;
import org.elasticsearch.plugin.api.Nameable; import org.elasticsearch.plugin.api.Nameable;
/** /**
* An analysis component used to create tokenizers. * An analysis component used to create tokenizers.
*/ */
@Extensible
public interface TokenizerFactory extends Nameable { public interface TokenizerFactory extends Nameable {
/** /**

View file

@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
package org.elasticsearch.plugin.api;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
/**
* Marker for things that can be loaded by component loader.
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(value = { TYPE })
public @interface Extensible {
}