Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make runtime more modular (required for quarkus) #106

Merged
merged 5 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>camel-k-runtime-groovy</artifactId>
<artifactId>camel-k-loader-groovy</artifactId>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy
package org.apache.camel.k.loader.groovy

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.groovy.dsl.IntegrationConfiguration
import org.apache.camel.k.loader.groovy.dsl.IntegrationConfiguration
import org.apache.camel.k.support.URIResolver
import org.codehaus.groovy.control.CompilerConfiguration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl
package org.apache.camel.k.loader.groovy.dsl


import org.apache.camel.support.IntrospectionSupport
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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.loader.groovy.dsl;

import org.apache.camel.CamelContext;
import org.apache.camel.Component;

public class Components {
private CamelContext context;

public Components(CamelContext context) {
this.context = context;
}

public Component get(String scheme) {
return context.getComponent(scheme, true);
}

public Component put(String scheme, Component instance) {
context.addComponent(scheme, instance);

return instance;
}

public Component make(String scheme, String type) {
final Class<?> clazz = context.getClassResolver().resolveClass(type);
final Component instance = (Component)context.getInjector().newInstance(clazz);

context.addComponent(scheme, instance);

return instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl
package org.apache.camel.k.loader.groovy.dsl

import org.apache.camel.CamelContext
import org.apache.camel.Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl
package org.apache.camel.k.loader.groovy.dsl

import org.apache.camel.CamelContext

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl
package org.apache.camel.k.loader.groovy.dsl

import org.apache.camel.Exchange
import org.apache.camel.Predicate
import org.apache.camel.Processor
import org.apache.camel.builder.RouteBuilder
import org.apache.camel.k.jvm.dsl.Components
import org.apache.camel.model.*
import org.apache.camel.spi.Registry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl
package org.apache.camel.k.loader.groovy.dsl

import org.apache.camel.spi.Registry

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl
package org.apache.camel.k.loader.groovy.dsl

import org.apache.camel.builder.RouteBuilder
import org.apache.camel.model.rest.RestConfigurationDefinition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.extension
package org.apache.camel.k.loader.groovy.extension

import org.apache.camel.Exchange
import org.apache.camel.component.log.LogComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
moduleName=camel-k-runtime-groovy
moduleVersion=0.0.3-SNAPSHOT
extensionClasses=org.apache.camel.k.groovy.extension.LogComponentExtension
extensionClasses=org.apache.camel.k.loader.groovy.extension.LogComponentExtension
#staticExtensionClasses=support.StaticStringExtension
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# limitations under the License.
#

class=org.apache.camel.k.groovy.GroovyRoutesLoader
class=org.apache.camel.k.loader.groovy.GroovyRoutesLoader
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
def ctx = context(scope: scriptScope())

contributor(ctx) {
delegatesTo(findClass('org.apache.camel.k.groovy.dsl.IntegrationConfiguration'))
delegatesTo(findClass('org.apache.camel.k.loader.groovy.dsl.IntegrationConfiguration'))
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy
package org.apache.camel.k.loader.groovy

import org.apache.camel.impl.DefaultCamelContext
import org.apache.camel.k.Source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl
package org.apache.camel.k.loader.groovy.dsl

import org.apache.camel.Processor
import org.apache.camel.component.log.LogComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.groovy.dsl.extension
package org.apache.camel.k.loader.groovy.dsl.extension

import org.apache.camel.component.log.LogComponent
import org.apache.camel.impl.DefaultCamelContext
Expand Down
124 changes: 124 additions & 0 deletions camel-k-loader-java/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>camel-k-loader-java</artifactId>

<dependencies>

<!-- ****************************** -->
<!-- -->
<!-- RUNTIME -->
<!-- -->
<!-- ****************************** -->

<dependency>
<groupId>org.apache.camel.k</groupId>
<artifactId>camel-k-runtime-core</artifactId>
</dependency>

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-engine</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jooq</groupId>
<artifactId>joor-java-8</artifactId>
<version>${joor.version}</version>
</dependency>

<!-- ****************************** -->
<!-- -->
<!-- TESTS -->
<!-- -->
<!-- ****************************** -->

<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-undertow</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-timer</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-seda</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-log</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-rest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-direct</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-properties</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j2.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.jvm.loader;
package org.apache.camel.k.loader.java;

import java.util.Collections;
import java.util.List;
Expand All @@ -25,7 +25,7 @@
import org.apache.camel.k.Source;
import org.apache.commons.lang3.StringUtils;

public class JavaClassLoader implements RoutesLoader {
public class JavaClassRoutesLoader implements RoutesLoader {
@Override
public List<String> getSupportedLanguages() {
return Collections.singletonList("class");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.jvm.loader;
package org.apache.camel.k.loader.java;

import java.io.InputStream;
import java.nio.charset.StandardCharsets;
Expand All @@ -36,7 +36,7 @@
import org.apache.commons.lang3.StringUtils;
import org.joor.Reflect;

public class JavaSourceLoader implements RoutesLoader {
public class JavaSourceRoutesLoader implements RoutesLoader {
@Override
public List<String> getSupportedLanguages() {
return Collections.singletonList("java");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# limitations under the License.
#

class=org.apache.camel.k.jvm.loader.JavaClassLoader
class=org.apache.camel.k.loader.java.JavaClassRoutesLoader
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# limitations under the License.
#

class=org.apache.camel.k.jvm.loader.JavaSourceLoader
class=org.apache.camel.k.loader.java.JavaSourceRoutesLoader
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.k.jvm;
package org.apache.camel.k.loader.java;

import org.apache.camel.builder.RouteBuilder;

Expand Down
Loading