[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-11 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r391101531
 
 

 ##
 File path: 
integration-tests/freemarker/src/main/resources/application.properties
 ##
 @@ -0,0 +1,20 @@
+## ---
+## 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.
+## ---
+#
+# Quarkus
+#
+quarkus.camel.freemarker.locations = org/apache/camel/component/freemarker
 
 Review comment:
   @ppalaga sorry for being so slow in this. I've added `includePatterns` and 
`excludePatterns`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-09 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r389517223
 
 

 ##
 File path: 
integration-tests/freemarker/src/main/resources/application.properties
 ##
 @@ -0,0 +1,20 @@
+## ---
+## 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.
+## ---
+#
+# Quarkus
+#
+quarkus.camel.freemarker.locations = org/apache/camel/component/freemarker
 
 Review comment:
   Good point @ppalaga . Files with different extensions should still work. I 
agree and we should include the whole subtree but just to avoid adding files we 
don't want to add we can use `includePatterns` and `excludePatterns` as you 
suggested. Let me add it


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-09 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r389515876
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java
 ##
 @@ -0,0 +1,136 @@
+/*
+ * 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.freemarker.deployment;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import org.apache.camel.quarkus.component.freemarker.CamelFreemarkerConfig;
+import org.apache.commons.io.FilenameUtils;
+import org.jboss.logging.Logger;
+
+class FreemarkerNativeImageProcessor {
+private static final String CLASSPATH_APPLICATION_MIGRATIONS_PROTOCOL = 
"classpath";
+private static final String JAR_APPLICATION_MIGRATIONS_PROTOCOL = "jar";
+private static final String FILE_APPLICATION_MIGRATIONS_PROTOCOL = "file";
+
+private static final Logger LOGGER = 
Logger.getLogger(FreemarkerNativeImageProcessor.class);
+
+@BuildStep(loadsApplicationClasses = true)
+void build(
+BuildProducer resourceProducer,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+registerNativeImageResources(resourceProducer, camelFreemarkerConfig);
+}
+
+private void registerNativeImageResources(
+BuildProducer resource,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+List templates = 
discoverFreemarkerTemplates(camelFreemarkerConfig);
+final List nativeResources = new ArrayList<>(templates);
+resource.produce(new 
NativeImageResourceBuildItem(nativeResources.toArray(new String[0])));
+}
+
+private List discoverFreemarkerTemplates(
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+List resources = new ArrayList<>();
+try {
+List locations = new 
ArrayList<>(camelFreemarkerConfig.locations);
+if (locations.isEmpty()) {
+locations.add("freemarker/templates");
+}
+
+// Locations can be a comma separated list
+for (String location : locations) {
+// Strip any 'classpath:' protocol prefixes because they are 
assumed
+// but not recognized by ClassLoader.getResources()
+if (location != null && 
location.startsWith(CLASSPATH_APPLICATION_MIGRATIONS_PROTOCOL + ':')) {
 
 Review comment:
   @ppalaga good point. I've verified that `my/path1,,my/path2` will cause just 
2 locations but `my/path1, ,my/path2` (notice the blank space) will generate 3 
locations and generate an exception... I've added a basic filter to validate it 
https://github.com/carlosthe19916/camel-quarkus/blob/7c027254d03024ec7d64aeffd040ae05da4677ff/extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java#L66
   
   I also added this case to the test here 
https://github.com/carlosthe19916/camel-quarkus/blob/7c027254d03024ec7d64aeffd040ae05da4677ff/integration-tests/freemarker/src/main/resources/application.properties#L20


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 I

[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-09 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r389512742
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java
 ##
 @@ -0,0 +1,136 @@
+/*
+ * 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.freemarker.deployment;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import org.apache.camel.quarkus.component.freemarker.CamelFreemarkerConfig;
+import org.apache.commons.io.FilenameUtils;
+import org.jboss.logging.Logger;
+
+class FreemarkerNativeImageProcessor {
+private static final String CLASSPATH_APPLICATION_MIGRATIONS_PROTOCOL = 
"classpath";
+private static final String JAR_APPLICATION_MIGRATIONS_PROTOCOL = "jar";
+private static final String FILE_APPLICATION_MIGRATIONS_PROTOCOL = "file";
+
+private static final Logger LOGGER = 
Logger.getLogger(FreemarkerNativeImageProcessor.class);
+
+@BuildStep(loadsApplicationClasses = true)
+void build(
+BuildProducer resourceProducer,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+registerNativeImageResources(resourceProducer, camelFreemarkerConfig);
+}
+
+private void registerNativeImageResources(
+BuildProducer resource,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+List templates = 
discoverFreemarkerTemplates(camelFreemarkerConfig);
+final List nativeResources = new ArrayList<>(templates);
+resource.produce(new 
NativeImageResourceBuildItem(nativeResources.toArray(new String[0])));
+}
+
+private List discoverFreemarkerTemplates(
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+List resources = new ArrayList<>();
+try {
+List locations = new 
ArrayList<>(camelFreemarkerConfig.locations);
+if (locations.isEmpty()) {
+locations.add("freemarker/templates");
 
 Review comment:
   I've added the default location `freemarker/templates` to 
CamelFreemarkerConfig and also added some docs in 
`docs/modules/ROOT/pages/extensions/freemarker.adoc`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-04 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r387728766
 
 

 ##
 File path: extensions/freemarker/runtime/pom.xml
 ##
 @@ -0,0 +1,82 @@
+
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+4.0.0
+
+org.apache.camel.quarkus
+camel-quarkus-freemarker-parent
+1.1.0-SNAPSHOT
+../pom.xml
+
+
+camel-quarkus-freemarker
+Camel Quarkus :: Freemarker :: Runtime
+
+
+0.4.0
 
 Review comment:
   done


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-04 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r387698284
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java
 ##
 @@ -0,0 +1,136 @@
+/*
+ * 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.freemarker.deployment;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import org.apache.camel.quarkus.component.freemarker.CamelFreemarkerConfig;
+import org.apache.commons.io.FilenameUtils;
+import org.jboss.logging.Logger;
+
+class FreemarkerNativeImageProcessor {
+private static final String CLASSPATH_APPLICATION_MIGRATIONS_PROTOCOL = 
"classpath";
+private static final String JAR_APPLICATION_MIGRATIONS_PROTOCOL = "jar";
+private static final String FILE_APPLICATION_MIGRATIONS_PROTOCOL = "file";
+
+private static final Logger LOGGER = 
Logger.getLogger(FreemarkerNativeImageProcessor.class);
+
+@BuildStep(loadsApplicationClasses = true)
+void build(
+BuildProducer resourceProducer,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+registerNativeImageResources(resourceProducer, camelFreemarkerConfig);
 
 Review comment:
   done


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-04 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r387694745
 
 

 ##
 File path: 
integration-tests/freemarker/src/main/resources/application.properties
 ##
 @@ -0,0 +1,20 @@
+## ---
+## 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.
+## ---
+#
+# Quarkus
+#
+quarkus.camel.freemarker.locations = org/apache/camel/component/freemarker
 
 Review comment:
   Only files with the extension `.ftl` will be included. You can see there is 
a filter for that 
[here](https://github.com/carlosthe19916/camel-quarkus/blob/7d45a783e5b27d341b6a07df49b34087f636dad3/extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java#L119)...
 I've also created 2 native images, the first one using 
`org/apache/camel/component/freemarker` and the second one using 
`myfreemarkerfolder` and the sizes are exactly the same (45.8 MB)


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-04 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r387663697
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java
 ##
 @@ -0,0 +1,136 @@
+/*
+ * 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.freemarker.deployment;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import org.apache.camel.quarkus.component.freemarker.CamelFreemarkerConfig;
+import org.apache.commons.io.FilenameUtils;
+import org.jboss.logging.Logger;
+
+class FreemarkerNativeImageProcessor {
+private static final String CLASSPATH_APPLICATION_MIGRATIONS_PROTOCOL = 
"classpath";
+private static final String JAR_APPLICATION_MIGRATIONS_PROTOCOL = "jar";
+private static final String FILE_APPLICATION_MIGRATIONS_PROTOCOL = "file";
+
+private static final Logger LOGGER = 
Logger.getLogger(FreemarkerNativeImageProcessor.class);
+
+@BuildStep(loadsApplicationClasses = true)
+void build(
+BuildProducer resourceProducer,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+registerNativeImageResources(resourceProducer, camelFreemarkerConfig);
+}
+
+private void registerNativeImageResources(
+BuildProducer resource,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+List templates = 
discoverFreemarkerTemplates(camelFreemarkerConfig);
+final List nativeResources = new ArrayList<>(templates);
+resource.produce(new 
NativeImageResourceBuildItem(nativeResources.toArray(new String[0])));
+}
+
+private List discoverFreemarkerTemplates(
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+List resources = new ArrayList<>();
+try {
+List locations = new 
ArrayList<>(camelFreemarkerConfig.locations);
+if (locations.isEmpty()) {
+locations.add("freemarker/templates");
+}
+
+// Locations can be a comma separated list
+for (String location : locations) {
+// Strip any 'classpath:' protocol prefixes because they are 
assumed
+// but not recognized by ClassLoader.getResources()
+if (location != null && 
location.startsWith(CLASSPATH_APPLICATION_MIGRATIONS_PROTOCOL + ':')) {
 
 Review comment:
   my mistake, it shouldn't be possible to have null values since it comes from 
`CamelFreemarkerConfig`


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-04 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r387662659
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java
 ##
 @@ -0,0 +1,136 @@
+/*
+ * 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.freemarker.deployment;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import 
io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import org.apache.camel.quarkus.component.freemarker.CamelFreemarkerConfig;
+import org.apache.commons.io.FilenameUtils;
+import org.jboss.logging.Logger;
+
+class FreemarkerNativeImageProcessor {
+private static final String CLASSPATH_APPLICATION_MIGRATIONS_PROTOCOL = 
"classpath";
+private static final String JAR_APPLICATION_MIGRATIONS_PROTOCOL = "jar";
+private static final String FILE_APPLICATION_MIGRATIONS_PROTOCOL = "file";
+
+private static final Logger LOGGER = 
Logger.getLogger(FreemarkerNativeImageProcessor.class);
+
+@BuildStep(loadsApplicationClasses = true)
+void build(
+BuildProducer resourceProducer,
+CamelFreemarkerConfig camelFreemarkerConfig) throws IOException, 
URISyntaxException {
+registerNativeImageResources(resourceProducer, camelFreemarkerConfig);
 
 Review comment:
   Thanks for the good advice, I'll do it inline just like you suggested :)


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-04 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r387661984
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerProcessor.java
 ##
 @@ -0,0 +1,54 @@
+/*
+ * 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.freemarker.deployment;
+
+import freemarker.ext.jython.JythonModel;
+import freemarker.ext.jython.JythonWrapper;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.apache.camel.Exchange;
+import org.apache.camel.support.DefaultExchange;
+
+class FreemarkerProcessor {
+private static final String FEATURE = "camel-freemarker";
+
+@BuildStep
+FeatureBuildItem feature() {
+return new FeatureBuildItem(FEATURE);
+}
+
+@BuildStep
+RuntimeInitializedClassBuildItem jythonModel() {
+return new 
RuntimeInitializedClassBuildItem(JythonModel.class.getCanonicalName());
+}
+
+@BuildStep
+RuntimeInitializedClassBuildItem jythonWrapper() {
+return new 
RuntimeInitializedClassBuildItem(JythonWrapper.class.getCanonicalName());
+}
+
+@BuildStep
+void registerForReflection(BuildProducer 
reflectiveClass) {
+reflectiveClass.produce(new ReflectiveClassBuildItem(true, true,
+Exchange.class,
 
 Review comment:
   Yes, adding Exchange for reflection is needed. According to this 
documentation: [freemarker 
context](https://camel.apache.org/components/latest/freemarker-component.html#_freemarker_context),
 it should be possible to use `exchange.properties` in the `.ftl` templates 
just like this example: 
https://github.com/carlosthe19916/camel-quarkus/blob/7d45a783e5b27d341b6a07df49b34087f636dad3/integration-tests/freemarker/src/main/resources/org/apache/camel/component/freemarker/example.ftl#L19.
 Without using reflection for Exchange it won't work.


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-04 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r387659823
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerProcessor.java
 ##
 @@ -0,0 +1,54 @@
+/*
+ * 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.freemarker.deployment;
+
+import freemarker.ext.jython.JythonModel;
+import freemarker.ext.jython.JythonWrapper;
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.apache.camel.Exchange;
+import org.apache.camel.support.DefaultExchange;
+
+class FreemarkerProcessor {
+private static final String FEATURE = "camel-freemarker";
+
+@BuildStep
+FeatureBuildItem feature() {
+return new FeatureBuildItem(FEATURE);
+}
+
+@BuildStep
+RuntimeInitializedClassBuildItem jythonModel() {
+return new 
RuntimeInitializedClassBuildItem(JythonModel.class.getCanonicalName());
+}
+
+@BuildStep
+RuntimeInitializedClassBuildItem jythonWrapper() {
+return new 
RuntimeInitializedClassBuildItem(JythonWrapper.class.getCanonicalName());
+}
+
+@BuildStep
+void registerForReflection(BuildProducer 
reflectiveClass) {
+reflectiveClass.produce(new ReflectiveClassBuildItem(true, true,
 
 Review comment:
   You're right, I'll update that, Thanks :)


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:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [camel-quarkus] carlosthe19916 commented on a change in pull request #835: Camel-freemarker component

2020-03-03 Thread GitBox
carlosthe19916 commented on a change in pull request #835: Camel-freemarker 
component
URL: https://github.com/apache/camel-quarkus/pull/835#discussion_r386894794
 
 

 ##
 File path: 
extensions/freemarker/deployment/src/main/java/org/apache/camel/quarkus/component/freemarker/deployment/FreemarkerNativeImageProcessor.java
 ##
 @@ -0,0 +1,120 @@
+package org.apache.camel.quarkus.component.freemarker.deployment;
 
 Review comment:
   @oscerd Added, thanks


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:
us...@infra.apache.org


With regards,
Apache Git Services