JiriOndrusek commented on code in PR #9078:
URL: https://github.com/apache/camel-quarkus/pull/9078#discussion_r3912294206
##########
extensions/langchain4j-ingest/deployment/src/main/java/org/apache/camel/quarkus/component/langchain4j/ingest/deployment/Langchain4jIngestProcessor.java:
##########
@@ -68,11 +74,93 @@ FeatureBuildItem feature() {
@BuildStep
AdditionalBeanBuildItem beans() {
return AdditionalBeanBuildItem.builder()
- .addBeanClasses(IngestRoutes.class)
+ .addBeanClasses(IngestRoutes.class, IngestBeanResolver.class)
.setUnremovable()
.build();
}
+ /**
+ * The documented PDF recipe adds {@code tika-parser-pdf-module}, which
drags
+ * {@code jaxb-runtime} → {@code angus-activation} into the image. Angus'
own GraalVM
+ * feature then reflects over every registered data-content handler and
crashes on
+ * BouncyCastle's S/MIME handlers ({@code bcjmail}'s mailcap references
+ * {@code jakarta.mail.Part}, and jakarta.mail is not on the classpath).
The feature only
+ * registers mailcap handlers, which nothing on the ingest path uses, so
its registration
+ * is excluded — but only in the constellation that crashes: PDFBox
present (the recipe) and
+ * jakarta.mail absent. An application that uses mail and angus for real
keeps its feature.
+ */
+ @BuildStep
+ void excludeAngusActivationFeature(BuildProducer<ExcludeConfigBuildItem>
excludeConfig) {
+ if
(!QuarkusClassLoader.isClassPresentAtRuntime("org.apache.pdfbox.pdmodel.PDDocument")
+ ||
QuarkusClassLoader.isClassPresentAtRuntime("jakarta.mail.Part")) {
+ return;
+ }
+ excludeConfig.produce(new
ExcludeConfigBuildItem("org\\.eclipse\\.angus\\.angus-activation-.*\\.jar",
+
"/META-INF/native-image/org.eclipse.angus/angus-activation/native-image.properties"));
+ }
+
+ /**
+ * The same recipe brings PDFBox itself. Native image needs its
AWT-touching classes
+ * initialized at run time and its font metrics, glyph lists and ICC
profile embedded —
+ * mirroring the camel-quarkus-pdf extension's registrations, widened to
the rendering and
+ * graphics packages that Tika's text extraction reaches and camel-pdf
does not. Produced
+ * only when PDFBox is on the classpath.
+ */
+ @BuildStep
+ void pdfboxInNative(
Review Comment:
Deliberate: camel-quarkus-tika doesn't provide PDF parsing out of the box
(camel-tika ships only the html and text parser modules), nor any native config
for it — while this extension documents the PDF recipe and its native ITs
exercise it. Filed #9087 to home the native config in camel-quarkus-tika as a
follow-up. Everything here is classpath-gated, so nothing activates without
PDFBox.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]