ppalaga commented on a change in pull request #1793:
URL: https://github.com/apache/camel-quarkus/pull/1793#discussion_r488749919



##########
File path: 
extensions/fop/deployment/src/main/java/org/apache/camel/quarkus/component/fop/deployment/FopProcessor.java
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.camel.quarkus.component.fop.deployment;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.apache.fop.render.RendererEventProducer;
+import org.apache.fop.render.pdf.PDFDocumentHandlerMaker;
+import org.apache.fop.render.pdf.extensions.PDFExtensionHandlerFactory;
+import org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry;
+import org.jboss.jandex.IndexView;
+
+class FopProcessor {
+
+    private static final String FEATURE = "camel-fop";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem 
combinedIndex) {
+        IndexView index = combinedIndex.getIndex();
+
+        List<String> dtos = index.getKnownClasses().stream()
+                .map(ci -> ci.name().toString())
+                .filter(n -> n.endsWith("ElementMapping"))
+                .sorted()
+                .collect(Collectors.toList());
+
+        dtos.add(PDFExtensionHandlerFactory.class.getCanonicalName());
+        dtos.add(PDFDocumentHandlerMaker.class.getCanonicalName());
+        dtos.add(RendererEventProducer.class.getCanonicalName());
+        dtos.add(IOException.class.getCanonicalName());
+        dtos.add(Integer.class.getCanonicalName());
+
+        return new ReflectiveClassBuildItem(false, false, dtos.toArray(new 
String[dtos.size()]));
+    }
+
+    @BuildStep
+    void addDependencies(BuildProducer<IndexDependencyBuildItem> 
indexDependency) {
+        indexDependency.produce(new 
IndexDependencyBuildItem("org.apache.xmlgraphics", "fop"));
+    }
+
+    @BuildStep
+    NativeImageResourceBuildItem initResources() {
+        return new NativeImageResourceBuildItem(
+                "META-INF/services/org.apache.fop.fo.ElementMapping",
+                
"META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler",
+                "org/apache/fop/render/event-model.xml");
+    }
+
+    @BuildStep
+    NativeImageResourceBundleBuildItem initBundles() {
+        return new NativeImageResourceBundleBuildItem(
+                "com.sun.org.apache.xerces.internal.impl.msg.SAXMessages");

Review comment:
       I have filed a follow up: 
https://github.com/apache/camel-quarkus/issues/1796 Could you please pick it 
@JiriOndrusek ?

##########
File path: 
extensions/fop/deployment/src/main/java/org/apache/camel/quarkus/component/fop/deployment/FopProcessor.java
##########
@@ -0,0 +1,97 @@
+/*
+ * 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.camel.quarkus.component.fop.deployment;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.apache.fop.render.RendererEventProducer;
+import org.apache.fop.render.pdf.PDFDocumentHandlerMaker;
+import org.apache.fop.render.pdf.extensions.PDFExtensionHandlerFactory;
+import org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry;
+import org.jboss.jandex.IndexView;
+
+class FopProcessor {
+
+    private static final String FEATURE = "camel-fop";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+    @BuildStep
+    ReflectiveClassBuildItem registerForReflection(CombinedIndexBuildItem 
combinedIndex) {
+        IndexView index = combinedIndex.getIndex();
+
+        List<String> dtos = index.getKnownClasses().stream()
+                .map(ci -> ci.name().toString())
+                .filter(n -> n.endsWith("ElementMapping"))
+                .sorted()
+                .collect(Collectors.toList());
+
+        dtos.add(PDFExtensionHandlerFactory.class.getCanonicalName());

Review comment:
       `class.getCanonicalName()` is not wrong here where it is called on a 
non-inner class. We should stick to `class.getName()` that is correct also for 
inner classes. I mean when ppl will copy-paste from here, it may not work for 
them in all situations.

##########
File path: extensions/fop/runtime/src/main/doc/limitations.adoc
##########
@@ -0,0 +1,12 @@
+While you can use any of the available output types in JVM mode, only PDF 
output type is supported
+in native mode. PDF output type in native mode has several limitations:
+
+* Default sRGB color space is disabled because of 
https://github.com/oracle/graal/issues/2850[Graal VM issue #2850]. This 
limitation makes configuration property
+`disable-srgb-colorspace` ignored. You can see more about sRGB color space in
+https://xmlgraphics.apache.org/fop/2.1/configuration.html[FOP configuration].
+
+* If custom fonts are used, font cache has to be disabled because of 
https://github.com/oracle/graal/issues/460[Graal VM issue #460].
+Please use property `<use-cache>false</use-cache>` (more information in 
https://xmlgraphics.apache.org/fop/2.1/configuration.html[FOP configuration].)

Review comment:
       ```suggestion
   Please set the https://xmlgraphics.apache.org/fop/2.1/configuration.html[FOP 
configuration property] `use-cache` to `false`.
   ```

##########
File path: extensions/fop/runtime/src/main/doc/limitations.adoc
##########
@@ -0,0 +1,12 @@
+While you can use any of the available output types in JVM mode, only PDF 
output type is supported
+in native mode. PDF output type in native mode has several limitations:
+
+* Default sRGB color space is disabled because of 
https://github.com/oracle/graal/issues/2850[Graal VM issue #2850]. This 
limitation makes configuration property
+`disable-srgb-colorspace` ignored. You can see more about sRGB color space in
+https://xmlgraphics.apache.org/fop/2.1/configuration.html[FOP configuration].

Review comment:
       ```suggestion
   * Default sRGB color space is always disabled because of 
https://github.com/oracle/graal/issues/2850[Graal VM issue #2850] and 
`disable-srgb-colorspace` 
https://xmlgraphics.apache.org/fop/2.1/configuration.html[FOP configuration 
property] is ignored.
   ```

##########
File path: 
extensions/fop/runtime/src/main/java/org/apache/camel/quarkus/component/fop/PDFRendererOptionsConfigSubstitution.java
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.camel.quarkus.component.fop;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.fop.render.pdf.PDFRendererOptionsConfig;
+
+@TargetClass(value = PDFRendererOptionsConfig.class)
+final class PDFRendererOptionsConfigSubstitution {
+
+    @Substitute
+    public Boolean getDisableSRGBColorSpace() {
+        //sRGB color space has to be disabled because of 
https://github.com/oracle/graal/issues/2850

Review comment:
       I appreciate the comment!




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to