You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2019/09/10 09:31:34 UTC

[GitHub] [camel-quarkus] gnodet commented on a change in pull request #189: Make xml and jaxb disabled by default and opt-in when depending on camel

gnodet commented on a change in pull request #189: Make xml and jaxb disabled by default and opt-in when depending on camel
URL: https://github.com/apache/camel-quarkus/pull/189#discussion_r322642596
 
 

 ##########
 File path: extensions/xml-common/runtime/src/main/java/org/apache/camel/quarkus/component/xml/runtime/graal/Target_org_apache_camel_quarkus_core_runtime_support_FastModel.java
 ##########
 @@ -0,0 +1,45 @@
+/*
+ * 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.xml.runtime.graal;
+
+import java.io.InputStream;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultModel;
+import org.apache.camel.model.ModelHelper;
+import org.apache.camel.model.RoutesDefinition;
+
+@TargetClass(className = "org.apache.camel.quarkus.core.runtime.support.FastModel")
+@Substitute
+public class Target_org_apache_camel_quarkus_core_runtime_support_FastModel extends DefaultModel {
+
+    public Target_org_apache_camel_quarkus_core_runtime_support_FastModel(CamelContext camelContext) {
+        super(camelContext);
+    }
+
+    @Substitute
+    public void addRouteDefinitions(InputStream is) throws Exception {
+        RoutesDefinition def = ModelHelper.loadRoutesDefinition(getCamelContext(), is);
 
 Review comment:
   We're not replacing `FastModel` with `DefaultModel`.  This is just a class containing a substitution for the `addRouteDefinitions` method. The one in `FastModel` now simply throws an `UnsupportedOperationException`.
   The goal is to have the default `FastModel` not being tied to xml/jaxb (thus unable to load xml routes) and have this feature automatically added when adding the dependency to the `xml-common` extension.

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


With regards,
Apache Git Services