nicolaferraro commented on a change in pull request #47: Route loaders should derive language from 'kamel run --language' #46 URL: https://github.com/apache/camel-k/pull/47#discussion_r216910580
########## File path: runtime/jvm/src/main/java/org/apache/camel/k/jvm/RoutesLoaders.java ########## @@ -40,34 +39,50 @@ import org.codehaus.groovy.control.CompilerConfiguration; import org.joor.Reflect; -public enum RouteLoaders implements RoutesLoader { +import static org.apache.camel.k.jvm.Routes.SCHEME_CLASSPATH; + +public enum RoutesLoaders implements RoutesLoader { JavaClass { + @Override + public List<String> getSupportedLanguages() { + return Arrays.asList("class"); + } + @Override public boolean test(String resource) { - return !isScripting(resource) && hasSupportedScheme(resource); + //TODO: add support for compiled classes + return !Routes.isScripting(resource) && !resource.endsWith(".class"); } @Override public RouteBuilder load(String resource) throws Exception { - String path = resource.substring(Application.SCHEME_CLASSPATH.length()); + String path = resource.substring(SCHEME_CLASSPATH.length()); Class<?> type = Class.forName(path); if (!RouteBuilder.class.isAssignableFrom(type)) { - throw new IllegalStateException("The class provided (" + path + ") is not a org.apache.camel.builder.RouteBuilder"); + throw new IllegalStateException("The class provided (" + path + ") loadResourceAsInputStream not a org.apache.camel.builder.RouteBuilder"); Review comment: typo ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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