This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch TIKA-4544
in repository https://gitbox.apache.org/repos/asf/tika.git


The following commit(s) were added to refs/heads/TIKA-4544 by this push:
     new c182b0ccf TIKA-4543 -- git add
c182b0ccf is described below

commit c182b0ccf13cfb6a9c11b2be99dcd51a83fe4bdd
Author: tallison <[email protected]>
AuthorDate: Mon Nov 24 13:52:45 2025 -0500

    TIKA-4543 -- git add
---
 .../java/org/apache/tika/config/TikaComponent.java | 64 ++++++++++++++++++++++
 .../services/org.apache.tika.parser.Parser         |  5 ++
 .../src/test/resources/META-INF/tika/parsers.idx   |  6 ++
 3 files changed, 75 insertions(+)

diff --git a/tika-core/src/main/java/org/apache/tika/config/TikaComponent.java 
b/tika-core/src/main/java/org/apache/tika/config/TikaComponent.java
new file mode 100644
index 000000000..1505e33e5
--- /dev/null
+++ b/tika-core/src/main/java/org/apache/tika/config/TikaComponent.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.config;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for Tika components (parsers, detectors, etc.) that enables:
+ * <ul>
+ *   <li>Automatic SPI file generation (META-INF/services/...)</li>
+ *   <li>Name-based component registry for JSON configuration</li>
+ * </ul>
+ *
+ * <p>The annotation processor generates:
+ * <ul>
+ *   <li>Standard Java SPI files for ServiceLoader</li>
+ *   <li>Component index files (META-INF/tika/{type}.idx) for name-based 
lookup</li>
+ * </ul>
+ *
+ * <p>Example usage:
+ * <pre>
+ * {@code @TikaComponent}
+ * public class PDFParser extends AbstractParser {
+ *     // auto-generates name "pdf-parser"
+ * }
+ *
+ * {@code @TikaComponent(name = "tesseract-ocr")}
+ * public class TesseractOCRParser extends AbstractParser {
+ *     // explicit name override
+ * }
+ * </pre>
+ *
+ * @since 3.1.0
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+public @interface TikaComponent {
+
+    /**
+     * The component name used in JSON configuration. If empty, the name is
+     * automatically generated from the class name using kebab-case conversion
+     * (e.g., PDFParser becomes "pdf-parser").
+     *
+     * @return the component name, or empty string for auto-generation
+     */
+    String name() default "";
+}
diff --git 
a/tika-serialization/src/test/resources/META-INF/services/org.apache.tika.parser.Parser
 
b/tika-serialization/src/test/resources/META-INF/services/org.apache.tika.parser.Parser
new file mode 100644
index 000000000..bfaa7e36d
--- /dev/null
+++ 
b/tika-serialization/src/test/resources/META-INF/services/org.apache.tika.parser.Parser
@@ -0,0 +1,5 @@
+# Generated by TikaComponentProcessor
+# Do not edit manually
+org.apache.tika.config.loader.ConfigurableTestParser
+org.apache.tika.config.loader.FallbackTestParser
+org.apache.tika.config.loader.MinimalTestParser
diff --git a/tika-serialization/src/test/resources/META-INF/tika/parsers.idx 
b/tika-serialization/src/test/resources/META-INF/tika/parsers.idx
new file mode 100644
index 000000000..79359402a
--- /dev/null
+++ b/tika-serialization/src/test/resources/META-INF/tika/parsers.idx
@@ -0,0 +1,6 @@
+# Generated by TikaComponentProcessor
+# Do not edit manually
+# Format: component-name=fully.qualified.ClassName
+configurable-test-parser=org.apache.tika.config.loader.ConfigurableTestParser
+fallback-test-parser=org.apache.tika.config.loader.FallbackTestParser
+minimal-test-parser=org.apache.tika.config.loader.MinimalTestParser

Reply via email to