davsclaus commented on a change in pull request #84: Support full yaml dsl #80
URL: https://github.com/apache/camel-k-runtime/pull/84#discussion_r295800538
 
 

 ##########
 File path: 
camel-k-runtime-yaml/src/main/java/org/apache/camel/k/yaml/YamlRoutesLoader.java
 ##########
 @@ -0,0 +1,103 @@
+/**
+ * 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.k.yaml;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.k.RoutesLoader;
+import org.apache.camel.k.Source;
+import org.apache.camel.k.support.URIResolver;
+import org.apache.camel.k.yaml.converter.Converter;
+import org.apache.camel.k.yaml.converter.StartConverter;
+import org.apache.camel.k.yaml.model.Route;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.model.RoutesDefinition;
+import org.apache.camel.model.rest.RestDefinition;
+import org.apache.camel.model.rest.RestsDefinition;
+
+public class YamlRoutesLoader implements RoutesLoader {
+    @Override
+    public List<String> getSupportedLanguages() {
+        return Collections.singletonList("yaml");
+    }
+
+    @SuppressWarnings("uncheked")
+    @Override
+    public RouteBuilder load(CamelContext camelContext, Source source) throws 
Exception {
+        return builder(URIResolver.resolve(camelContext, source));
+    }
+
+    public static RouteBuilder builder(InputStream is) {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                final CamelContext camelContext = getContext();
 
 Review comment:
   Ha this is clever to just do it in the configure method, then CamelContext 
just think this is a regular RouteBuilder class ;)

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

Reply via email to