mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
[Stable plugin api] Drop api suffix in package names (#92905)
Refactoring that drops the api suffix from package name This will have to be followed up by a plugins/examples fix in imports Also set an artifact group name to `org.elasticsearch.plugin` in the plugin-api and plugin-analysis-api
This commit is contained in:
parent
4573c5641e
commit
2cdaabe783
47 changed files with 165 additions and 176 deletions
|
@ -54,8 +54,8 @@ public class InternalDistributionModuleCheckTaskProvider {
|
||||||
"org.elasticsearch.geo",
|
"org.elasticsearch.geo",
|
||||||
"org.elasticsearch.logging",
|
"org.elasticsearch.logging",
|
||||||
"org.elasticsearch.lz4",
|
"org.elasticsearch.lz4",
|
||||||
"org.elasticsearch.plugin.analysis.api",
|
"org.elasticsearch.plugin",
|
||||||
"org.elasticsearch.plugin.api",
|
"org.elasticsearch.plugin.analysis",
|
||||||
"org.elasticsearch.pluginclassloader",
|
"org.elasticsearch.pluginclassloader",
|
||||||
"org.elasticsearch.securesm",
|
"org.elasticsearch.securesm",
|
||||||
"org.elasticsearch.server",
|
"org.elasticsearch.server",
|
||||||
|
|
|
@ -92,7 +92,7 @@ class StablePluginBuildPluginFuncTest extends AbstractGradleFuncTest {
|
||||||
file("src/main/java/org/acme/A.java") << """
|
file("src/main/java/org/acme/A.java") << """
|
||||||
package org.acme;
|
package org.acme;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.plugin.scanner.test_classes.ExtensibleClass;
|
import org.elasticsearch.plugin.scanner.test_classes.ExtensibleClass;
|
||||||
|
|
||||||
@NamedComponent( "componentA")
|
@NamedComponent( "componentA")
|
||||||
|
|
|
@ -11,8 +11,8 @@ package org.elasticsearch.gradle.internal.test;
|
||||||
import net.bytebuddy.ByteBuddy;
|
import net.bytebuddy.ByteBuddy;
|
||||||
import net.bytebuddy.dynamic.DynamicType;
|
import net.bytebuddy.dynamic.DynamicType;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.plugin.scanner.test_classes.ExtensibleClass;
|
import org.elasticsearch.plugin.scanner.test_classes.ExtensibleClass;
|
||||||
import org.elasticsearch.plugin.scanner.test_classes.ExtensibleInterface;
|
import org.elasticsearch.plugin.scanner.test_classes.ExtensibleInterface;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.plugin.api;
|
package org.elasticsearch.plugin;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api;
|
package org.elasticsearch.plugin;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner.test_classes;
|
package org.elasticsearch.plugin.scanner.test_classes;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
|
|
||||||
@Extensible
|
@Extensible
|
||||||
public class ExtensibleClass {}
|
public class ExtensibleClass {}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner.test_classes;
|
package org.elasticsearch.plugin.scanner.test_classes;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
|
|
||||||
@Extensible
|
@Extensible
|
||||||
public interface ExtensibleInterface {}
|
public interface ExtensibleInterface {}
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner.test_classes;
|
package org.elasticsearch.plugin.scanner.test_classes;
|
||||||
|
|
||||||
@org.elasticsearch.plugin.api.NamedComponent("test_named_component")
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
|
|
||||||
|
@NamedComponent("test_named_component")
|
||||||
public class TestNamedComponent implements ExtensibleInterface {
|
public class TestNamedComponent implements ExtensibleInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
apply plugin: 'elasticsearch.publish'
|
apply plugin: 'elasticsearch.publish'
|
||||||
apply plugin: 'elasticsearch.build'
|
apply plugin: 'elasticsearch.build'
|
||||||
|
|
||||||
|
group = "org.elasticsearch.plugin"
|
||||||
|
|
||||||
tasks.named("loggerUsageCheck").configure {enabled = false }
|
tasks.named("loggerUsageCheck").configure {enabled = false }
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module org.elasticsearch.plugin.analysis.api {
|
module org.elasticsearch.plugin.analysis {
|
||||||
requires org.apache.lucene.core;
|
requires org.apache.lucene.core;
|
||||||
requires org.elasticsearch.plugin.api;
|
requires org.elasticsearch.plugin;
|
||||||
|
|
||||||
exports org.elasticsearch.plugin.analysis.api;
|
exports org.elasticsearch.plugin.analysis;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.analysis.api;
|
package org.elasticsearch.plugin.analysis;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum representing the mode in which token filters and analyzers are allowed to operate.
|
* Enum representing the mode in which token filters and analyzers are allowed to operate.
|
|
@ -6,11 +6,11 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.analysis.api;
|
package org.elasticsearch.plugin.analysis;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.Analyzer;
|
import org.apache.lucene.analysis.Analyzer;
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.plugin.api.Nameable;
|
import org.elasticsearch.plugin.Nameable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An analysis component used to create Analyzers.
|
* An analysis component used to create Analyzers.
|
|
@ -6,10 +6,10 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.analysis.api;
|
package org.elasticsearch.plugin.analysis;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.plugin.api.Nameable;
|
import org.elasticsearch.plugin.Nameable;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.analysis.api;
|
package org.elasticsearch.plugin.analysis;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.TokenStream;
|
import org.apache.lucene.analysis.TokenStream;
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.plugin.api.Nameable;
|
import org.elasticsearch.plugin.Nameable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An analysis component used to create token filters.
|
* An analysis component used to create token filters.
|
|
@ -6,11 +6,11 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.analysis.api;
|
package org.elasticsearch.plugin.analysis;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.Tokenizer;
|
import org.apache.lucene.analysis.Tokenizer;
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.plugin.api.Nameable;
|
import org.elasticsearch.plugin.Nameable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An analysis component used to create tokenizers.
|
* An analysis component used to create tokenizers.
|
|
@ -9,6 +9,7 @@
|
||||||
apply plugin: 'elasticsearch.publish'
|
apply plugin: 'elasticsearch.publish'
|
||||||
apply plugin: 'elasticsearch.build'
|
apply plugin: 'elasticsearch.build'
|
||||||
|
|
||||||
|
group = "org.elasticsearch.plugin"
|
||||||
|
|
||||||
tasks.named("loggerUsageCheck").configure {enabled = false }
|
tasks.named("loggerUsageCheck").configure {enabled = false }
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module org.elasticsearch.plugin.api {
|
module org.elasticsearch.plugin {
|
||||||
exports org.elasticsearch.plugin.api;
|
exports org.elasticsearch.plugin;
|
||||||
exports org.elasticsearch.plugin.api.settings;
|
exports org.elasticsearch.plugin.settings;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api;
|
package org.elasticsearch.plugin;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api;
|
package org.elasticsearch.plugin;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api;
|
package org.elasticsearch.plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A named plugin component. Components with a name can be registered and fetched under a name given in
|
* A named plugin component. Components with a name can be registered and fetched under a name given in
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api;
|
package org.elasticsearch.plugin;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -12,14 +12,12 @@
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> The root package is org.elasticsearch.plugin</li>
|
* <li> The root package is org.elasticsearch.plugin</li>
|
||||||
* <li> Specialised API jars have their name following the root package.
|
* <li> Specialised API jars have their name following the root package.
|
||||||
|
* Interfaces and annotations used by plugin developers should be placed under it.
|
||||||
* i.e. org.elasticsearch.plugin.analysis
|
* i.e. org.elasticsearch.plugin.analysis
|
||||||
* </li>
|
* </li>
|
||||||
* <li> Interfaces and annotations used by plugin developers are in `api` package
|
* <li> packages which are not meant to be used by plugin developers should be under internal package suffix
|
||||||
* i.e org.elasticsearch.plugin.analysis.api or org.elasticsearch.plugin.api
|
|
||||||
* </li>
|
|
||||||
* <li> packages which are not meant to be used by plugin developers should not be subpackages of api
|
|
||||||
* i.e org.elasticsearch.plugin.analysis.internal
|
* i.e org.elasticsearch.plugin.analysis.internal
|
||||||
* </li>
|
* </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.plugin.api;
|
package org.elasticsearch.plugin;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api.settings;
|
package org.elasticsearch.plugin.settings;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api.settings;
|
package org.elasticsearch.plugin.settings;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api.settings;
|
package org.elasticsearch.plugin.settings;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api.settings;
|
package org.elasticsearch.plugin.settings;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api.settings;
|
package org.elasticsearch.plugin.settings;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.elasticsearch.plugin.api.settings;
|
package org.elasticsearch.plugin.settings;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
|
@ -9,7 +9,7 @@
|
||||||
module org.elasticsearch.plugin.scanner {
|
module org.elasticsearch.plugin.scanner {
|
||||||
requires org.elasticsearch.base;
|
requires org.elasticsearch.base;
|
||||||
requires org.objectweb.asm;
|
requires org.objectweb.asm;
|
||||||
requires org.elasticsearch.plugin.api;
|
requires org.elasticsearch.plugin;
|
||||||
requires org.elasticsearch.xcontent;
|
requires org.elasticsearch.xcontent;
|
||||||
|
|
||||||
exports org.elasticsearch.plugin.scanner;
|
exports org.elasticsearch.plugin.scanner;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner;
|
package org.elasticsearch.plugin.scanner;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.xcontent.XContentBuilder;
|
import org.elasticsearch.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.xcontent.XContentFactory;
|
import org.elasticsearch.xcontent.XContentFactory;
|
||||||
import org.objectweb.asm.AnnotationVisitor;
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner;
|
package org.elasticsearch.plugin.scanner;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.ExtensibleClass;
|
import org.elasticsearch.plugin.scanner.test_model.ExtensibleClass;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.ExtensibleInterface;
|
import org.elasticsearch.plugin.scanner.test_model.ExtensibleInterface;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.ImplementingExtensible;
|
import org.elasticsearch.plugin.scanner.test_model.ImplementingExtensible;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner;
|
package org.elasticsearch.plugin.scanner;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
|
|
|
@ -64,13 +64,13 @@ public class NamedComponentScannerTests extends ESTestCase {
|
||||||
Path jar = dirWithJar.resolve("plugin.jar");
|
Path jar = dirWithJar.resolve("plugin.jar");
|
||||||
JarUtils.createJarWithEntries(jar, Map.of("p/A.class", InMemoryJavaCompiler.compile("p.A", """
|
JarUtils.createJarWithEntries(jar, Map.of("p/A.class", InMemoryJavaCompiler.compile("p.A", """
|
||||||
package p;
|
package p;
|
||||||
import org.elasticsearch.plugin.api.*;
|
import org.elasticsearch.plugin.*;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.*;
|
import org.elasticsearch.plugin.scanner.test_model.*;
|
||||||
@NamedComponent("a_component")
|
@NamedComponent("a_component")
|
||||||
public class A extends ExtensibleClass {}
|
public class A extends ExtensibleClass {}
|
||||||
"""), "p/B.class", InMemoryJavaCompiler.compile("p.B", """
|
"""), "p/B.class", InMemoryJavaCompiler.compile("p.B", """
|
||||||
package p;
|
package p;
|
||||||
import org.elasticsearch.plugin.api.*;
|
import org.elasticsearch.plugin.*;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.*;
|
import org.elasticsearch.plugin.scanner.test_model.*;
|
||||||
@NamedComponent("b_component")
|
@NamedComponent("b_component")
|
||||||
public class B implements ExtensibleInterface{}
|
public class B implements ExtensibleInterface{}
|
||||||
|
@ -107,7 +107,7 @@ public class NamedComponentScannerTests extends ESTestCase {
|
||||||
"p.CustomExtensibleInterface",
|
"p.CustomExtensibleInterface",
|
||||||
"""
|
"""
|
||||||
package p;
|
package p;
|
||||||
import org.elasticsearch.plugin.api.*;
|
import org.elasticsearch.plugin.*;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.*;
|
import org.elasticsearch.plugin.scanner.test_model.*;
|
||||||
public interface CustomExtensibleInterface extends ExtensibleInterface {}
|
public interface CustomExtensibleInterface extends ExtensibleInterface {}
|
||||||
""",
|
""",
|
||||||
|
@ -115,14 +115,14 @@ public class NamedComponentScannerTests extends ESTestCase {
|
||||||
"p.CustomExtensibleClass",
|
"p.CustomExtensibleClass",
|
||||||
"""
|
"""
|
||||||
package p;
|
package p;
|
||||||
import org.elasticsearch.plugin.api.*;
|
import org.elasticsearch.plugin.*;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.*;
|
import org.elasticsearch.plugin.scanner.test_model.*;
|
||||||
public class CustomExtensibleClass implements CustomExtensibleInterface {}
|
public class CustomExtensibleClass implements CustomExtensibleInterface {}
|
||||||
""",
|
""",
|
||||||
"p.A",
|
"p.A",
|
||||||
"""
|
"""
|
||||||
package p;
|
package p;
|
||||||
import org.elasticsearch.plugin.api.*;
|
import org.elasticsearch.plugin.*;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.*;
|
import org.elasticsearch.plugin.scanner.test_model.*;
|
||||||
@NamedComponent("a_component")
|
@NamedComponent("a_component")
|
||||||
public class A extends CustomExtensibleClass {}
|
public class A extends CustomExtensibleClass {}
|
||||||
|
@ -130,7 +130,7 @@ public class NamedComponentScannerTests extends ESTestCase {
|
||||||
"p.B",
|
"p.B",
|
||||||
"""
|
"""
|
||||||
package p;
|
package p;
|
||||||
import org.elasticsearch.plugin.api.*;
|
import org.elasticsearch.plugin.*;
|
||||||
import org.elasticsearch.plugin.scanner.test_model.*;
|
import org.elasticsearch.plugin.scanner.test_model.*;
|
||||||
@NamedComponent("b_component")
|
@NamedComponent("b_component")
|
||||||
public class B implements CustomExtensibleInterface{}
|
public class B implements CustomExtensibleInterface{}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner.test_model;
|
package org.elasticsearch.plugin.scanner.test_model;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
|
|
||||||
@Extensible
|
@Extensible
|
||||||
public class ExtensibleClass {}
|
public class ExtensibleClass {}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner.test_model;
|
package org.elasticsearch.plugin.scanner.test_model;
|
||||||
|
|
||||||
import org.elasticsearch.plugin.api.Extensible;
|
import org.elasticsearch.plugin.Extensible;
|
||||||
|
|
||||||
@Extensible
|
@Extensible
|
||||||
public interface ExtensibleInterface {}
|
public interface ExtensibleInterface {}
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
|
|
||||||
package org.elasticsearch.plugin.scanner.test_model;
|
package org.elasticsearch.plugin.scanner.test_model;
|
||||||
|
|
||||||
@org.elasticsearch.plugin.api.NamedComponent("test_named_component")
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
|
|
||||||
|
@NamedComponent("test_named_component")
|
||||||
public class TestNamedComponent implements ExtensibleInterface {
|
public class TestNamedComponent implements ExtensibleInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@ module org.elasticsearch.server {
|
||||||
requires org.elasticsearch.securesm;
|
requires org.elasticsearch.securesm;
|
||||||
requires org.elasticsearch.xcontent;
|
requires org.elasticsearch.xcontent;
|
||||||
requires org.elasticsearch.logging;
|
requires org.elasticsearch.logging;
|
||||||
requires org.elasticsearch.plugin.api;
|
requires org.elasticsearch.plugin;
|
||||||
requires org.elasticsearch.plugin.analysis.api;
|
requires org.elasticsearch.plugin.analysis;
|
||||||
|
|
||||||
requires com.sun.jna;
|
requires com.sun.jna;
|
||||||
requires hppc;
|
requires hppc;
|
||||||
|
|
|
@ -12,11 +12,11 @@ import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.plugin.api.settings.BooleanSetting;
|
import org.elasticsearch.plugin.settings.BooleanSetting;
|
||||||
import org.elasticsearch.plugin.api.settings.IntSetting;
|
import org.elasticsearch.plugin.settings.IntSetting;
|
||||||
import org.elasticsearch.plugin.api.settings.ListSetting;
|
import org.elasticsearch.plugin.settings.ListSetting;
|
||||||
import org.elasticsearch.plugin.api.settings.LongSetting;
|
import org.elasticsearch.plugin.settings.LongSetting;
|
||||||
import org.elasticsearch.plugin.api.settings.StringSetting;
|
import org.elasticsearch.plugin.settings.StringSetting;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
|
|
|
@ -15,8 +15,13 @@ import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.IndexSettings;
|
import org.elasticsearch.index.IndexSettings;
|
||||||
import org.elasticsearch.indices.analysis.AnalysisModule;
|
import org.elasticsearch.indices.analysis.AnalysisModule;
|
||||||
import org.elasticsearch.plugin.api.Inject;
|
import org.elasticsearch.plugin.Inject;
|
||||||
import org.elasticsearch.plugin.api.settings.AnalysisSettings;
|
import org.elasticsearch.plugin.analysis.AnalysisMode;
|
||||||
|
import org.elasticsearch.plugin.analysis.AnalyzerFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.TokenFilterFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.TokenizerFactory;
|
||||||
|
import org.elasticsearch.plugin.settings.AnalysisSettings;
|
||||||
import org.elasticsearch.plugins.scanners.PluginInfo;
|
import org.elasticsearch.plugins.scanners.PluginInfo;
|
||||||
import org.elasticsearch.plugins.scanners.StablePluginsRegistry;
|
import org.elasticsearch.plugins.scanners.StablePluginsRegistry;
|
||||||
|
|
||||||
|
@ -38,41 +43,25 @@ public class StableApiWrappers {
|
||||||
public static
|
public static
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.CharFilterFactory>>
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.CharFilterFactory>>
|
||||||
oldApiForStableCharFilterFactory(StablePluginsRegistry stablePluginRegistry) {
|
oldApiForStableCharFilterFactory(StablePluginsRegistry stablePluginRegistry) {
|
||||||
return mapStablePluginApiToOld(
|
return mapStablePluginApiToOld(stablePluginRegistry, CharFilterFactory.class, StableApiWrappers::wrapCharFilterFactory);
|
||||||
stablePluginRegistry,
|
|
||||||
org.elasticsearch.plugin.analysis.api.CharFilterFactory.class,
|
|
||||||
StableApiWrappers::wrapCharFilterFactory
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static
|
public static
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenFilterFactory>>
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenFilterFactory>>
|
||||||
oldApiForTokenFilterFactory(StablePluginsRegistry stablePluginRegistry) {
|
oldApiForTokenFilterFactory(StablePluginsRegistry stablePluginRegistry) {
|
||||||
return mapStablePluginApiToOld(
|
return mapStablePluginApiToOld(stablePluginRegistry, TokenFilterFactory.class, StableApiWrappers::wrapTokenFilterFactory);
|
||||||
stablePluginRegistry,
|
|
||||||
org.elasticsearch.plugin.analysis.api.TokenFilterFactory.class,
|
|
||||||
StableApiWrappers::wrapTokenFilterFactory
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenizerFactory>> oldApiForTokenizerFactory(
|
public static Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenizerFactory>> oldApiForTokenizerFactory(
|
||||||
StablePluginsRegistry stablePluginRegistry
|
StablePluginsRegistry stablePluginRegistry
|
||||||
) {
|
) {
|
||||||
return mapStablePluginApiToOld(
|
return mapStablePluginApiToOld(stablePluginRegistry, TokenizerFactory.class, StableApiWrappers::wrapTokenizerFactory);
|
||||||
stablePluginRegistry,
|
|
||||||
org.elasticsearch.plugin.analysis.api.TokenizerFactory.class,
|
|
||||||
StableApiWrappers::wrapTokenizerFactory
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static
|
public static
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>>
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>>
|
||||||
oldApiForAnalyzerFactory(StablePluginsRegistry stablePluginRegistry) {
|
oldApiForAnalyzerFactory(StablePluginsRegistry stablePluginRegistry) {
|
||||||
return mapStablePluginApiToOld(
|
return mapStablePluginApiToOld(stablePluginRegistry, AnalyzerFactory.class, StableApiWrappers::wrapAnalyzerFactory);
|
||||||
stablePluginRegistry,
|
|
||||||
org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class,
|
|
||||||
StableApiWrappers::wrapAnalyzerFactory
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T, F> Map<String, AnalysisModule.AnalysisProvider<T>> mapStablePluginApiToOld(
|
private static <T, F> Map<String, AnalysisModule.AnalysisProvider<T>> mapStablePluginApiToOld(
|
||||||
|
@ -106,9 +95,7 @@ public class StableApiWrappers {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static org.elasticsearch.index.analysis.CharFilterFactory wrapCharFilterFactory(
|
private static org.elasticsearch.index.analysis.CharFilterFactory wrapCharFilterFactory(CharFilterFactory charFilterFactory) {
|
||||||
org.elasticsearch.plugin.analysis.api.CharFilterFactory charFilterFactory
|
|
||||||
) {
|
|
||||||
return new org.elasticsearch.index.analysis.CharFilterFactory() {
|
return new org.elasticsearch.index.analysis.CharFilterFactory() {
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
|
@ -127,9 +114,7 @@ public class StableApiWrappers {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static org.elasticsearch.index.analysis.TokenFilterFactory wrapTokenFilterFactory(
|
private static org.elasticsearch.index.analysis.TokenFilterFactory wrapTokenFilterFactory(TokenFilterFactory f) {
|
||||||
org.elasticsearch.plugin.analysis.api.TokenFilterFactory f
|
|
||||||
) {
|
|
||||||
return new org.elasticsearch.index.analysis.TokenFilterFactory() {
|
return new org.elasticsearch.index.analysis.TokenFilterFactory() {
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
|
@ -151,17 +136,13 @@ public class StableApiWrappers {
|
||||||
return mapAnalysisMode(f.getAnalysisMode());
|
return mapAnalysisMode(f.getAnalysisMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
private org.elasticsearch.index.analysis.AnalysisMode mapAnalysisMode(
|
private org.elasticsearch.index.analysis.AnalysisMode mapAnalysisMode(AnalysisMode analysisMode) {
|
||||||
org.elasticsearch.plugin.analysis.api.AnalysisMode analysisMode
|
|
||||||
) {
|
|
||||||
return org.elasticsearch.index.analysis.AnalysisMode.valueOf(analysisMode.name());
|
return org.elasticsearch.index.analysis.AnalysisMode.valueOf(analysisMode.name());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static org.elasticsearch.index.analysis.TokenizerFactory wrapTokenizerFactory(
|
private static org.elasticsearch.index.analysis.TokenizerFactory wrapTokenizerFactory(TokenizerFactory f) {
|
||||||
org.elasticsearch.plugin.analysis.api.TokenizerFactory f
|
|
||||||
) {
|
|
||||||
return new org.elasticsearch.index.analysis.TokenizerFactory() {
|
return new org.elasticsearch.index.analysis.TokenizerFactory() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -176,9 +157,7 @@ public class StableApiWrappers {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static org.elasticsearch.index.analysis.AnalyzerProvider<?> wrapAnalyzerFactory(
|
private static org.elasticsearch.index.analysis.AnalyzerProvider<?> wrapAnalyzerFactory(AnalyzerFactory f) {
|
||||||
org.elasticsearch.plugin.analysis.api.AnalyzerFactory f
|
|
||||||
) {
|
|
||||||
return new org.elasticsearch.index.analysis.AnalyzerProvider<>() {
|
return new org.elasticsearch.index.analysis.AnalyzerProvider<>() {
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
|
|
|
@ -10,6 +10,7 @@ package org.elasticsearch.plugins.scanners;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.elasticsearch.plugin.Extensible;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ import static org.elasticsearch.core.Strings.format;
|
||||||
* "E2" : "E2"
|
* "E2" : "E2"
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @see org.elasticsearch.plugin.api.Extensible
|
* @see Extensible
|
||||||
*/
|
*/
|
||||||
public class ExtensiblesRegistry {
|
public class ExtensiblesRegistry {
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class StablePluginsRegistry {
|
||||||
effectively means that an interface which extends another interface marked with @Extensible is also extensible
|
effectively means that an interface which extends another interface marked with @Extensible is also extensible
|
||||||
NameToPluginInfo map is a map of Name to PluginInfo
|
NameToPluginInfo map is a map of Name to PluginInfo
|
||||||
i.e.
|
i.e.
|
||||||
org.elasticsearch.plugin.analysis.api.TokenFilterFactory ->
|
org.elasticsearch.plugin.analysis.TokenFilterFactory ->
|
||||||
{"nori" -> {nori, org.elasticserach.plugin.analysis.new_nori.NoriReadingFormFilterFactory, classloaderInstance}
|
{"nori" -> {nori, org.elasticserach.plugin.analysis.new_nori.NoriReadingFormFilterFactory, classloaderInstance}
|
||||||
*/
|
*/
|
||||||
private final Map<String /*Extensible */, NameToPluginInfo> namedComponents;
|
private final Map<String /*Extensible */, NameToPluginInfo> namedComponents;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"org.elasticsearch.plugin.analysis.api.AnalyzerFactory":"org.elasticsearch.plugin.analysis.api.AnalyzerFactory",
|
"org.elasticsearch.plugin.analysis.AnalyzerFactory":"org.elasticsearch.plugin.analysis.api.AnalyzerFactory",
|
||||||
"org.elasticsearch.plugin.analysis.api.CharFilterFactory":"org.elasticsearch.plugin.analysis.api.CharFilterFactory",
|
"org.elasticsearch.plugin.analysis.CharFilterFactory":"org.elasticsearch.plugin.analysis.api.CharFilterFactory",
|
||||||
"org.elasticsearch.plugin.analysis.api.TokenFilterFactory":"org.elasticsearch.plugin.analysis.api.TokenFilterFactory",
|
"org.elasticsearch.plugin.analysis.TokenFilterFactory":"org.elasticsearch.plugin.analysis.api.TokenFilterFactory",
|
||||||
"org.elasticsearch.plugin.analysis.api.TokenizerFactory":"org.elasticsearch.plugin.analysis.api.TokenizerFactory"
|
"org.elasticsearch.plugin.analysis.TokenizerFactory":"org.elasticsearch.plugin.analysis.api.TokenizerFactory"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,10 @@ import org.elasticsearch.index.IndexSettings;
|
||||||
import org.elasticsearch.index.analysis.AnalysisRegistry;
|
import org.elasticsearch.index.analysis.AnalysisRegistry;
|
||||||
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
import org.elasticsearch.index.analysis.IndexAnalyzers;
|
||||||
import org.elasticsearch.indices.analysis.lucene.ReplaceCharToNumber;
|
import org.elasticsearch.indices.analysis.lucene.ReplaceCharToNumber;
|
||||||
import org.elasticsearch.plugin.api.Inject;
|
import org.elasticsearch.plugin.Inject;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.plugin.api.settings.AnalysisSettings;
|
import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
||||||
|
import org.elasticsearch.plugin.settings.AnalysisSettings;
|
||||||
import org.elasticsearch.plugins.scanners.NameToPluginInfo;
|
import org.elasticsearch.plugins.scanners.NameToPluginInfo;
|
||||||
import org.elasticsearch.plugins.scanners.NamedComponentReader;
|
import org.elasticsearch.plugins.scanners.NamedComponentReader;
|
||||||
import org.elasticsearch.plugins.scanners.PluginInfo;
|
import org.elasticsearch.plugins.scanners.PluginInfo;
|
||||||
|
@ -131,16 +132,13 @@ public class IncorrectSetupStablePluginsTests extends ESTestCase {
|
||||||
emptyList(),
|
emptyList(),
|
||||||
new StablePluginsRegistry(
|
new StablePluginsRegistry(
|
||||||
new NamedComponentReader(),
|
new NamedComponentReader(),
|
||||||
Map.of(
|
Map.of(CharFilterFactory.class.getCanonicalName(), new NameToPluginInfo(mapOfCharFilters))
|
||||||
org.elasticsearch.plugin.analysis.api.CharFilterFactory.class.getCanonicalName(),
|
|
||||||
new NameToPluginInfo(mapOfCharFilters)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
).getAnalysisRegistry();
|
).getAnalysisRegistry();
|
||||||
return registry;
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class AbstractCharFilterFactory implements org.elasticsearch.plugin.analysis.api.CharFilterFactory {
|
public abstract static class AbstractCharFilterFactory implements CharFilterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Reader create(Reader reader) {
|
public Reader create(Reader reader) {
|
||||||
|
|
|
@ -23,8 +23,12 @@ import org.elasticsearch.indices.analysis.lucene.AppendTokenFilter;
|
||||||
import org.elasticsearch.indices.analysis.lucene.CharSkippingTokenizer;
|
import org.elasticsearch.indices.analysis.lucene.CharSkippingTokenizer;
|
||||||
import org.elasticsearch.indices.analysis.lucene.ReplaceCharToNumber;
|
import org.elasticsearch.indices.analysis.lucene.ReplaceCharToNumber;
|
||||||
import org.elasticsearch.indices.analysis.lucene.SkipStartingWithDigitTokenFilter;
|
import org.elasticsearch.indices.analysis.lucene.SkipStartingWithDigitTokenFilter;
|
||||||
import org.elasticsearch.plugin.analysis.api.AnalysisMode;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.analysis.AnalysisMode;
|
||||||
|
import org.elasticsearch.plugin.analysis.AnalyzerFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.TokenFilterFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.TokenizerFactory;
|
||||||
import org.elasticsearch.plugins.scanners.NameToPluginInfo;
|
import org.elasticsearch.plugins.scanners.NameToPluginInfo;
|
||||||
import org.elasticsearch.plugins.scanners.NamedComponentReader;
|
import org.elasticsearch.plugins.scanners.NamedComponentReader;
|
||||||
import org.elasticsearch.plugins.scanners.PluginInfo;
|
import org.elasticsearch.plugins.scanners.PluginInfo;
|
||||||
|
@ -87,7 +91,7 @@ public class StableAnalysisPluginsNoSettingsTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableCharFilterFactory")
|
@NamedComponent("stableCharFilterFactory")
|
||||||
public static class TestCharFilterFactory implements org.elasticsearch.plugin.analysis.api.CharFilterFactory {
|
public static class TestCharFilterFactory implements CharFilterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Reader create(Reader reader) {
|
public Reader create(Reader reader) {
|
||||||
|
@ -101,7 +105,7 @@ public class StableAnalysisPluginsNoSettingsTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableTokenFilterFactory")
|
@NamedComponent("stableTokenFilterFactory")
|
||||||
public static class TestTokenFilterFactory implements org.elasticsearch.plugin.analysis.api.TokenFilterFactory {
|
public static class TestTokenFilterFactory implements TokenFilterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TokenStream create(TokenStream tokenStream) {
|
public TokenStream create(TokenStream tokenStream) {
|
||||||
|
@ -115,13 +119,13 @@ public class StableAnalysisPluginsNoSettingsTests extends ESTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnalysisMode getAnalysisMode() {
|
public AnalysisMode getAnalysisMode() {
|
||||||
return org.elasticsearch.plugin.analysis.api.TokenFilterFactory.super.getAnalysisMode();
|
return TokenFilterFactory.super.getAnalysisMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableTokenizerFactory")
|
@NamedComponent("stableTokenizerFactory")
|
||||||
public static class TestTokenizerFactory implements org.elasticsearch.plugin.analysis.api.TokenizerFactory {
|
public static class TestTokenizerFactory implements TokenizerFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tokenizer create() {
|
public Tokenizer create() {
|
||||||
|
@ -131,7 +135,7 @@ public class StableAnalysisPluginsNoSettingsTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableAnalyzerFactory")
|
@NamedComponent("stableAnalyzerFactory")
|
||||||
public static class TestAnalyzerFactory implements org.elasticsearch.plugin.analysis.api.AnalyzerFactory {
|
public static class TestAnalyzerFactory implements AnalyzerFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Analyzer create() {
|
public Analyzer create() {
|
||||||
|
@ -158,28 +162,28 @@ public class StableAnalysisPluginsNoSettingsTests extends ESTestCase {
|
||||||
new StablePluginsRegistry(
|
new StablePluginsRegistry(
|
||||||
new NamedComponentReader(),
|
new NamedComponentReader(),
|
||||||
Map.of(
|
Map.of(
|
||||||
org.elasticsearch.plugin.analysis.api.CharFilterFactory.class.getCanonicalName(),
|
CharFilterFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableCharFilterFactory",
|
"stableCharFilterFactory",
|
||||||
new PluginInfo("stableCharFilterFactory", TestCharFilterFactory.class.getName(), classLoader)
|
new PluginInfo("stableCharFilterFactory", TestCharFilterFactory.class.getName(), classLoader)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
org.elasticsearch.plugin.analysis.api.TokenFilterFactory.class.getCanonicalName(),
|
TokenFilterFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableTokenFilterFactory",
|
"stableTokenFilterFactory",
|
||||||
new PluginInfo("stableTokenFilterFactory", TestTokenFilterFactory.class.getName(), classLoader)
|
new PluginInfo("stableTokenFilterFactory", TestTokenFilterFactory.class.getName(), classLoader)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
org.elasticsearch.plugin.analysis.api.TokenizerFactory.class.getCanonicalName(),
|
TokenizerFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableTokenizerFactory",
|
"stableTokenizerFactory",
|
||||||
new PluginInfo("stableTokenizerFactory", TestTokenizerFactory.class.getName(), classLoader)
|
new PluginInfo("stableTokenizerFactory", TestTokenizerFactory.class.getName(), classLoader)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName(),
|
AnalyzerFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableAnalyzerFactory",
|
"stableAnalyzerFactory",
|
||||||
|
|
|
@ -22,15 +22,19 @@ import org.elasticsearch.indices.analysis.lucene.AppendTokenFilter;
|
||||||
import org.elasticsearch.indices.analysis.lucene.CharSkippingTokenizer;
|
import org.elasticsearch.indices.analysis.lucene.CharSkippingTokenizer;
|
||||||
import org.elasticsearch.indices.analysis.lucene.ReplaceCharToNumber;
|
import org.elasticsearch.indices.analysis.lucene.ReplaceCharToNumber;
|
||||||
import org.elasticsearch.indices.analysis.lucene.SkipStartingWithDigitTokenFilter;
|
import org.elasticsearch.indices.analysis.lucene.SkipStartingWithDigitTokenFilter;
|
||||||
import org.elasticsearch.plugin.analysis.api.AnalysisMode;
|
import org.elasticsearch.plugin.Inject;
|
||||||
import org.elasticsearch.plugin.api.Inject;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.analysis.AnalysisMode;
|
||||||
import org.elasticsearch.plugin.api.settings.AnalysisSettings;
|
import org.elasticsearch.plugin.analysis.AnalyzerFactory;
|
||||||
import org.elasticsearch.plugin.api.settings.BooleanSetting;
|
import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
||||||
import org.elasticsearch.plugin.api.settings.IntSetting;
|
import org.elasticsearch.plugin.analysis.TokenFilterFactory;
|
||||||
import org.elasticsearch.plugin.api.settings.ListSetting;
|
import org.elasticsearch.plugin.analysis.TokenizerFactory;
|
||||||
import org.elasticsearch.plugin.api.settings.LongSetting;
|
import org.elasticsearch.plugin.settings.AnalysisSettings;
|
||||||
import org.elasticsearch.plugin.api.settings.StringSetting;
|
import org.elasticsearch.plugin.settings.BooleanSetting;
|
||||||
|
import org.elasticsearch.plugin.settings.IntSetting;
|
||||||
|
import org.elasticsearch.plugin.settings.ListSetting;
|
||||||
|
import org.elasticsearch.plugin.settings.LongSetting;
|
||||||
|
import org.elasticsearch.plugin.settings.StringSetting;
|
||||||
import org.elasticsearch.plugins.scanners.NameToPluginInfo;
|
import org.elasticsearch.plugins.scanners.NameToPluginInfo;
|
||||||
import org.elasticsearch.plugins.scanners.NamedComponentReader;
|
import org.elasticsearch.plugins.scanners.NamedComponentReader;
|
||||||
import org.elasticsearch.plugins.scanners.PluginInfo;
|
import org.elasticsearch.plugins.scanners.PluginInfo;
|
||||||
|
@ -140,28 +144,28 @@ public class StableAnalysisPluginsWithSettingsTests extends ESTestCase {
|
||||||
new StablePluginsRegistry(
|
new StablePluginsRegistry(
|
||||||
new NamedComponentReader(),
|
new NamedComponentReader(),
|
||||||
Map.of(
|
Map.of(
|
||||||
org.elasticsearch.plugin.analysis.api.CharFilterFactory.class.getCanonicalName(),
|
CharFilterFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableCharFilterFactory",
|
"stableCharFilterFactory",
|
||||||
new PluginInfo("stableCharFilterFactory", TestCharFilterFactory.class.getName(), classLoader)
|
new PluginInfo("stableCharFilterFactory", TestCharFilterFactory.class.getName(), classLoader)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
org.elasticsearch.plugin.analysis.api.TokenFilterFactory.class.getCanonicalName(),
|
TokenFilterFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableTokenFilterFactory",
|
"stableTokenFilterFactory",
|
||||||
new PluginInfo("stableTokenFilterFactory", TestTokenFilterFactory.class.getName(), classLoader)
|
new PluginInfo("stableTokenFilterFactory", TestTokenFilterFactory.class.getName(), classLoader)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
org.elasticsearch.plugin.analysis.api.TokenizerFactory.class.getCanonicalName(),
|
TokenizerFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableTokenizerFactory",
|
"stableTokenizerFactory",
|
||||||
new PluginInfo("stableTokenizerFactory", TestTokenizerFactory.class.getName(), classLoader)
|
new PluginInfo("stableTokenizerFactory", TestTokenizerFactory.class.getName(), classLoader)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName(),
|
AnalyzerFactory.class.getCanonicalName(),
|
||||||
new NameToPluginInfo(
|
new NameToPluginInfo(
|
||||||
Map.of(
|
Map.of(
|
||||||
"stableAnalyzerFactory",
|
"stableAnalyzerFactory",
|
||||||
|
@ -193,7 +197,7 @@ public class StableAnalysisPluginsWithSettingsTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableAnalyzerFactory")
|
@NamedComponent("stableAnalyzerFactory")
|
||||||
public static class TestAnalyzerFactory implements org.elasticsearch.plugin.analysis.api.AnalyzerFactory {
|
public static class TestAnalyzerFactory implements AnalyzerFactory {
|
||||||
|
|
||||||
private final TestAnalysisSettings settings;
|
private final TestAnalysisSettings settings;
|
||||||
|
|
||||||
|
@ -229,7 +233,7 @@ public class StableAnalysisPluginsWithSettingsTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableCharFilterFactory")
|
@NamedComponent("stableCharFilterFactory")
|
||||||
public static class TestCharFilterFactory implements org.elasticsearch.plugin.analysis.api.CharFilterFactory {
|
public static class TestCharFilterFactory implements CharFilterFactory {
|
||||||
private final String oldChar;
|
private final String oldChar;
|
||||||
private final int newNumber;
|
private final int newNumber;
|
||||||
|
|
||||||
|
@ -252,7 +256,7 @@ public class StableAnalysisPluginsWithSettingsTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableTokenFilterFactory")
|
@NamedComponent("stableTokenFilterFactory")
|
||||||
public static class TestTokenFilterFactory implements org.elasticsearch.plugin.analysis.api.TokenFilterFactory {
|
public static class TestTokenFilterFactory implements TokenFilterFactory {
|
||||||
|
|
||||||
private final long tokenFilterNumber;
|
private final long tokenFilterNumber;
|
||||||
|
|
||||||
|
@ -273,13 +277,13 @@ public class StableAnalysisPluginsWithSettingsTests extends ESTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnalysisMode getAnalysisMode() {
|
public AnalysisMode getAnalysisMode() {
|
||||||
return org.elasticsearch.plugin.analysis.api.TokenFilterFactory.super.getAnalysisMode();
|
return TokenFilterFactory.super.getAnalysisMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("stableTokenizerFactory")
|
@NamedComponent("stableTokenizerFactory")
|
||||||
public static class TestTokenizerFactory implements org.elasticsearch.plugin.analysis.api.TokenizerFactory {
|
public static class TestTokenizerFactory implements TokenizerFactory {
|
||||||
private final java.util.List<String> tokenizerListOfChars;
|
private final java.util.List<String> tokenizerListOfChars;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
@ -14,8 +14,12 @@ import org.apache.lucene.analysis.Tokenizer;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.analysis.AnalyzerScope;
|
import org.elasticsearch.index.analysis.AnalyzerScope;
|
||||||
import org.elasticsearch.indices.analysis.AnalysisModule;
|
import org.elasticsearch.indices.analysis.AnalysisModule;
|
||||||
import org.elasticsearch.plugin.analysis.api.AnalysisMode;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.analysis.AnalysisMode;
|
||||||
|
import org.elasticsearch.plugin.analysis.AnalyzerFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.TokenFilterFactory;
|
||||||
|
import org.elasticsearch.plugin.analysis.TokenizerFactory;
|
||||||
import org.elasticsearch.plugins.scanners.PluginInfo;
|
import org.elasticsearch.plugins.scanners.PluginInfo;
|
||||||
import org.elasticsearch.plugins.scanners.StablePluginsRegistry;
|
import org.elasticsearch.plugins.scanners.StablePluginsRegistry;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
@ -36,9 +40,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
|
|
||||||
public void testUnknownClass() throws IOException {
|
public void testUnknownClass() throws IOException {
|
||||||
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
||||||
Mockito.when(
|
Mockito.when(registry.getPluginInfosForExtensible(eq(AnalyzerFactory.class.getCanonicalName())))
|
||||||
registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName()))
|
.thenReturn(List.of(new PluginInfo("namedComponentName1", "someRandomName", getClass().getClassLoader())));
|
||||||
).thenReturn(List.of(new PluginInfo("namedComponentName1", "someRandomName", getClass().getClassLoader())));
|
|
||||||
|
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>> analysisProviderMap =
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>> analysisProviderMap =
|
||||||
StableApiWrappers.oldApiForAnalyzerFactory(registry);
|
StableApiWrappers.oldApiForAnalyzerFactory(registry);
|
||||||
|
@ -56,9 +59,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
|
|
||||||
public void testStablePluginHasNoArgConstructor() throws IOException {
|
public void testStablePluginHasNoArgConstructor() throws IOException {
|
||||||
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
||||||
Mockito.when(
|
Mockito.when(registry.getPluginInfosForExtensible(eq(AnalyzerFactory.class.getCanonicalName())))
|
||||||
registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName()))
|
|
||||||
)
|
|
||||||
.thenReturn(
|
.thenReturn(
|
||||||
List.of(new PluginInfo("namedComponentName1", DefaultConstrAnalyzerFactory.class.getName(), getClass().getClassLoader()))
|
List.of(new PluginInfo("namedComponentName1", DefaultConstrAnalyzerFactory.class.getName(), getClass().getClassLoader()))
|
||||||
);
|
);
|
||||||
|
@ -79,9 +80,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
|
|
||||||
public void testAnalyzerFactoryDelegation() throws IOException {
|
public void testAnalyzerFactoryDelegation() throws IOException {
|
||||||
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
||||||
Mockito.when(
|
Mockito.when(registry.getPluginInfosForExtensible(eq(AnalyzerFactory.class.getCanonicalName())))
|
||||||
registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.AnalyzerFactory.class.getCanonicalName()))
|
.thenReturn(List.of(new PluginInfo("namedComponentName1", TestAnalyzerFactory.class.getName(), getClass().getClassLoader())));
|
||||||
).thenReturn(List.of(new PluginInfo("namedComponentName1", TestAnalyzerFactory.class.getName(), getClass().getClassLoader())));
|
|
||||||
|
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>> analysisProviderMap =
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.AnalyzerProvider<?>>> analysisProviderMap =
|
||||||
StableApiWrappers.oldApiForAnalyzerFactory(registry);
|
StableApiWrappers.oldApiForAnalyzerFactory(registry);
|
||||||
|
@ -107,9 +107,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
|
|
||||||
public void testTokenizerFactoryDelegation() throws IOException {
|
public void testTokenizerFactoryDelegation() throws IOException {
|
||||||
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
||||||
Mockito.when(
|
Mockito.when(registry.getPluginInfosForExtensible(eq(TokenizerFactory.class.getCanonicalName())))
|
||||||
registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.TokenizerFactory.class.getCanonicalName()))
|
.thenReturn(List.of(new PluginInfo("namedComponentName1", TestTokenizerFactory.class.getName(), getClass().getClassLoader())));
|
||||||
).thenReturn(List.of(new PluginInfo("namedComponentName1", TestTokenizerFactory.class.getName(), getClass().getClassLoader())));
|
|
||||||
|
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenizerFactory>> analysisProviderMap =
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenizerFactory>> analysisProviderMap =
|
||||||
StableApiWrappers.oldApiForTokenizerFactory(registry);
|
StableApiWrappers.oldApiForTokenizerFactory(registry);
|
||||||
|
@ -130,9 +129,10 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
|
|
||||||
public void testTokenFilterFactoryDelegation() throws IOException {
|
public void testTokenFilterFactoryDelegation() throws IOException {
|
||||||
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
||||||
Mockito.when(
|
Mockito.when(registry.getPluginInfosForExtensible(eq(TokenFilterFactory.class.getCanonicalName())))
|
||||||
registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.TokenFilterFactory.class.getCanonicalName()))
|
.thenReturn(
|
||||||
).thenReturn(List.of(new PluginInfo("namedComponentName1", TestTokenFilterFactory.class.getName(), getClass().getClassLoader())));
|
List.of(new PluginInfo("namedComponentName1", TestTokenFilterFactory.class.getName(), getClass().getClassLoader()))
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenFilterFactory>> analysisProviderMap =
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.TokenFilterFactory>> analysisProviderMap =
|
||||||
StableApiWrappers.oldApiForTokenFilterFactory(registry);
|
StableApiWrappers.oldApiForTokenFilterFactory(registry);
|
||||||
|
@ -168,9 +168,8 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
|
|
||||||
public void testCharFilterFactoryDelegation() throws IOException {
|
public void testCharFilterFactoryDelegation() throws IOException {
|
||||||
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
StablePluginsRegistry registry = Mockito.mock(StablePluginsRegistry.class);
|
||||||
Mockito.when(
|
Mockito.when(registry.getPluginInfosForExtensible(eq(CharFilterFactory.class.getCanonicalName())))
|
||||||
registry.getPluginInfosForExtensible(eq(org.elasticsearch.plugin.analysis.api.CharFilterFactory.class.getCanonicalName()))
|
.thenReturn(List.of(new PluginInfo("namedComponentName1", TestCharFilterFactory.class.getName(), getClass().getClassLoader())));
|
||||||
).thenReturn(List.of(new PluginInfo("namedComponentName1", TestCharFilterFactory.class.getName(), getClass().getClassLoader())));
|
|
||||||
|
|
||||||
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.CharFilterFactory>> analysisProviderMap =
|
Map<String, AnalysisModule.AnalysisProvider<org.elasticsearch.index.analysis.CharFilterFactory>> analysisProviderMap =
|
||||||
StableApiWrappers.oldApiForStableCharFilterFactory(registry);
|
StableApiWrappers.oldApiForStableCharFilterFactory(registry);
|
||||||
|
@ -198,7 +197,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("DefaultConstrAnalyzerFactory")
|
@NamedComponent("DefaultConstrAnalyzerFactory")
|
||||||
public static class DefaultConstrAnalyzerFactory implements org.elasticsearch.plugin.analysis.api.AnalyzerFactory {
|
public static class DefaultConstrAnalyzerFactory implements AnalyzerFactory {
|
||||||
|
|
||||||
public DefaultConstrAnalyzerFactory(int x) {}
|
public DefaultConstrAnalyzerFactory(int x) {}
|
||||||
|
|
||||||
|
@ -210,7 +209,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("TestAnalyzerFactory")
|
@NamedComponent("TestAnalyzerFactory")
|
||||||
public static class TestAnalyzerFactory implements org.elasticsearch.plugin.analysis.api.AnalyzerFactory {
|
public static class TestAnalyzerFactory implements AnalyzerFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Analyzer create() {
|
public Analyzer create() {
|
||||||
|
@ -220,7 +219,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("TestTokenizerFactory")
|
@NamedComponent("TestTokenizerFactory")
|
||||||
public static class TestTokenizerFactory implements org.elasticsearch.plugin.analysis.api.TokenizerFactory {
|
public static class TestTokenizerFactory implements TokenizerFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Tokenizer create() {
|
public Tokenizer create() {
|
||||||
|
@ -229,7 +228,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("TestTokenFilterFactory")
|
@NamedComponent("TestTokenFilterFactory")
|
||||||
public static class TestTokenFilterFactory implements org.elasticsearch.plugin.analysis.api.TokenFilterFactory {
|
public static class TestTokenFilterFactory implements TokenFilterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TokenStream create(TokenStream tokenStream) {
|
public TokenStream create(TokenStream tokenStream) {
|
||||||
|
@ -254,7 +253,7 @@ public class StableApiWrappersTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NamedComponent("TestCharFilterFactory")
|
@NamedComponent("TestCharFilterFactory")
|
||||||
public static class TestCharFilterFactory implements org.elasticsearch.plugin.analysis.api.CharFilterFactory {
|
public static class TestCharFilterFactory implements CharFilterFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Reader create(Reader reader) {
|
public Reader create(Reader reader) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.elasticsearch.core.Strings;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.env.TestEnvironment;
|
import org.elasticsearch.env.TestEnvironment;
|
||||||
import org.elasticsearch.index.IndexModule;
|
import org.elasticsearch.index.IndexModule;
|
||||||
import org.elasticsearch.plugin.analysis.api.CharFilterFactory;
|
import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
||||||
import org.elasticsearch.plugins.scanners.PluginInfo;
|
import org.elasticsearch.plugins.scanners.PluginInfo;
|
||||||
import org.elasticsearch.plugins.spi.BarPlugin;
|
import org.elasticsearch.plugins.spi.BarPlugin;
|
||||||
import org.elasticsearch.plugins.spi.BarTestService;
|
import org.elasticsearch.plugins.spi.BarTestService;
|
||||||
|
@ -794,8 +794,8 @@ public class PluginsServiceTests extends ESTestCase {
|
||||||
JarUtils.createJarWithEntries(jar, Map.of("p/A.class", InMemoryJavaCompiler.compile("p.A", """
|
JarUtils.createJarWithEntries(jar, Map.of("p/A.class", InMemoryJavaCompiler.compile("p.A", """
|
||||||
package p;
|
package p;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.elasticsearch.plugin.analysis.api.CharFilterFactory;
|
import org.elasticsearch.plugin.analysis.CharFilterFactory;
|
||||||
import org.elasticsearch.plugin.api.NamedComponent;
|
import org.elasticsearch.plugin.NamedComponent;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
@NamedComponent( "a_name")
|
@NamedComponent( "a_name")
|
||||||
public class A implements CharFilterFactory {
|
public class A implements CharFilterFactory {
|
||||||
|
@ -808,7 +808,7 @@ public class PluginsServiceTests extends ESTestCase {
|
||||||
Path namedComponentFile = plugin.resolve("named_components.json");
|
Path namedComponentFile = plugin.resolve("named_components.json");
|
||||||
Files.writeString(namedComponentFile, """
|
Files.writeString(namedComponentFile, """
|
||||||
{
|
{
|
||||||
"org.elasticsearch.plugin.analysis.api.CharFilterFactory": {
|
"org.elasticsearch.plugin.analysis.CharFilterFactory": {
|
||||||
"a_name": "p.A"
|
"a_name": "p.A"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,7 @@ public class PluginsServiceTests extends ESTestCase {
|
||||||
|
|
||||||
// check ubermodule classloader usage
|
// check ubermodule classloader usage
|
||||||
Collection<PluginInfo> stablePluginInfos = pluginService.getStablePluginRegistry()
|
Collection<PluginInfo> stablePluginInfos = pluginService.getStablePluginRegistry()
|
||||||
.getPluginInfosForExtensible("org.elasticsearch.plugin.analysis.api.CharFilterFactory");
|
.getPluginInfosForExtensible("org.elasticsearch.plugin.analysis.CharFilterFactory");
|
||||||
assertThat(stablePluginInfos, hasSize(1));
|
assertThat(stablePluginInfos, hasSize(1));
|
||||||
ClassLoader stablePluginClassLoader = stablePluginInfos.stream().findFirst().orElseThrow().loader();
|
ClassLoader stablePluginClassLoader = stablePluginInfos.stream().findFirst().orElseThrow().loader();
|
||||||
assertThat(stablePluginClassLoader, instanceOf(UberModuleClassLoader.class));
|
assertThat(stablePluginClassLoader, instanceOf(UberModuleClassLoader.class));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue