camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/4] camel git commit: CAMEL-10559: route parser for java and xml to parse source code. Donated from fabric8 project.
Date Mon, 05 Dec 2016 12:20:46 GMT
CAMEL-10559: route parser for java and xml to parse source code. Donated from fabric8 project.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/07563515
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/07563515
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/07563515

Branch: refs/heads/parser
Commit: 07563515b7d99d2a9c2b4a194994c66634245549
Parents: d44821f
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Dec 5 13:13:33 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Dec 5 13:13:33 2016 +0100

----------------------------------------------------------------------
 .../camel/parser/AnonymousMethodSource.java     | 426 -------------
 .../camel/parser/CamelJavaParserHelper.java     | 634 ------------------
 .../org/apache/camel/parser/CamelXmlHelper.java | 265 --------
 .../org/apache/camel/parser/ParserResult.java   |  28 +-
 .../apache/camel/parser/RouteBuilderParser.java |  57 +-
 .../camel/parser/StatementFieldSource.java      | 278 --------
 .../camel/parser/XmlLineNumberParser.java       | 197 ------
 .../org/apache/camel/parser/XmlRouteParser.java |  32 +-
 .../parser/helper/CamelJavaParserHelper.java    | 638 +++++++++++++++++++
 .../camel/parser/helper/CamelXmlHelper.java     | 268 ++++++++
 .../parser/helper/XmlLineNumberParser.java      | 197 ++++++
 .../parser/model/CamelEndpointDetails.java      |   3 +
 .../camel/parser/model/CamelSimpleDetails.java  |  98 ---
 .../model/CamelSimpleExpressionDetails.java     | 101 +++
 .../parser/roaster/AnonymousMethodSource.java   | 426 +++++++++++++
 .../parser/roaster/StatementFieldSource.java    | 278 ++++++++
 ...asterCdiConcatRouteBuilderConfigureTest.java |   2 +-
 .../RoasterCdiRouteBuilderConfigureTest.java    |   2 +-
 ...terConcatFieldRouteBuilderConfigureTest.java |   2 +-
 .../parser/java/RoasterEndpointInjectTest.java  |   2 +-
 .../RoasterFieldRouteBuilderConfigureTest.java  |   2 +-
 ...sterMethodCallRouteBuilderConfigureTest.java |   2 +-
 ...ieldMethodCallRouteBuilderConfigureTest.java |   2 +-
 .../java/RoasterMyLocalAddRouteBuilderTest.java |   2 +-
 .../camel/parser/java/RoasterMyNettyTest.java   |   2 +-
 ...erNewLineConstRouteBuilderConfigureTest.java |   2 +-
 ...RoasterNewLineRouteBuilderConfigureTest.java |   2 +-
 ...RoasterRouteBuilderCamelTestSupportTest.java |   2 +-
 .../java/RoasterRouteBuilderConfigureTest.java  |   2 +-
 .../java/RoasterRouteBuilderEmptyUriTest.java   |   2 +-
 .../parser/java/RoasterSimpleProcessorTest.java |   2 +-
 .../RoasterSimpleRouteBuilderConfigureTest.java |   2 +-
 .../camel/parser/java/RoasterSimpleToDTest.java |   2 +-
 .../camel/parser/java/RoasterSimpleToFTest.java |   2 +-
 .../parser/java/RoasterSplitTokenizeTest.java   |   2 +-
 .../parser/xml/FindElementInRoutesTest.java     |   2 +-
 36 files changed, 2017 insertions(+), 1949 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/AnonymousMethodSource.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/AnonymousMethodSource.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/AnonymousMethodSource.java
deleted file mode 100644
index 777d34e..0000000
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/AnonymousMethodSource.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/**
- * 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.parser;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-
-import org.jboss.forge.roaster.model.JavaType;
-import org.jboss.forge.roaster.model.Type;
-import org.jboss.forge.roaster.model.TypeVariable;
-import org.jboss.forge.roaster.model.Visibility;
-import org.jboss.forge.roaster.model.source.AnnotationSource;
-import org.jboss.forge.roaster.model.source.JavaClassSource;
-import org.jboss.forge.roaster.model.source.JavaDocSource;
-import org.jboss.forge.roaster.model.source.MethodSource;
-import org.jboss.forge.roaster.model.source.ParameterSource;
-import org.jboss.forge.roaster.model.source.TypeVariableSource;
-
-/**
- * In use when we have discovered a RouteBuilder being as anonymous inner class
- */
-public class AnonymousMethodSource implements MethodSource<JavaClassSource> {
-
-    // this implementation should only implement the needed logic to support the parser
-
-    private final JavaClassSource origin;
-    private final Object internal;
-
-    public AnonymousMethodSource(JavaClassSource origin, Object internal) {
-        this.origin = origin;
-        this.internal = internal;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setDefault(boolean b) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setSynchronized(boolean b) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setNative(boolean b) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setReturnType(Class<?> aClass) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setReturnType(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setReturnType(JavaType<?> javaType) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setReturnTypeVoid() {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setBody(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setConstructor(boolean b) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setParameters(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> addThrows(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> addThrows(Class<? extends Exception> aClass) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeThrows(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeThrows(Class<? extends Exception> aClass) {
-        return null;
-    }
-
-    @Override
-    public boolean isSynchronized() {
-        return false;
-    }
-
-    @Override
-    public boolean isNative() {
-        return false;
-    }
-
-    @Override
-    public String getBody() {
-        return null;
-    }
-
-    @Override
-    public boolean isConstructor() {
-        return false;
-    }
-
-    @Override
-    public Type<JavaClassSource> getReturnType() {
-        return null;
-    }
-
-    @Override
-    public boolean isReturnTypeVoid() {
-        return false;
-    }
-
-    @Override
-    public List<ParameterSource<JavaClassSource>> getParameters() {
-        return null;
-    }
-
-    @Override
-    public String toSignature() {
-        return null;
-    }
-
-    @Override
-    public List<String> getThrownExceptions() {
-        return null;
-    }
-
-    @Override
-    public boolean isDefault() {
-        return false;
-    }
-
-    @Override
-    public ParameterSource<JavaClassSource> addParameter(Class<?> aClass, String s) {
-        return null;
-    }
-
-    @Override
-    public ParameterSource<JavaClassSource> addParameter(String s, String s1) {
-        return null;
-    }
-
-    @Override
-    public ParameterSource<JavaClassSource> addParameter(JavaType<?> javaType, String s) {
-        return null;
-    }
-
-    @Override
-    public void removeAllAnnotations() {
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeParameter(ParameterSource<JavaClassSource> parameterSource) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeParameter(Class<?> aClass, String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeParameter(String s, String s1) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeParameter(JavaType<?> javaType, String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setAbstract(boolean b) {
-        return null;
-    }
-
-    @Override
-    public List<AnnotationSource<JavaClassSource>> getAnnotations() {
-        return null;
-    }
-
-    @Override
-    public boolean hasAnnotation(Class<? extends Annotation> aClass) {
-        return false;
-    }
-
-    @Override
-    public boolean hasAnnotation(String s) {
-        return false;
-    }
-
-    @Override
-    public AnnotationSource<JavaClassSource> getAnnotation(Class<? extends Annotation> aClass) {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource<JavaClassSource> getAnnotation(String s) {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource<JavaClassSource> addAnnotation() {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource<JavaClassSource> addAnnotation(Class<? extends Annotation> aClass) {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource<JavaClassSource> addAnnotation(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeAnnotation(org.jboss.forge.roaster.model.Annotation<JavaClassSource> annotation) {
-        return null;
-    }
-
-    @Override
-    public List<TypeVariableSource<JavaClassSource>> getTypeVariables() {
-        return null;
-    }
-
-    @Override
-    public TypeVariableSource<JavaClassSource> getTypeVariable(String s) {
-        return null;
-    }
-
-    @Override
-    public TypeVariableSource<JavaClassSource> addTypeVariable() {
-        return null;
-    }
-
-    @Override
-    public TypeVariableSource<JavaClassSource> addTypeVariable(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeTypeVariable(String s) {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeTypeVariable(TypeVariable<?> typeVariable) {
-        return null;
-    }
-
-    @Override
-    public boolean hasJavaDoc() {
-        return false;
-    }
-
-    @Override
-    public boolean isAbstract() {
-        return false;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setFinal(boolean b) {
-        return null;
-    }
-
-    @Override
-    public boolean isFinal() {
-        return false;
-    }
-
-    @Override
-    public Object getInternal() {
-        return internal;
-    }
-
-    @Override
-    public JavaDocSource<MethodSource<JavaClassSource>> getJavaDoc() {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> removeJavaDoc() {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setName(String s) {
-        return null;
-    }
-
-    @Override
-    public String getName() {
-        return null;
-    }
-
-    @Override
-    public JavaClassSource getOrigin() {
-        return origin;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setStatic(boolean b) {
-        return null;
-    }
-
-    @Override
-    public boolean isStatic() {
-        return false;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setPackagePrivate() {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setPublic() {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setPrivate() {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setProtected() {
-        return null;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setVisibility(Visibility visibility) {
-        return null;
-    }
-
-    @Override
-    public boolean isPackagePrivate() {
-        return false;
-    }
-
-    @Override
-    public boolean isPublic() {
-        return false;
-    }
-
-    @Override
-    public boolean isPrivate() {
-        return false;
-    }
-
-    @Override
-    public boolean isProtected() {
-        return false;
-    }
-
-    @Override
-    public Visibility getVisibility() {
-        return null;
-    }
-
-    @Override
-    public int getColumnNumber() {
-        return 0;
-    }
-
-    @Override
-    public int getStartPosition() {
-        return 0;
-    }
-
-    @Override
-    public int getEndPosition() {
-        return 0;
-    }
-
-    @Override
-    public int getLineNumber() {
-        return 0;
-    }
-
-    @Override
-    public boolean hasTypeVariable(String arg0) {
-        return false;
-    }
-
-    @Override
-    public MethodSource<JavaClassSource> setReturnType(Type<?> arg0) {
-        return null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelJavaParserHelper.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelJavaParserHelper.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelJavaParserHelper.java
deleted file mode 100644
index 5cd1e1c..0000000
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelJavaParserHelper.java
+++ /dev/null
@@ -1,634 +0,0 @@
-/**
- * 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.parser;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.ASTNode;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.Block;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.BooleanLiteral;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.Expression;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.ExpressionStatement;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.InfixExpression;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.MemberValuePair;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.MethodInvocation;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.NumberLiteral;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.ParenthesizedExpression;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.QualifiedName;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.ReturnStatement;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.SimpleName;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.SimpleType;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.Statement;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.StringLiteral;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.Type;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.VariableDeclaration;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.VariableDeclarationStatement;
-import org.jboss.forge.roaster.model.Annotation;
-import org.jboss.forge.roaster.model.source.AnnotationSource;
-import org.jboss.forge.roaster.model.source.FieldSource;
-import org.jboss.forge.roaster.model.source.JavaClassSource;
-import org.jboss.forge.roaster.model.source.MethodSource;
-import org.jboss.forge.roaster.model.util.Strings;
-
-/**
- * A Camel Java parser that only depends on the Roaster API.
- * <p/>
- * This implementation is lower level details. For a higher level parser see {@link RouteBuilderParser}.
- */
-public final class CamelJavaParserHelper {
-
-    private CamelJavaParserHelper() {
-        // utility class
-    }
-
-    public static MethodSource<JavaClassSource> findConfigureMethod(JavaClassSource clazz) {
-        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
-        // must be public void configure()
-        if (method != null && method.isPublic() && method.getParameters().isEmpty() && method.getReturnType().isType("void")) {
-            return method;
-        }
-
-        // maybe the route builder is from unit testing with camel-test as an anonymous inner class
-        // there is a bit of code to dig out this using the eclipse jdt api
-        method = findCreateRouteBuilderMethod(clazz);
-        if (method != null) {
-            return findConfigureMethodInCreateRouteBuilder(clazz, method);
-        }
-
-        return null;
-    }
-
-    public static List<MethodSource<JavaClassSource>> findInlinedConfigureMethods(JavaClassSource clazz) {
-        List<MethodSource<JavaClassSource>> answer = new ArrayList<>();
-
-        List<MethodSource<JavaClassSource>> methods = clazz.getMethods();
-        if (methods != null) {
-            for (MethodSource<JavaClassSource> method : methods) {
-                if (method.isPublic()
-                        && (method.getParameters() == null || method.getParameters().isEmpty())
-                        && (method.getReturnType() == null || method.getReturnType().isType("void"))) {
-                    // maybe the method contains an inlined createRouteBuilder usually from an unit test method
-                    MethodSource<JavaClassSource> builder = findConfigureMethodInCreateRouteBuilder(clazz, method);
-                    if (builder != null) {
-                        answer.add(builder);
-                    }
-                }
-            }
-        }
-
-        return answer;
-    }
-
-    private static MethodSource<JavaClassSource> findCreateRouteBuilderMethod(JavaClassSource clazz) {
-        MethodSource method = clazz.getMethod("createRouteBuilder");
-        if (method != null && (method.isPublic() || method.isProtected()) && method.getParameters().isEmpty()) {
-            return method;
-        }
-        return null;
-    }
-
-    private static MethodSource<JavaClassSource> findConfigureMethodInCreateRouteBuilder(JavaClassSource clazz, MethodSource<JavaClassSource> method) {
-        // find configure inside the code
-        MethodDeclaration md = (MethodDeclaration) method.getInternal();
-        Block block = md.getBody();
-        if (block != null) {
-            List statements = block.statements();
-            for (int i = 0; i < statements.size(); i++) {
-                Statement stmt = (Statement) statements.get(i);
-                Expression exp = null;
-                if (stmt instanceof ReturnStatement) {
-                    ReturnStatement rs = (ReturnStatement) stmt;
-                    exp = rs.getExpression();
-                } else if (stmt instanceof ExpressionStatement) {
-                    ExpressionStatement es = (ExpressionStatement) stmt;
-                    exp = es.getExpression();
-                    if (exp instanceof MethodInvocation) {
-                        MethodInvocation mi = (MethodInvocation) exp;
-                        for (Object arg : mi.arguments()) {
-                            if (arg instanceof ClassInstanceCreation) {
-                                exp = (Expression) arg;
-                                break;
-                            }
-                        }
-                    }
-                }
-                if (exp != null && exp instanceof ClassInstanceCreation) {
-                    ClassInstanceCreation cic = (ClassInstanceCreation) exp;
-                    boolean isRouteBuilder = false;
-                    if (cic.getType() instanceof SimpleType) {
-                        SimpleType st = (SimpleType) cic.getType();
-                        isRouteBuilder = "RouteBuilder".equals(st.getName().toString());
-                    }
-                    if (isRouteBuilder && cic.getAnonymousClassDeclaration() != null) {
-                        List body = cic.getAnonymousClassDeclaration().bodyDeclarations();
-                        for (int j = 0; j < body.size(); j++) {
-                            Object line = body.get(j);
-                            if (line instanceof MethodDeclaration) {
-                                MethodDeclaration amd = (MethodDeclaration) line;
-                                if ("configure".equals(amd.getName().toString())) {
-                                    return new AnonymousMethodSource(clazz, amd);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        return null;
-    }
-
-    public static List<ParserResult> parseCamelConsumerUris(MethodSource<JavaClassSource> method, boolean strings, boolean fields) {
-        return doParseCamelUris(method, true, false, strings, fields);
-    }
-
-    public static List<ParserResult> parseCamelProducerUris(MethodSource<JavaClassSource> method, boolean strings, boolean fields) {
-        return doParseCamelUris(method, false, true, strings, fields);
-    }
-
-    private static List<ParserResult> doParseCamelUris(MethodSource<JavaClassSource> method, boolean consumers, boolean producers,
-                                                       boolean strings, boolean fields) {
-
-        List<ParserResult> answer = new ArrayList<ParserResult>();
-
-        if (method != null) {
-            MethodDeclaration md = (MethodDeclaration) method.getInternal();
-            Block block = md.getBody();
-            if (block != null) {
-                for (Object statement : md.getBody().statements()) {
-                    // must be a method call expression
-                    if (statement instanceof ExpressionStatement) {
-                        ExpressionStatement es = (ExpressionStatement) statement;
-                        Expression exp = es.getExpression();
-
-                        List<ParserResult> uris = new ArrayList<ParserResult>();
-                        parseExpression(method.getOrigin(), block, exp, uris, consumers, producers, strings, fields);
-                        if (!uris.isEmpty()) {
-                            // reverse the order as we will grab them from last->first
-                            Collections.reverse(uris);
-                            answer.addAll(uris);
-                        }
-                    }
-                }
-            }
-        }
-
-        return answer;
-    }
-
-    private static void parseExpression(JavaClassSource clazz, Block block, Expression exp, List<ParserResult> uris,
-                                        boolean consumers, boolean producers, boolean strings, boolean fields) {
-        if (exp == null) {
-            return;
-        }
-        if (exp instanceof MethodInvocation) {
-            MethodInvocation mi = (MethodInvocation) exp;
-            doParseCamelUris(clazz, block, mi, uris, consumers, producers, strings, fields);
-            // if the method was called on another method, then recursive
-            exp = mi.getExpression();
-            parseExpression(clazz, block, exp, uris, consumers, producers, strings, fields);
-        }
-    }
-
-    private static void doParseCamelUris(JavaClassSource clazz, Block block, MethodInvocation mi, List<ParserResult> uris,
-                                         boolean consumers, boolean producers, boolean strings, boolean fields) {
-        String name = mi.getName().getIdentifier();
-
-        if (consumers) {
-            if ("from".equals(name)) {
-                List args = mi.arguments();
-                if (args != null) {
-                    for (Object arg : args) {
-                        if (isValidArgument(name, arg)) {
-                            extractEndpointUriFromArgument(name, clazz, block, uris, arg, strings, fields);
-                        }
-                    }
-                }
-            }
-            if ("fromF".equals(name)) {
-                List args = mi.arguments();
-                // the first argument is where the uri is
-                if (args != null && args.size() >= 1) {
-                    Object arg = args.get(0);
-                    if (isValidArgument(name, arg)) {
-                        extractEndpointUriFromArgument(name, clazz, block, uris, arg, strings, fields);
-                    }
-                }
-            }
-            if ("pollEnrich".equals(name)) {
-                List args = mi.arguments();
-                // the first argument is where the uri is
-                if (args != null && args.size() >= 1) {
-                    Object arg = args.get(0);
-                    if (isValidArgument(name, arg)) {
-                        extractEndpointUriFromArgument(name, clazz, block, uris, arg, strings, fields);
-                    }
-                }
-            }
-        }
-
-        if (producers) {
-            if ("to".equals(name) || "toD".equals(name)) {
-                List args = mi.arguments();
-                if (args != null) {
-                    for (Object arg : args) {
-                        // skip if the arg is a boolean, ExchangePattern or Iterateable, type
-                        if (isValidArgument(name, arg)) {
-                            extractEndpointUriFromArgument(name, clazz, block, uris, arg, strings, fields);
-                        }
-                    }
-                }
-            }
-            if ("toF".equals(name)) {
-                List args = mi.arguments();
-                // the first argument is where the uri is
-                if (args != null && args.size() >= 1) {
-                    Object arg = args.get(0);
-                    if (isValidArgument(name, arg)) {
-                        extractEndpointUriFromArgument(name, clazz, block, uris, arg, strings, fields);
-                    }
-                }
-            }
-            if ("enrich".equals(name) || "wireTap".equals(name)) {
-                List args = mi.arguments();
-                // the first argument is where the uri is
-                if (args != null && args.size() >= 1) {
-                    Object arg = args.get(0);
-                    if (isValidArgument(name, arg)) {
-                        extractEndpointUriFromArgument(name, clazz, block, uris, arg, strings, fields);
-                    }
-                }
-            }
-        }
-    }
-
-    private static boolean isValidArgument(String node, Object arg) {
-        // skip boolean argument, as toD can accept a boolean value
-        if (arg instanceof BooleanLiteral) {
-            return false;
-        }
-        // skip ExchangePattern argument
-        if (arg instanceof QualifiedName) {
-            QualifiedName qn = (QualifiedName) arg;
-            String name = qn.getFullyQualifiedName();
-            if (name.startsWith("ExchangePattern")) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    private static void extractEndpointUriFromArgument(String node, JavaClassSource clazz, Block block, List<ParserResult> uris, Object arg, boolean strings, boolean fields) {
-        if (strings) {
-            String uri = getLiteralValue(clazz, block, (Expression) arg);
-            if (!Strings.isBlank(uri)) {
-                int position = ((Expression) arg).getStartPosition();
-
-                // if the node is fromF or toF, then replace all %s with {{%s}} as we cannot parse that value
-                if ("fromF".equals(node) || "toF".equals(node)) {
-                    uri = uri.replaceAll("\\%s", "\\{\\{\\%s\\}\\}");
-                }
-
-                uris.add(new ParserResult(node, position, uri));
-                return;
-            }
-        }
-        if (fields && arg instanceof SimpleName) {
-            FieldSource field = getField(clazz, block, (SimpleName) arg);
-            if (field != null) {
-                // find the endpoint uri from the annotation
-                AnnotationSource annotation = field.getAnnotation("org.apache.camel.cdi.Uri");
-                if (annotation == null) {
-                    annotation = field.getAnnotation("org.apache.camel.EndpointInject");
-                }
-                if (annotation != null) {
-                    Expression exp = (Expression) annotation.getInternal();
-                    if (exp instanceof SingleMemberAnnotation) {
-                        exp = ((SingleMemberAnnotation) exp).getValue();
-                    } else if (exp instanceof NormalAnnotation) {
-                        List values = ((NormalAnnotation) exp).values();
-                        for (Object value : values) {
-                            MemberValuePair pair = (MemberValuePair) value;
-                            if ("uri".equals(pair.getName().toString())) {
-                                exp = pair.getValue();
-                                break;
-                            }
-                        }
-                    }
-                    String uri = CamelJavaParserHelper.getLiteralValue(clazz, block, exp);
-                    if (!Strings.isBlank(uri)) {
-                        int position = ((SimpleName) arg).getStartPosition();
-                        uris.add(new ParserResult(node, position, uri));
-                    }
-                } else {
-                    // the field may be initialized using variables, so we need to evaluate those expressions
-                    Object fi = field.getInternal();
-                    if (fi instanceof VariableDeclaration) {
-                        Expression exp = ((VariableDeclaration) fi).getInitializer();
-                        String uri = CamelJavaParserHelper.getLiteralValue(clazz, block, exp);
-                        if (!Strings.isBlank(uri)) {
-                            // we want the position of the field, and not in the route
-                            int position = ((VariableDeclaration) fi).getStartPosition();
-                            uris.add(new ParserResult(node, position, uri));
-                        }
-                    }
-                }
-            }
-        }
-
-        // cannot parse it so add a failure
-        uris.add(new ParserResult(node, -1, arg.toString(), false));
-    }
-
-    public static List<ParserResult> parseCamelSimpleExpressions(MethodSource<JavaClassSource> method) {
-        List<ParserResult> answer = new ArrayList<ParserResult>();
-
-        MethodDeclaration md = (MethodDeclaration) method.getInternal();
-        Block block = md.getBody();
-        if (block != null) {
-            for (Object statement : block.statements()) {
-                // must be a method call expression
-                if (statement instanceof ExpressionStatement) {
-                    ExpressionStatement es = (ExpressionStatement) statement;
-                    Expression exp = es.getExpression();
-
-                    List<ParserResult> expressions = new ArrayList<ParserResult>();
-                    parseExpression(null, method.getOrigin(), block, exp, expressions);
-                    if (!expressions.isEmpty()) {
-                        // reverse the order as we will grab them from last->first
-                        Collections.reverse(expressions);
-                        answer.addAll(expressions);
-                    }
-                }
-            }
-        }
-
-        return answer;
-    }
-
-    private static void parseExpression(String node, JavaClassSource clazz, Block block, Expression exp, List<ParserResult> expressions) {
-        if (exp == null) {
-            return;
-        }
-        if (exp instanceof MethodInvocation) {
-            MethodInvocation mi = (MethodInvocation) exp;
-            doParseCamelSimple(node, clazz, block, mi, expressions);
-            // if the method was called on another method, then recursive
-            exp = mi.getExpression();
-            parseExpression(node, clazz, block, exp, expressions);
-        }
-    }
-
-    private static void doParseCamelSimple(String node, JavaClassSource clazz, Block block, MethodInvocation mi, List<ParserResult> expressions) {
-        String name = mi.getName().getIdentifier();
-
-        if ("simple".equals(name)) {
-            List args = mi.arguments();
-            // the first argument is a string parameter for the simple expression
-            if (args != null && args.size() >= 1) {
-                // it is a String type
-                Object arg = args.get(0);
-                String simple = getLiteralValue(clazz, block, (Expression) arg);
-                if (!Strings.isBlank(simple)) {
-                    int position = ((Expression) arg).getStartPosition();
-                    expressions.add(new ParserResult(node, position, simple));
-                }
-            }
-        }
-
-        // simple maybe be passed in as an argument
-        List args = mi.arguments();
-        if (args != null) {
-            for (Object arg : args) {
-                if (arg instanceof MethodInvocation) {
-                    MethodInvocation ami = (MethodInvocation) arg;
-                    doParseCamelSimple(node, clazz, block, ami, expressions);
-                }
-            }
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private static FieldSource<JavaClassSource> getField(JavaClassSource clazz, Block block, SimpleName ref) {
-        String fieldName = ref.getIdentifier();
-        if (fieldName != null) {
-            // find field in class
-            FieldSource field = clazz != null ? clazz.getField(fieldName) : null;
-            if (field == null) {
-                field = findFieldInBlock(clazz, block, fieldName);
-            }
-            return field;
-        }
-        return null;
-    }
-
-    @SuppressWarnings("unchecked")
-    private static FieldSource<JavaClassSource> findFieldInBlock(JavaClassSource clazz, Block block, String fieldName) {
-        for (Object statement : block.statements()) {
-            // try local statements first in the block
-            if (statement instanceof VariableDeclarationStatement) {
-                final Type type = ((VariableDeclarationStatement) statement).getType();
-                for (Object obj : ((VariableDeclarationStatement) statement).fragments()) {
-                    if (obj instanceof VariableDeclarationFragment) {
-                        VariableDeclarationFragment fragment = (VariableDeclarationFragment) obj;
-                        SimpleName name = fragment.getName();
-                        if (name != null && fieldName.equals(name.getIdentifier())) {
-                            return new StatementFieldSource(clazz, fragment, type);
-                        }
-                    }
-                }
-            }
-
-            // okay the field may be burried inside an anonymous inner class as a field declaration
-            // outside the configure method, so lets go back to the parent and see what we can find
-            ASTNode node = block.getParent();
-            if (node instanceof MethodDeclaration) {
-                node = node.getParent();
-            }
-            if (node instanceof AnonymousClassDeclaration) {
-                List declarations = ((AnonymousClassDeclaration) node).bodyDeclarations();
-                for (Object dec : declarations) {
-                    if (dec instanceof FieldDeclaration) {
-                        FieldDeclaration fd = (FieldDeclaration) dec;
-                        final Type type = fd.getType();
-                        for (Object obj : fd.fragments()) {
-                            if (obj instanceof VariableDeclarationFragment) {
-                                VariableDeclarationFragment fragment = (VariableDeclarationFragment) obj;
-                                SimpleName name = fragment.getName();
-                                if (name != null && fieldName.equals(name.getIdentifier())) {
-                                    return new StatementFieldSource(clazz, fragment, type);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    public static String getLiteralValue(JavaClassSource clazz, Block block, Expression expression) {
-        // unwrap parenthesis
-        if (expression instanceof ParenthesizedExpression) {
-            expression = ((ParenthesizedExpression) expression).getExpression();
-        }
-
-        if (expression instanceof StringLiteral) {
-            return ((StringLiteral) expression).getLiteralValue();
-        } else if (expression instanceof BooleanLiteral) {
-            return "" + ((BooleanLiteral) expression).booleanValue();
-        } else if (expression instanceof NumberLiteral) {
-            return ((NumberLiteral) expression).getToken();
-        }
-
-        // if it a method invocation then add a dummy value assuming the method invocation will return a valid response
-        if (expression instanceof MethodInvocation) {
-            String name = ((MethodInvocation) expression).getName().getIdentifier();
-            return "{{" + name + "}}";
-        }
-
-        // if its a qualified name (usually a constant field in another class)
-        // then add a dummy value as we cannot find the field value in other classes and maybe even outside the
-        // source code we have access to
-        if (expression instanceof QualifiedName) {
-            QualifiedName qn = (QualifiedName) expression;
-            String name = qn.getFullyQualifiedName();
-            return "{{" + name + "}}";
-        }
-
-        if (expression instanceof SimpleName) {
-            FieldSource<JavaClassSource> field = getField(clazz, block, (SimpleName) expression);
-            if (field != null) {
-                // is the field annotated with a Camel endpoint
-                if (field.getAnnotations() != null) {
-                    for (Annotation ann : field.getAnnotations()) {
-                        boolean valid = "org.apache.camel.EndpointInject".equals(ann.getQualifiedName()) || "org.apache.camel.cdi.Uri".equals(ann.getQualifiedName());
-                        if (valid) {
-                            Expression exp = (Expression) ann.getInternal();
-                            if (exp instanceof SingleMemberAnnotation) {
-                                exp = ((SingleMemberAnnotation) exp).getValue();
-                            } else if (exp instanceof NormalAnnotation) {
-                                List values = ((NormalAnnotation) exp).values();
-                                for (Object value : values) {
-                                    MemberValuePair pair = (MemberValuePair) value;
-                                    if ("uri".equals(pair.getName().toString())) {
-                                        exp = pair.getValue();
-                                        break;
-                                    }
-                                }
-                            }
-                            if (exp != null) {
-                                return getLiteralValue(clazz, block, exp);
-                            }
-                        }
-                    }
-                }
-                // is the field an org.apache.camel.Endpoint type?
-                if ("Endpoint".equals(field.getType().getSimpleName())) {
-                    // then grab the uri from the first argument
-                    VariableDeclarationFragment vdf = (VariableDeclarationFragment) field.getInternal();
-                    expression = vdf.getInitializer();
-                    if (expression instanceof MethodInvocation) {
-                        MethodInvocation mi = (MethodInvocation) expression;
-                        List args = mi.arguments();
-                        if (args != null && args.size() > 0) {
-                            // the first argument has the endpoint uri
-                            expression = (Expression) args.get(0);
-                            return getLiteralValue(clazz, block, expression);
-                        }
-                    }
-                } else {
-                    // no annotations so try its initializer
-                    VariableDeclarationFragment vdf = (VariableDeclarationFragment) field.getInternal();
-                    expression = vdf.getInitializer();
-                    if (expression == null) {
-                        // its a field which has no initializer, then add a dummy value assuming the field will be initialized at runtime
-                        return "{{" + field.getName() + "}}";
-                    } else {
-                        return getLiteralValue(clazz, block, expression);
-                    }
-                }
-            } else {
-                // we could not find the field in this class/method, so its maybe from some other super class, so insert a dummy value
-                final String fieldName = ((SimpleName) expression).getIdentifier();
-                return "{{" + fieldName + "}}";
-            }
-        } else if (expression instanceof InfixExpression) {
-            String answer = null;
-            // is it a string that is concat together?
-            InfixExpression ie = (InfixExpression) expression;
-            if (InfixExpression.Operator.PLUS.equals(ie.getOperator())) {
-
-                String val1 = getLiteralValue(clazz, block, ie.getLeftOperand());
-                String val2 = getLiteralValue(clazz, block, ie.getRightOperand());
-
-                // if numeric then we plus the values, otherwise we string concat
-                boolean numeric = isNumericOperator(clazz, block, ie.getLeftOperand()) && isNumericOperator(clazz, block, ie.getRightOperand());
-                if (numeric) {
-                    Long num1 = val1 != null ? Long.valueOf(val1) : 0;
-                    Long num2 = val2 != null ? Long.valueOf(val2) : 0;
-                    answer = "" + (num1 + num2);
-                } else {
-                    answer = (val1 != null ? val1 : "") + (val2 != null ? val2 : "");
-                }
-
-                if (!answer.isEmpty()) {
-                    // include extended when we concat on 2 or more lines
-                    List extended = ie.extendedOperands();
-                    if (extended != null) {
-                        for (Object ext : extended) {
-                            String val3 = getLiteralValue(clazz, block, (Expression) ext);
-                            if (numeric) {
-                                Long num3 = val3 != null ? Long.valueOf(val3) : 0;
-                                Long num = Long.valueOf(answer);
-                                answer = "" + (num + num3);
-                            } else {
-                                answer += val3 != null ? val3 : "";
-                            }
-                        }
-                    }
-                }
-            }
-            return answer;
-        }
-
-        return null;
-    }
-
-    private static boolean isNumericOperator(JavaClassSource clazz, Block block, Expression expression) {
-        if (expression instanceof NumberLiteral) {
-            return true;
-        } else if (expression instanceof SimpleName) {
-            FieldSource field = getField(clazz, block, (SimpleName) expression);
-            if (field != null) {
-                return field.getType().isType("int") || field.getType().isType("long")
-                        || field.getType().isType("Integer") || field.getType().isType("Long");
-            }
-        }
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelXmlHelper.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelXmlHelper.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelXmlHelper.java
deleted file mode 100644
index 3e81a3f..0000000
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/CamelXmlHelper.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/**
- * 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.parser;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import org.jboss.forge.roaster.model.util.Strings;
-
-public final class CamelXmlHelper {
-
-    private CamelXmlHelper() {
-        // utility class
-    }
-
-    public static String getSafeAttribute(Node node, String key) {
-        if (node != null) {
-            Node attr = node.getAttributes().getNamedItem(key);
-            if (attr != null) {
-                return attr.getNodeValue();
-            }
-        }
-        return null;
-    }
-
-    public static List<Node> findAllEndpoints(Document dom) {
-        List<Node> nodes = new ArrayList<>();
-
-        NodeList list = dom.getElementsByTagName("endpoint");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            if ("endpoint".equals(child.getNodeName())) {
-                // it may not be a camel namespace, so skip those
-                String ns = child.getNamespaceURI();
-                if (ns == null) {
-                    NamedNodeMap attrs = child.getAttributes();
-                    if (attrs != null) {
-                        Node node = attrs.getNamedItem("xmlns");
-                        if (node != null) {
-                            ns = node.getNodeValue();
-                        }
-                    }
-                }
-                // assume no namespace its for camel
-                if (ns == null || ns.contains("camel")) {
-                    nodes.add(child);
-                }
-            }
-        }
-
-        list = dom.getElementsByTagName("onException");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            findAllUrisRecursive(child, nodes);
-        }
-        list = dom.getElementsByTagName("onCompletion");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            findAllUrisRecursive(child, nodes);
-        }
-        list = dom.getElementsByTagName("intercept");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            findAllUrisRecursive(child, nodes);
-        }
-        list = dom.getElementsByTagName("interceptFrom");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            findAllUrisRecursive(child, nodes);
-        }
-        list = dom.getElementsByTagName("interceptSendToEndpoint");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            findAllUrisRecursive(child, nodes);
-        }
-        list = dom.getElementsByTagName("rest");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            if ("route".equals(child.getNodeName()) || "to".equals(child.getNodeName())) {
-                findAllUrisRecursive(child, nodes);
-            }
-        }
-        list = dom.getElementsByTagName("route");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            if ("route".equals(child.getNodeName())) {
-                findAllUrisRecursive(child, nodes);
-            }
-        }
-
-        return nodes;
-    }
-
-    private static void findAllUrisRecursive(Node node, List<Node> nodes) {
-        // okay its a route so grab all uri attributes we can find
-        String url = getSafeAttribute(node, "uri");
-        if (url != null) {
-            nodes.add(node);
-        }
-
-        NodeList children = node.getChildNodes();
-        if (children != null) {
-            for (int i = 0; i < children.getLength(); i++) {
-                Node child = children.item(i);
-                if (child.getNodeType() == Node.ELEMENT_NODE) {
-                    findAllUrisRecursive(child, nodes);
-                }
-            }
-        }
-    }
-
-    public static List<Node> findAllSimpleExpressions(Document dom) {
-        List<Node> nodes = new ArrayList<>();
-
-        NodeList list = dom.getElementsByTagName("route");
-        for (int i = 0; i < list.getLength(); i++) {
-            Node child = list.item(i);
-            if ("route".equals(child.getNodeName())) {
-                findAllSimpleExpressionsRecursive(child, nodes);
-            }
-        }
-
-        return nodes;
-    }
-
-    private static void findAllSimpleExpressionsRecursive(Node node, List<Node> nodes) {
-        // okay its a route so grab if its <simple>
-        if ("simple".equals(node.getNodeName())) {
-            nodes.add(node);
-        }
-
-        NodeList children = node.getChildNodes();
-        if (children != null) {
-            for (int i = 0; i < children.getLength(); i++) {
-                Node child = children.item(i);
-                if (child.getNodeType() == Node.ELEMENT_NODE) {
-                    findAllSimpleExpressionsRecursive(child, nodes);
-                }
-            }
-        }
-    }
-
-    public static Element getSelectedCamelElementNode(String key, InputStream resourceInputStream) throws Exception {
-        Document root = loadCamelXmlFileAsDom(resourceInputStream);
-        Element selectedElement = null;
-        if (root != null) {
-            Node selectedNode = findCamelNodeInDocument(root, key);
-            if (selectedNode instanceof Element) {
-                selectedElement = (Element) selectedNode;
-            }
-        }
-        return selectedElement;
-    }
-
-    private static Document loadCamelXmlFileAsDom(InputStream resourceInputStream) throws Exception {
-        // TODO:
-        Document root = XmlLineNumberParser.parseXml(resourceInputStream, "camelContext,routes,rests", "http://camel.apache.org/schema/spring");
-        return root;
-    }
-
-    private static Node findCamelNodeInDocument(Document root, String key) {
-        Node selectedNode = null;
-        if (root != null && !Strings.isBlank(key)) {
-            String[] paths = key.split("/");
-            NodeList camels = getCamelContextElements(root);
-            if (camels != null) {
-                Map<String, Integer> rootNodeCounts = new HashMap<>();
-                for (int i = 0, size = camels.getLength(); i < size; i++) {
-                    Node node = camels.item(i);
-                    boolean first = true;
-                    for (String path : paths) {
-                        if (first) {
-                            first = false;
-                            String actual = getIdOrIndex(node, rootNodeCounts);
-                            if (!equal(actual, path)) {
-                                node = null;
-                            }
-                        } else {
-                            node = findCamelNodeForPath(node, path);
-                        }
-                        if (node == null) {
-                            break;
-                        }
-                    }
-                    if (node != null) {
-                        return node;
-                    }
-                }
-            }
-        }
-        return selectedNode;
-    }
-
-    private static Node findCamelNodeForPath(Node node, String path) {
-        NodeList childNodes = node.getChildNodes();
-        if (childNodes != null) {
-            Map<String, Integer> nodeCounts = new HashMap<>();
-            for (int i = 0, size = childNodes.getLength(); i < size; i++) {
-                Node child = childNodes.item(i);
-                if (child instanceof Element) {
-                    String actual = getIdOrIndex(child, nodeCounts);
-                    if (equal(actual, path)) {
-                        return child;
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    private static String getIdOrIndex(Node node, Map<String, Integer> nodeCounts) {
-        String answer = null;
-        if (node instanceof Element) {
-            Element element = (Element) node;
-            String elementName = element.getTagName();
-            if ("routes".equals(elementName)) {
-                elementName = "camelContext";
-            }
-            Integer countObject = nodeCounts.get(elementName);
-            int count = countObject != null ? countObject.intValue() : 0;
-            nodeCounts.put(elementName, ++count);
-            answer = element.getAttribute("id");
-            if (Strings.isBlank(answer)) {
-                answer = "_" + elementName + count;
-            }
-        }
-        return answer;
-    }
-
-    private static NodeList getCamelContextElements(Document dom) {
-        NodeList camels = dom.getElementsByTagName("camelContext");
-        if (camels == null || camels.getLength() == 0) {
-            camels = dom.getElementsByTagName("routes");
-        }
-        return camels;
-    }
-
-    private static boolean equal(Object a, Object b) {
-        return a == b ? true : a != null && b != null && a.equals(b);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/ParserResult.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/ParserResult.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/ParserResult.java
index 445147d..4ef2fc4 100644
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/ParserResult.java
+++ b/tooling/route-parser/src/main/java/org/apache/camel/parser/ParserResult.java
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.parser;
 
+/**
+ * Result of parsing Camel RouteBuilder or XML routes from the source code.
+ */
 public class ParserResult {
 
     private final String node;
@@ -34,30 +37,31 @@ public class ParserResult {
         this.parsed = parsed;
     }
 
+    /**
+     * Character based position in the source code (not line based).
+     */
     public int getPosition() {
         return position;
     }
 
-    public void setPosition(int position) {
-        this.position = position;
-    }
-
+    /**
+     * The element such as a Camel endpoint uri
+     */
     public String getElement() {
         return element;
     }
 
-    public void setElement(String element) {
-        this.element = element;
-    }
-
+    /**
+     * Whether the element was successfully parsed. If the parser cannot parse
+     * the element for whatever reason this will return <tt>false</tt>.
+     */
     public boolean isParsed() {
         return parsed;
     }
 
-    public void setParsed(boolean parsed) {
-        this.parsed = parsed;
-    }
-
+    /**
+     * The node which is typically a Camel EIP name such as <tt>to</tt>, <tt>wireTap</tt> etc.
+     */
     public String getNode() {
         return node;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/RouteBuilderParser.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/RouteBuilderParser.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/RouteBuilderParser.java
index b2d806b..1bba303 100644
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/RouteBuilderParser.java
+++ b/tooling/route-parser/src/main/java/org/apache/camel/parser/RouteBuilderParser.java
@@ -5,9 +5,9 @@
  * 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
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * 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.
@@ -22,8 +22,9 @@ import java.io.FileReader;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.camel.parser.helper.CamelJavaParserHelper;
 import org.apache.camel.parser.model.CamelEndpointDetails;
-import org.apache.camel.parser.model.CamelSimpleDetails;
+import org.apache.camel.parser.model.CamelSimpleExpressionDetails;
 import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.ASTNode;
 import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.Expression;
 import org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.MemberValuePair;
@@ -45,11 +46,29 @@ public final class RouteBuilderParser {
     private RouteBuilderParser() {
     }
 
+    /**
+     * Parses the java source class to discover Camel endpoints.
+     *
+     * @param clazz                   the java source class
+     * @param baseDir                 the base of the source code
+     * @param fullyQualifiedFileName  the fully qualified source code file name
+     * @param endpoints               list to add discovered and parsed endpoints
+     */
     public static void parseRouteBuilderEndpoints(JavaClassSource clazz, String baseDir, String fullyQualifiedFileName,
                                                   List<CamelEndpointDetails> endpoints) {
         parseRouteBuilderEndpoints(clazz, baseDir, fullyQualifiedFileName, endpoints, null, false);
     }
 
+    /**
+     * Parses the java source class to discover Camel endpoints.
+     *
+     * @param clazz                        the java source class
+     * @param baseDir                      the base of the source code
+     * @param fullyQualifiedFileName       the fully qualified source code file name
+     * @param endpoints                    list to add discovered and parsed endpoints
+     * @param unparsable                   list of unparsable nodes
+     * @param includeInlinedRouteBuilders  whether to include inlined route builders in the parsing
+     */
     public static void parseRouteBuilderEndpoints(JavaClassSource clazz, String baseDir, String fullyQualifiedFileName,
                                                   List<CamelEndpointDetails> endpoints, List<String> unparsable, boolean includeInlinedRouteBuilders) {
 
@@ -209,17 +228,16 @@ public final class RouteBuilderParser {
         }
     }
 
-    private static CamelEndpointDetails findEndpointByUri(List<CamelEndpointDetails> endpoints, String uri) {
-        for (CamelEndpointDetails detail : endpoints) {
-            if (uri.equals(detail.getEndpointUri())) {
-                return detail;
-            }
-        }
-        return null;
-    }
-
+    /**
+     * Parses the java source class to discover Camel simple expressions.
+     *
+     * @param clazz                   the java source class
+     * @param baseDir                 the base of the source code
+     * @param fullyQualifiedFileName  the fully qualified source code file name
+     * @param simpleExpressions       list to add discovered and parsed simple expressions
+     */
     public static void parseRouteBuilderSimpleExpressions(JavaClassSource clazz, String baseDir, String fullyQualifiedFileName,
-                                                          List<CamelSimpleDetails> simpleExpressions) {
+                                                          List<CamelSimpleExpressionDetails> simpleExpressions) {
 
         MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
         if (method != null) {
@@ -231,7 +249,7 @@ public final class RouteBuilderParser {
                         fileName = fileName.substring(baseDir.length() + 1);
                     }
 
-                    CamelSimpleDetails details = new CamelSimpleDetails();
+                    CamelSimpleExpressionDetails details = new CamelSimpleExpressionDetails();
                     details.setFileName(fileName);
                     details.setClassName(clazz.getQualifiedName());
                     details.setMethodName("configure");
@@ -247,6 +265,15 @@ public final class RouteBuilderParser {
         }
     }
 
+    private static CamelEndpointDetails findEndpointByUri(List<CamelEndpointDetails> endpoints, String uri) {
+        for (CamelEndpointDetails detail : endpoints) {
+            if (uri.equals(detail.getEndpointUri())) {
+                return detail;
+            }
+        }
+        return null;
+    }
+
     private static int findLineNumber(String fullyQualifiedFileName, int position) {
         int lines = 0;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/StatementFieldSource.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/StatementFieldSource.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/StatementFieldSource.java
deleted file mode 100644
index 1daa85d..0000000
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/StatementFieldSource.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * 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.parser;
-
-import java.util.List;
-
-import org.jboss.forge.roaster.model.Annotation;
-import org.jboss.forge.roaster.model.JavaType;
-import org.jboss.forge.roaster.model.Type;
-import org.jboss.forge.roaster.model.Visibility;
-import org.jboss.forge.roaster.model.impl.TypeImpl;
-import org.jboss.forge.roaster.model.source.AnnotationSource;
-import org.jboss.forge.roaster.model.source.FieldSource;
-import org.jboss.forge.roaster.model.source.JavaClassSource;
-import org.jboss.forge.roaster.model.source.JavaDocSource;
-
-public class StatementFieldSource implements FieldSource {
-
-    // this implementation should only implement the needed logic to support the parser
-
-    private final JavaClassSource origin;
-    private final Object internal;
-    private final Type type;
-
-    public StatementFieldSource(JavaClassSource origin, Object internal, Object typeInternal) {
-        this.origin = origin;
-        this.internal = internal;
-        this.type = new TypeImpl(origin, typeInternal);
-    }
-
-    @Override
-    public FieldSource setType(Class clazz) {
-        return null;
-    }
-
-    @Override
-    public FieldSource setType(String type) {
-        return null;
-    }
-
-    @Override
-    public FieldSource setLiteralInitializer(String value) {
-        return null;
-    }
-
-    @Override
-    public FieldSource setStringInitializer(String value) {
-        return null;
-    }
-
-    @Override
-    public FieldSource setTransient(boolean value) {
-        return null;
-    }
-
-    @Override
-    public FieldSource setVolatile(boolean value) {
-        return null;
-    }
-
-    @Override
-    public FieldSource setType(JavaType entity) {
-        return null;
-    }
-
-    @Override
-    public List<AnnotationSource> getAnnotations() {
-        return null;
-    }
-
-    @Override
-    public boolean hasAnnotation(String type) {
-        return false;
-    }
-
-    @Override
-    public boolean hasAnnotation(Class type) {
-        return false;
-    }
-
-    @Override
-    public AnnotationSource getAnnotation(String type) {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource addAnnotation() {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource addAnnotation(String className) {
-        return null;
-    }
-
-    @Override
-    public void removeAllAnnotations() {
-    }
-
-    @Override
-    public Object removeAnnotation(Annotation annotation) {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource addAnnotation(Class type) {
-        return null;
-    }
-
-    @Override
-    public AnnotationSource getAnnotation(Class type) {
-        return null;
-    }
-
-    @Override
-    public Type getType() {
-        return type;
-    }
-
-    @Override
-    public String getStringInitializer() {
-        return null;
-    }
-
-    @Override
-    public String getLiteralInitializer() {
-        return null;
-    }
-
-    @Override
-    public boolean isTransient() {
-        return false;
-    }
-
-    @Override
-    public boolean isVolatile() {
-        return false;
-    }
-
-    @Override
-    public Object setFinal(boolean finl) {
-        return null;
-    }
-
-    @Override
-    public boolean isFinal() {
-        return false;
-    }
-
-    @Override
-    public Object getInternal() {
-        return internal;
-    }
-
-    @Override
-    public JavaDocSource getJavaDoc() {
-        return null;
-    }
-
-    @Override
-    public boolean hasJavaDoc() {
-        return false;
-    }
-
-    @Override
-    public Object removeJavaDoc() {
-        return null;
-    }
-
-    @Override
-    public Object setName(String name) {
-        return null;
-    }
-
-    @Override
-    public String getName() {
-        return null;
-    }
-
-    @Override
-    public Object getOrigin() {
-        return origin;
-    }
-
-    @Override
-    public Object setStatic(boolean value) {
-        return null;
-    }
-
-    @Override
-    public boolean isStatic() {
-        return false;
-    }
-
-    @Override
-    public Object setPackagePrivate() {
-        return null;
-    }
-
-    @Override
-    public Object setPublic() {
-        return null;
-    }
-
-    @Override
-    public Object setPrivate() {
-        return null;
-    }
-
-    @Override
-    public Object setProtected() {
-        return null;
-    }
-
-    @Override
-    public Object setVisibility(Visibility scope) {
-        return null;
-    }
-
-    @Override
-    public boolean isPackagePrivate() {
-        return false;
-    }
-
-    @Override
-    public boolean isPublic() {
-        return false;
-    }
-
-    @Override
-    public boolean isPrivate() {
-        return false;
-    }
-
-    @Override
-    public boolean isProtected() {
-        return false;
-    }
-
-    @Override
-    public Visibility getVisibility() {
-        return null;
-    }
-
-    @Override
-    public int getColumnNumber() {
-        return 0;
-    }
-
-    @Override
-    public int getStartPosition() {
-        return 0;
-    }
-
-    @Override
-    public int getEndPosition() {
-        return 0;
-    }
-
-    @Override
-    public int getLineNumber() {
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlLineNumberParser.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlLineNumberParser.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlLineNumberParser.java
deleted file mode 100644
index f955409..0000000
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlLineNumberParser.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/**
- * 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.parser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.Stack;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * An XML parser that uses SAX to include line and column number for each XML element in the parsed Document.
- * <p/>
- * The line number and column number can be obtained from a Node/Element using
- * <pre>
- *   String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER);
- *   String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END);
- *   String columnNumber = (String) node.getUserData(XmlLineNumberParser.COLUMN_NUMBER);
- *   String columnNumberEnd = (String) node.getUserData(XmlLineNumberParser.COLUMN_NUMBER_END);
- * </pre>
- */
-public final class XmlLineNumberParser {
-
-    public static final String LINE_NUMBER = "lineNumber";
-    public static final String COLUMN_NUMBER = "colNumber";
-    public static final String LINE_NUMBER_END = "lineNumberEnd";
-    public static final String COLUMN_NUMBER_END = "colNumberEnd";
-
-    private XmlLineNumberParser() {
-    }
-
-    /**
-     * Parses the XML.
-     *
-     * @param is the XML content as an input stream
-     * @return the DOM model
-     * @throws Exception is thrown if error parsing
-     */
-    public static Document parseXml(final InputStream is) throws Exception {
-        return parseXml(is, null, null);
-    }
-
-    /**
-     * Parses the XML.
-     *
-     * @param is the XML content as an input stream
-     * @param rootNames one or more root names that is used as baseline for beginning the parsing, for example camelContext to start parsing
-     *                  when Camel is discovered. Multiple names can be defined separated by comma
-     * @param forceNamespace an optional namespace to force assign to each node. This may be needed for JAXB unmarshalling from XML -> POJO.
-     * @return the DOM model
-     * @throws Exception is thrown if error parsing
-     */
-    public static Document parseXml(final InputStream is, final String rootNames, final String forceNamespace) throws Exception {
-        final Document doc;
-        SAXParser parser;
-        final SAXParserFactory factory = SAXParserFactory.newInstance();
-        parser = factory.newSAXParser();
-        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        // turn off validator and loading external dtd
-        dbf.setValidating(false);
-        dbf.setNamespaceAware(true);
-        dbf.setFeature("http://xml.org/sax/features/namespaces", false);
-        dbf.setFeature("http://xml.org/sax/features/validation", false);
-        dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
-        dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
-        dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
-        dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
-        final DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-        doc = docBuilder.newDocument();
-
-        final Stack<Element> elementStack = new Stack<Element>();
-        final StringBuilder textBuffer = new StringBuilder();
-        final DefaultHandler handler = new DefaultHandler() {
-            private Locator locator;
-            private boolean found;
-
-            @Override
-            public void setDocumentLocator(final Locator locator) {
-                this.locator = locator; // Save the locator, so that it can be used later for line tracking when traversing nodes.
-                this.found = rootNames == null;
-            }
-
-            private boolean isRootName(String qName) {
-                for (String root : rootNames.split(",")) {
-                    if (qName.equals(root)) {
-                        return true;
-                    }
-                }
-                return false;
-            }
-
-            @Override
-            public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException {
-                addTextIfNeeded();
-
-                if (rootNames != null && !found) {
-                    if (isRootName(qName)) {
-                        found = true;
-                    }
-                }
-
-                if (found) {
-                    Element el;
-                    if (forceNamespace != null) {
-                        el = doc.createElementNS(forceNamespace, qName);
-                    } else {
-                        el = doc.createElement(qName);
-                    }
-
-                    for (int i = 0; i < attributes.getLength(); i++) {
-                        el.setAttribute(attributes.getQName(i), attributes.getValue(i));
-                    }
-
-                    el.setUserData(LINE_NUMBER, String.valueOf(this.locator.getLineNumber()), null);
-                    el.setUserData(COLUMN_NUMBER, String.valueOf(this.locator.getColumnNumber()), null);
-                    elementStack.push(el);
-                }
-            }
-
-            @Override
-            public void endElement(final String uri, final String localName, final String qName) {
-                if (!found) {
-                    return;
-                }
-
-                addTextIfNeeded();
-
-                final Element closedEl = elementStack.isEmpty() ? null : elementStack.pop();
-                if (closedEl != null) {
-                    if (elementStack.isEmpty()) {
-                        // Is this the root element?
-                        doc.appendChild(closedEl);
-                    } else {
-                        final Element parentEl = elementStack.peek();
-                        parentEl.appendChild(closedEl);
-                    }
-
-                    closedEl.setUserData(LINE_NUMBER_END, String.valueOf(this.locator.getLineNumber()), null);
-                    closedEl.setUserData(COLUMN_NUMBER_END, String.valueOf(this.locator.getColumnNumber()), null);
-                }
-            }
-
-            @Override
-            public void characters(final char ch[], final int start, final int length) throws SAXException {
-                textBuffer.append(ch, start, length);
-            }
-
-            @Override
-            public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException {
-                // do not resolve external dtd
-                return new InputSource(new StringReader(""));
-            }
-
-            // Outputs text accumulated under the current node
-            private void addTextIfNeeded() {
-                if (textBuffer.length() > 0) {
-                    final Element el = elementStack.isEmpty() ? null : elementStack.peek();
-                    if (el != null) {
-                        final Node textNode = doc.createTextNode(textBuffer.toString());
-                        el.appendChild(textNode);
-                        textBuffer.delete(0, textBuffer.length());
-                    }
-                }
-            }
-        };
-        parser.parse(is, handler);
-
-        return doc;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/07563515/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlRouteParser.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlRouteParser.java b/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlRouteParser.java
index 6e72821..67cbbde 100644
--- a/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlRouteParser.java
+++ b/tooling/route-parser/src/main/java/org/apache/camel/parser/XmlRouteParser.java
@@ -19,20 +19,36 @@ package org.apache.camel.parser;
 import java.io.InputStream;
 import java.util.List;
 
+import org.apache.camel.parser.helper.CamelJavaParserHelper;
+import org.apache.camel.parser.helper.CamelXmlHelper;
+import org.apache.camel.parser.helper.XmlLineNumberParser;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 import org.apache.camel.parser.model.CamelEndpointDetails;
-import org.apache.camel.parser.model.CamelSimpleDetails;
+import org.apache.camel.parser.model.CamelSimpleExpressionDetails;
 import org.jboss.forge.roaster.model.util.Strings;
 
-import static org.apache.camel.parser.CamelXmlHelper.getSafeAttribute;
+import static org.apache.camel.parser.helper.CamelXmlHelper.getSafeAttribute;
 
+/**
+ * A Camel XML parser that parses Camel XML routes source code.
+ * <p/>
+ * This implementation is higher level details, and uses the lower level parser {@link CamelJavaParserHelper}.
+ */
 public final class XmlRouteParser {
 
     private XmlRouteParser() {
     }
 
+    /**
+     * Parses the XML source to discover Camel endpoints.
+     *
+     * @param xml                     the xml file as input stream
+     * @param baseDir                 the base of the source code
+     * @param fullyQualifiedFileName  the fully qualified source code file name
+     * @param endpoints               list to add discovered and parsed endpoints
+     */
     public static void parseXmlRouteEndpoints(InputStream xml, String baseDir, String fullyQualifiedFileName,
                                               List<CamelEndpointDetails> endpoints) throws Exception {
 
@@ -87,8 +103,16 @@ public final class XmlRouteParser {
         }
     }
 
+    /**
+     * Parses the XML source to discover Camel endpoints.
+     *
+     * @param xml                     the xml file as input stream
+     * @param baseDir                 the base of the source code
+     * @param fullyQualifiedFileName  the fully qualified source code file name
+     * @param simpleExpressions       list to add discovered and parsed simple expressions
+     */
     public static void parseXmlRouteSimpleExpressions(InputStream xml, String baseDir, String fullyQualifiedFileName,
-                                                      List<CamelSimpleDetails> simpleExpressions) throws Exception {
+                                                      List<CamelSimpleExpressionDetails> simpleExpressions) throws Exception {
 
         // find all the simple expressions
         // try parse it as dom
@@ -111,7 +135,7 @@ public final class XmlRouteParser {
                     fileName = fileName.substring(baseDir.length() + 1);
                 }
 
-                CamelSimpleDetails detail = new CamelSimpleDetails();
+                CamelSimpleExpressionDetails detail = new CamelSimpleExpressionDetails();
                 detail.setFileName(fileName);
                 detail.setLineNumber(lineNumber);
                 detail.setLineNumberEnd(lineNumberEnd);


Mime
View raw message