You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/06/10 14:06:31 UTC
[camel-quarkus] branch master updated: Fix #1066 Remove the need
for registering RestBindingJaxbDataFormatFactory service
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 744b5ef Fix #1066 Remove the need for registering RestBindingJaxbDataFormatFactory service
744b5ef is described below
commit 744b5efcb645523dc5e52b48c684b0f41e0ae87a
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Jun 10 11:39:52 2020 +0200
Fix #1066 Remove the need for registering RestBindingJaxbDataFormatFactory service
---
.../quarkus/core/deployment/BuildProcessor.java | 10 --------
.../component/jaxb/deployment/JaxbProcessor.java | 10 ++++++++
.../quarkus/component/jaxb/JaxbRecorder.java} | 29 +++++++++-------------
3 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
index 77464e1..54d2928 100644
--- a/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
+++ b/extensions-core/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/BuildProcessor.java
@@ -85,8 +85,6 @@ import org.apache.camel.quarkus.core.deployment.spi.UploadAttacherBuildItem;
import org.apache.camel.quarkus.core.deployment.util.CamelSupport;
import org.apache.camel.quarkus.core.deployment.util.PathFilter;
import org.apache.camel.quarkus.support.common.CamelCapabilities;
-import org.apache.camel.spi.FactoryFinder;
-import org.apache.camel.spi.RestBindingJaxbDataFormatFactory;
import org.apache.camel.spi.TypeConverterLoader;
import org.apache.camel.spi.TypeConverterRegistry;
import org.jboss.jandex.ClassInfo;
@@ -191,14 +189,6 @@ class BuildProcessor {
"META-INF/services/org/apache/camel/dataformat/*",
"META-INF/services/org/apache/camel/send-dynamic/*"));
- // TODO: this can be removed and the RestBindingJaxbDataFormatFactory can be discovered
- // and instantiated when camel is on the classpath with a camel context customizer
- // when https://github.com/apache/camel-quarkus/issues/984 will be implemented
- services.produce(new CamelServicePatternBuildItem(
- CamelServiceDestination.DISCOVERY,
- true,
- FactoryFinder.DEFAULT_PATH + RestBindingJaxbDataFormatFactory.FACTORY));
-
services.produce(new CamelServicePatternBuildItem(
CamelServiceDestination.DISCOVERY,
false,
diff --git a/extensions/jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/jaxb/deployment/JaxbProcessor.java b/extensions/jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/jaxb/deployment/JaxbProcessor.java
index 8808ea6..c01f2f8 100644
--- a/extensions/jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/jaxb/deployment/JaxbProcessor.java
+++ b/extensions/jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/jaxb/deployment/JaxbProcessor.java
@@ -18,8 +18,12 @@ package org.apache.camel.quarkus.component.jaxb.deployment;
import com.sun.xml.bind.v2.runtime.output.FastInfosetStreamWriterOutput;
import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import org.apache.camel.quarkus.component.jaxb.JaxbRecorder;
+import org.apache.camel.quarkus.core.deployment.spi.CamelContextCustomizerBuildItem;
class JaxbProcessor {
@@ -35,4 +39,10 @@ class JaxbProcessor {
return new RuntimeInitializedClassBuildItem(FastInfosetStreamWriterOutput.class.getCanonicalName());
}
+ @BuildStep
+ @Record(value = ExecutionTime.STATIC_INIT)
+ CamelContextCustomizerBuildItem contextCustomizer(JaxbRecorder recorder) {
+ return new CamelContextCustomizerBuildItem(recorder.newRestBindingJaxbDataFormatFactoryContextCustomizer());
+ }
+
}
diff --git a/extensions/jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/jaxb/deployment/JaxbProcessor.java b/extensions/jaxb/runtime/src/main/java/org/apache/camel/quarkus/component/jaxb/JaxbRecorder.java
similarity index 53%
copy from extensions/jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/jaxb/deployment/JaxbProcessor.java
copy to extensions/jaxb/runtime/src/main/java/org/apache/camel/quarkus/component/jaxb/JaxbRecorder.java
index 8808ea6..f8c5843 100644
--- a/extensions/jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/jaxb/deployment/JaxbProcessor.java
+++ b/extensions/jaxb/runtime/src/main/java/org/apache/camel/quarkus/component/jaxb/JaxbRecorder.java
@@ -14,25 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.jaxb.deployment;
+package org.apache.camel.quarkus.component.jaxb;
-import com.sun.xml.bind.v2.runtime.output.FastInfosetStreamWriterOutput;
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.converter.jaxb.JaxbRestBindingJaxbDataFormatFactory;
+import org.apache.camel.quarkus.core.CamelContextCustomizer;
-class JaxbProcessor {
-
- private static final String FEATURE = "camel-jaxb";
-
- @BuildStep
- FeatureBuildItem feature() {
- return new FeatureBuildItem(FEATURE);
- }
-
- @BuildStep
- RuntimeInitializedClassBuildItem fastInfosetStreamWriterOutput() {
- return new RuntimeInitializedClassBuildItem(FastInfosetStreamWriterOutput.class.getCanonicalName());
+@Recorder
+public class JaxbRecorder {
+ public RuntimeValue<CamelContextCustomizer> newRestBindingJaxbDataFormatFactoryContextCustomizer() {
+ JaxbRestBindingJaxbDataFormatFactory factory = new JaxbRestBindingJaxbDataFormatFactory();
+ return new RuntimeValue<>(
+ context -> context.adapt(ExtendedCamelContext.class).setRestBindingJaxbDataFormatFactory(factory));
}
}