You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/02/17 11:24:29 UTC
[camel-quarkus] 34/34: Upgarde to Camel 3.1.0 - WIP (PDF)
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 460cc4ed58b0ea8ca4a8bb17883461a30daabe55
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Feb 17 09:32:13 2020 +0000
Upgarde to Camel 3.1.0 - WIP (PDF)
---
.../component/pdf/deployment/PdfProcessor.java | 19 +++++++++++--------
.../camel/quarkus/component/pdf/it/PdfResource.java | 2 +-
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/extensions/pdf/deployment/src/main/java/org/apache/camel/quarkus/component/pdf/deployment/PdfProcessor.java b/extensions/pdf/deployment/src/main/java/org/apache/camel/quarkus/component/pdf/deployment/PdfProcessor.java
index e7bbf14..612e673 100644
--- a/extensions/pdf/deployment/src/main/java/org/apache/camel/quarkus/component/pdf/deployment/PdfProcessor.java
+++ b/extensions/pdf/deployment/src/main/java/org/apache/camel/quarkus/component/pdf/deployment/PdfProcessor.java
@@ -19,9 +19,8 @@ package org.apache.camel.quarkus.component.pdf.deployment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
-import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
class PdfProcessor {
@@ -32,6 +31,12 @@ class PdfProcessor {
"org/apache/pdfbox/resources/glyphlist/additional.txt",
"org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf" };
+ private static final String[] RUNTIME_INITIALIZED_CLASSES = new String[] {
+ "org.apache.pdfbox.pdmodel.font.PDType1Font",
+ "org.apache.camel.component.pdf.PdfConfiguration",
+ "org.apache.camel.component.pdf.Standard14Fonts",
+ };
+
@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
@@ -43,11 +48,9 @@ class PdfProcessor {
}
@BuildStep
- NativeImageConfigBuildItem build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
- return NativeImageConfigBuildItem.builder()
- .addRuntimeInitializedClass("org.apache.pdfbox.pdmodel.font.PDType1Font")
- .addRuntimeInitializedClass("org.apache.camel.component.pdf.PdfConfiguration")
- .build();
+ void configureRuntimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClass) {
+ for (String className : RUNTIME_INITIALIZED_CLASSES) {
+ runtimeInitializedClass.produce(new RuntimeInitializedClassBuildItem(className));
+ }
}
-
}
diff --git a/integration-tests/pdf/src/main/java/org/apache/camel/quarkus/component/pdf/it/PdfResource.java b/integration-tests/pdf/src/main/java/org/apache/camel/quarkus/component/pdf/it/PdfResource.java
index c8d7bda..ffd6fa8 100644
--- a/integration-tests/pdf/src/main/java/org/apache/camel/quarkus/component/pdf/it/PdfResource.java
+++ b/integration-tests/pdf/src/main/java/org/apache/camel/quarkus/component/pdf/it/PdfResource.java
@@ -51,7 +51,7 @@ public class PdfResource {
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response createFromText(String message) throws Exception {
document = producerTemplate.requestBody(
- "pdf:create?fontSize=6&pageSize=PAGE_SIZE_A5", message, byte[].class);
+ "pdf:create?fontSize=6&pageSize=PAGE_SIZE_A5&font=Courier", message, byte[].class);
LOG.infof("The PDDocument has been created and contains %d bytes", document.length);