This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch camel-2.x in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/camel-2.x by this push: new 989e25c camel-2.x: remove camel 3 bits new 6190cf2 Merge pull request #74 from lburgazzoli/camel-2.x-cleanup 989e25c is described below commit 989e25c4397dd5be2c7bc011335ef1d8fc964969 Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Tue Jun 4 09:09:15 2019 +0200 camel-2.x: remove camel 3 bits --- .travis.yml | 9 +- camel-k-adapter-camel-2/pom.xml | 71 ------------ .../camel/k/adapter/DefaultAsyncProducer.java | 25 ---- .../apache/camel/k/adapter/DefaultComponent.java | 28 ----- .../apache/camel/k/adapter/DefaultEndpoint.java | 27 ----- .../apache/camel/k/adapter/DefaultRegistry.java | 82 ------------- .../org/apache/camel/k/adapter/Exceptions.java | 29 ----- .../java/org/apache/camel/k/adapter/Exchanges.java | 30 ----- .../org/apache/camel/k/adapter/Introspection.java | 43 ------- .../main/java/org/apache/camel/k/adapter/Main.java | 65 ----------- .../java/org/apache/camel/k/adapter/Objects.java | 27 ----- .../org/apache/camel/k/adapter/Processors.java | 30 ----- .../java/org/apache/camel/k/adapter/Registry.java | 38 ------ .../java/org/apache/camel/k/adapter/Resources.java | 43 ------- .../java/org/apache/camel/k/adapter/Routes.java | 26 ----- .../org/apache/camel/k/adapter/ServiceSupport.java | 20 ---- .../java/org/apache/camel/k/adapter/Services.java | 47 -------- camel-k-adapter-camel-3/pom.xml | 71 ------------ .../camel/k/adapter/DefaultAsyncProducer.java | 25 ---- .../apache/camel/k/adapter/DefaultComponent.java | 28 ----- .../apache/camel/k/adapter/DefaultEndpoint.java | 27 ----- .../apache/camel/k/adapter/DefaultRegistry.java | 20 ---- .../org/apache/camel/k/adapter/Exceptions.java | 28 ----- .../java/org/apache/camel/k/adapter/Exchanges.java | 30 ----- .../org/apache/camel/k/adapter/Introspection.java | 47 -------- .../main/java/org/apache/camel/k/adapter/Main.java | 57 --------- .../java/org/apache/camel/k/adapter/Objects.java | 27 ----- .../org/apache/camel/k/adapter/Processors.java | 30 ----- .../java/org/apache/camel/k/adapter/Registry.java | 20 ---- .../java/org/apache/camel/k/adapter/Resources.java | 43 ------- .../java/org/apache/camel/k/adapter/Routes.java | 26 ----- .../org/apache/camel/k/adapter/ServiceSupport.java | 20 ---- .../java/org/apache/camel/k/adapter/Services.java | 48 -------- .../maven/processors/CatalogProcessor_2_x.java | 1 - .../maven/processors/CataloProcessor2Test.java | 3 - camel-k-runtime-core/pom.xml | 35 ------ .../java/org/apache/camel/k/InMemoryRegistry.java | 65 ++++++++++- .../src/main/java/org/apache/camel/k/Runtime.java | 33 +++++- .../apache/camel/k/listener/ContextConfigurer.java | 6 +- .../k/listener/ContextLifecycleConfigurer.java | 7 +- .../apache/camel/k/listener/RoutesConfigurer.java | 9 +- .../org/apache/camel/k/listener/RoutesDumper.java | 2 +- .../apache/camel/k/support/PropertiesSupport.java | 4 +- .../org/apache/camel/k/support/URIResolver.java | 4 +- .../camel-k-runtime-example-health/pom.xml | 33 ------ .../camel-k-runtime-example-servlet/pom.xml | 33 ------ camel-k-runtime-groovy/pom.xml | 41 ------- .../k/groovy/dsl/ComponentConfiguration.groovy | 9 +- .../org/apache/camel/k/groovy/LoaderTest.groovy | 4 +- .../camel/k/groovy/dsl/IntegrationTest.groovy | 6 +- .../k/groovy/dsl/extension/LogExtensionTest.groovy | 4 +- camel-k-runtime-health/pom.xml | 41 ------- camel-k-runtime-jvm/pom.xml | 41 ------- .../org/apache/camel/k/jvm/ApplicationRuntime.java | 51 ++++++++- .../org/apache/camel/k/jvm/loader/XmlLoader.java | 5 +- .../org/apache/camel/k/jvm/PropertiesTest.java | 12 +- .../camel/k/jvm/RoutesLoadersCommonTest.java | 5 +- .../org/apache/camel/k/jvm/RoutesLoadersTest.java | 3 +- .../java/org/apache/camel/k/jvm/RuntimeTest.java | 8 +- camel-k-runtime-kotlin/pom.xml | 41 ------- .../kotlin/org/apache/camel/k/kotlin/LoaderTest.kt | 3 +- .../apache/camel/k/kotlin/dsl/IntegrationTest.kt | 22 ++-- .../camel/k/kotlin/extension/LogExtensionTest.kt | 20 +++- camel-k-runtime-servlet/pom.xml | 41 ------- .../apache/camel/k/servlet/ServletEndpoint.java | 2 +- .../camel/k/servlet/ServletCustomizerTest.java | 5 +- .../servlet/ServletRegistrationCustomizerTest.java | 5 +- camel-k-runtime-yaml/pom.xml | 41 ------- .../org/apache/camel/k/yaml/RoutesLoaderTest.java | 3 +- camel-knative-http/pom.xml | 46 -------- .../knative/http/KnativeHttpComponent.java | 10 +- camel-knative/pom.xml | 127 +++++---------------- .../camel/component/knative/KnativeComponent.java | 6 +- .../camel/component/knative/KnativeEndpoint.java | 17 ++- .../component/knative/KnativeEnvironment.java | 18 ++- .../camel/component/knative/KnativeProducer.java | 18 +-- pom.xml | 58 +--------- 77 files changed, 286 insertions(+), 1849 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8d42bcf..4e48fb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,8 +19,7 @@ language: java script: - - ./mvnw clean install -Dcamel2 - - ./mvnw clean install -Dcamel2 -Dcamel2.version=2.21.0 - - ./mvnw clean install -Dcamel2 -Dcamel2.version=2.22.0 - - ./mvnw clean install -Dcamel2 -Dcamel2.version=2.23.0 - - ./mvnw clean install -Dcamel3 + - ./mvnw clean install + - ./mvnw clean install -Dcamel.version=2.21.0 + - ./mvnw clean install -Dcamel.version=2.22.0 + - ./mvnw clean install -Dcamel.version=2.23.0 diff --git a/camel-k-adapter-camel-2/pom.xml b/camel-k-adapter-camel-2/pom.xml deleted file mode 100644 index 256a7e4..0000000 --- a/camel-k-adapter-camel-2/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?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>0.3.4-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>camel-k-adapter-camel-2</artifactId> - - <dependencies> - - <!-- ****************************** --> - <!-- --> - <!-- RUNTIME --> - <!-- --> - <!-- ****************************** --> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - <version>${camel2.version}</version> - <scope>provided</scope> - </dependency> - - <!-- ****************************** --> - <!-- --> - <!-- TESTS --> - <!-- --> - <!-- ****************************** --> - - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultAsyncProducer.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultAsyncProducer.java deleted file mode 100644 index 4e3f500..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultAsyncProducer.java +++ /dev/null @@ -1,25 +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.k.adapter; - -import org.apache.camel.Endpoint; - -public abstract class DefaultAsyncProducer extends org.apache.camel.impl.DefaultAsyncProducer { - public DefaultAsyncProducer(Endpoint endpoint) { - super(endpoint); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultComponent.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultComponent.java deleted file mode 100644 index 01a0f60..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultComponent.java +++ /dev/null @@ -1,28 +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.k.adapter; - -import org.apache.camel.CamelContext; - -public abstract class DefaultComponent extends org.apache.camel.impl.DefaultComponent { - public DefaultComponent() { - } - - public DefaultComponent(CamelContext context) { - super(context); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultEndpoint.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultEndpoint.java deleted file mode 100644 index bd998e0..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultEndpoint.java +++ /dev/null @@ -1,27 +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.k.adapter; - -import org.apache.camel.Component; - -public abstract class DefaultEndpoint extends org.apache.camel.impl.DefaultEndpoint { - public DefaultEndpoint() { - } - public DefaultEndpoint(String endpointUri, Component component) { - super(endpointUri, component); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultRegistry.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultRegistry.java deleted file mode 100644 index a29ef42..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/DefaultRegistry.java +++ /dev/null @@ -1,82 +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.k.adapter; - -import java.util.HashMap; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.stream.Collectors; - -import org.apache.camel.NoSuchBeanException; - -public class DefaultRegistry implements Registry { - private final ConcurrentMap<String, Object> registry; - - public DefaultRegistry() { - this.registry = new ConcurrentHashMap<>(); - } - - @Override - public void bind(String name, Object bean) { - this.registry.put(name, bean); - } - - @Override - public Object lookupByName(String name) { - return registry.get(name); - } - - @Override - public <T> T lookupByNameAndType(String name, Class<T> type) { - final Object answer = lookupByName(name); - - if (answer != null) { - try { - return type.cast(answer); - } catch (Throwable t) { - throw new NoSuchBeanException( - name, - "Found bean: " + name + " in RuntimeRegistry: " + this + " of type: " + answer.getClass().getName() + " expected type was: " + type, - t - ); - } - } - - return null; - } - - @Override - public <T> Map<String, T> findByTypeWithName(Class<T> type) { - final Map<String, T> result = new HashMap<>(); - - registry.entrySet().stream() - .filter(entry -> type.isInstance(entry.getValue())) - .forEach(entry -> result.put(entry.getKey(), type.cast(entry.getValue()))); - - return result; - } - - @Override - public <T> Set<T> findByType(Class<T> type) { - return registry.values().stream() - .filter(type::isInstance) - .map(type::cast) - .collect(Collectors.toSet()); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exceptions.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exceptions.java deleted file mode 100644 index b70acee..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exceptions.java +++ /dev/null @@ -1,29 +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.k.adapter; - -import org.apache.camel.RuntimeCamelException; -import org.apache.camel.util.ObjectHelper; - -public final class Exceptions { - private Exceptions() { - } - - public static RuntimeCamelException wrapRuntimeCamelException(Throwable e) { - return ObjectHelper.wrapRuntimeCamelException(e); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exchanges.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exchanges.java deleted file mode 100644 index 8d6de5e..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Exchanges.java +++ /dev/null @@ -1,30 +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.k.adapter; - -import org.apache.camel.CamelContext; -import org.apache.camel.Exchange; -import org.apache.camel.impl.DefaultExchange; - -public final class Exchanges { - protected Exchanges() { - } - - public final static Exchange newDefaultExchange(CamelContext context) { - return new DefaultExchange(context); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Introspection.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Introspection.java deleted file mode 100644 index e08b1f6..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Introspection.java +++ /dev/null @@ -1,43 +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.k.adapter; - -import java.util.Map; - -import org.apache.camel.TypeConverter; -import org.apache.camel.util.IntrospectionSupport; - -public final class Introspection { - private Introspection() { - } - - public static boolean setProperties(TypeConverter typeConverter, Object target, Map<String, Object> properties) throws Exception { - return IntrospectionSupport.setProperties(typeConverter, target, properties); - } - - public static boolean setProperty(Object target, String name, Object value) throws Exception { - return IntrospectionSupport.setProperty(target, name, value, false); - } - - public static boolean setProperty(Object target, String name, Object value, boolean builderPattern) throws Exception { - return IntrospectionSupport.setProperty(target, name, value, builderPattern); - } - - public static boolean getProperties(Object target, Map<String, Object> properties, String optionPrefix, boolean includeNull) { - return IntrospectionSupport.getProperties(target, properties, optionPrefix, includeNull); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Main.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Main.java deleted file mode 100644 index b40c68e..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Main.java +++ /dev/null @@ -1,65 +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.k.adapter; - - -import java.util.Collections; -import java.util.Map; - -import org.apache.camel.CamelContext; -import org.apache.camel.ProducerTemplate; - -public class Main extends org.apache.camel.main.MainSupport { - private CamelContext context; - - public Main(CamelContext context) { - this.context = context; - } - - @Override - protected ProducerTemplate findOrCreateCamelTemplate() { - return context.createProducerTemplate(); - } - - @Override - protected Map<String, CamelContext> getCamelContextMap() { - return Collections.singletonMap(context.getName(), context); - } - - @Override - protected void doStart() throws Exception { - super.doStart(); - postProcessContext(); - - try { - context.start(); - } finally { - if (context.isVetoStarted()) { - completed(); - } - } - } - - @Override - protected void doStop() throws Exception { - super.doStop(); - - if (!getCamelContexts().isEmpty()) { - context.stop(); - } - } -} \ No newline at end of file diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Objects.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Objects.java deleted file mode 100644 index 00e0bc5..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Objects.java +++ /dev/null @@ -1,27 +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.k.adapter; - -import java.util.Iterator; - -import org.apache.camel.util.ObjectHelper; - -public final class Objects { - public static Iterator<?> createIterator(Object value, String delimiter, boolean allowEmptyValues) { - return ObjectHelper.createIterator(value, delimiter, allowEmptyValues); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Processors.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Processors.java deleted file mode 100644 index 24c580e..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Processors.java +++ /dev/null @@ -1,30 +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.k.adapter; - -import org.apache.camel.AsyncProcessor; -import org.apache.camel.Processor; -import org.apache.camel.util.AsyncProcessorConverterHelper; - -public final class Processors { - private Processors() { - } - - public static AsyncProcessor convertToAsync(Processor processor) { - return AsyncProcessorConverterHelper.convert(processor); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Registry.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Registry.java deleted file mode 100644 index 0f2e20e..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Registry.java +++ /dev/null @@ -1,38 +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.k.adapter; - -import java.util.Map; - -public interface Registry extends org.apache.camel.spi.Registry { - void bind(String name, Object bean); - - @SuppressWarnings("deprecation") - default public Object lookup(String name) { - return lookupByName(name); - } - - @SuppressWarnings("deprecation") - default public <T> T lookup(String name, Class<T> type) { - return lookupByNameAndType(name, type); - } - - @SuppressWarnings("deprecation") - default public <T> Map<String, T> lookupByType(Class<T> type) { - return findByTypeWithName(type); - } -} \ No newline at end of file diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Resources.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Resources.java deleted file mode 100644 index 961223b..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Resources.java +++ /dev/null @@ -1,43 +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.k.adapter; - -import java.io.IOException; -import java.io.InputStream; - -import org.apache.camel.CamelContext; -import org.apache.camel.model.ModelHelper; -import org.apache.camel.model.RoutesDefinition; -import org.apache.camel.model.rest.RestsDefinition; -import org.apache.camel.util.ResourceHelper; - -public final class Resources { - private Resources() { - } - - public static InputStream resolveResourceAsInputStream(CamelContext camelContext, String uri) throws IOException { - return ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uri); - } - - public static RoutesDefinition loadRoutesDefinition(CamelContext camelContext, InputStream is) throws Exception { - return camelContext.loadRoutesDefinition(is); - } - - public static RestsDefinition loadRestsDefinition(CamelContext camelContext, InputStream is) throws Exception { - return camelContext.loadRestsDefinition(is); - } -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Routes.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Routes.java deleted file mode 100644 index 7bc27f2..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Routes.java +++ /dev/null @@ -1,26 +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.k.adapter; - -import org.apache.camel.model.FromDefinition; -import org.apache.camel.model.RouteDefinition; - -public final class Routes { - public static FromDefinition getInput(RouteDefinition definition) { - return definition.getInputs().get(0); - } -} \ No newline at end of file diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java deleted file mode 100644 index c7ed213..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java +++ /dev/null @@ -1,20 +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.k.adapter; - -public abstract class ServiceSupport extends org.apache.camel.support.ServiceSupport { -} diff --git a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Services.java b/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Services.java deleted file mode 100644 index 560021f..0000000 --- a/camel-k-adapter-camel-2/src/main/java/org/apache/camel/k/adapter/Services.java +++ /dev/null @@ -1,47 +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.k.adapter; - -import java.util.Arrays; - -import org.apache.camel.util.ServiceHelper; - -public final class Services { - private Services() { - - } - - public static void start(Object... services) throws Exception { - ServiceHelper.startServices(services); - } - - public static void stop(Object... services) throws Exception { - ServiceHelper.stopServices(services); - } - - public static void suspend(Object... services) throws Exception { - ServiceHelper.suspendServices(Arrays.asList(services)); - } - - public static void resume(Object... services) throws Exception { - ServiceHelper.resumeService(Arrays.asList(services)); - } - - public static void shutdown(Object... services) throws Exception { - ServiceHelper.stopAndShutdownServices(Arrays.asList(services)); - } -} diff --git a/camel-k-adapter-camel-3/pom.xml b/camel-k-adapter-camel-3/pom.xml deleted file mode 100644 index 4342c15..0000000 --- a/camel-k-adapter-camel-3/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?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>0.3.4-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>camel-k-adapter-camel-3</artifactId> - - <dependencies> - - <!-- ****************************** --> - <!-- --> - <!-- RUNTIME --> - <!-- --> - <!-- ****************************** --> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core</artifactId> - <version>${camel3.version}</version> - <scope>provided</scope> - </dependency> - - <!-- ****************************** --> - <!-- --> - <!-- TESTS --> - <!-- --> - <!-- ****************************** --> - - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit-jupiter.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.assertj</groupId> - <artifactId>assertj-core</artifactId> - <version>${assertj.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultAsyncProducer.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultAsyncProducer.java deleted file mode 100644 index 5fe22b0..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultAsyncProducer.java +++ /dev/null @@ -1,25 +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.k.adapter; - -import org.apache.camel.Endpoint; - -public abstract class DefaultAsyncProducer extends org.apache.camel.support.DefaultAsyncProducer { - public DefaultAsyncProducer(Endpoint endpoint) { - super(endpoint); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultComponent.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultComponent.java deleted file mode 100644 index a9f746f..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultComponent.java +++ /dev/null @@ -1,28 +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.k.adapter; - -import org.apache.camel.CamelContext; - -public abstract class DefaultComponent extends org.apache.camel.support.DefaultComponent { - public DefaultComponent() { - } - - public DefaultComponent(CamelContext context) { - super(context); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultEndpoint.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultEndpoint.java deleted file mode 100644 index db38454..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultEndpoint.java +++ /dev/null @@ -1,27 +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.k.adapter; - -import org.apache.camel.Component; - -public abstract class DefaultEndpoint extends org.apache.camel.support.DefaultEndpoint { - public DefaultEndpoint() { - } - public DefaultEndpoint(String endpointUri, Component component) { - super(endpointUri, component); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultRegistry.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultRegistry.java deleted file mode 100644 index cc1bdf5..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/DefaultRegistry.java +++ /dev/null @@ -1,20 +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.k.adapter; - -public class DefaultRegistry extends org.apache.camel.support.DefaultRegistry implements Registry { -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exceptions.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exceptions.java deleted file mode 100644 index dc4cb01..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exceptions.java +++ /dev/null @@ -1,28 +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.k.adapter; - -import org.apache.camel.RuntimeCamelException; - -public final class Exceptions { - private Exceptions() { - } - - public static RuntimeCamelException wrapRuntimeCamelException(Throwable e) { - return RuntimeCamelException.wrapRuntimeCamelException(e); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exchanges.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exchanges.java deleted file mode 100644 index 4e56962..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Exchanges.java +++ /dev/null @@ -1,30 +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.k.adapter; - -import org.apache.camel.CamelContext; -import org.apache.camel.Exchange; -import org.apache.camel.support.DefaultExchange; - -public final class Exchanges { - protected Exchanges() { - } - - public final static Exchange newDefaultExchange(CamelContext context) { - return new DefaultExchange(context); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Introspection.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Introspection.java deleted file mode 100644 index 2afca13..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Introspection.java +++ /dev/null @@ -1,47 +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.k.adapter; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.camel.TypeConverter; -import org.apache.camel.support.IntrospectionSupport; - -public final class Introspection { - private Introspection() { - } - - public static boolean setProperties(TypeConverter typeConverter, Object target, Map<String, Object> properties) throws Exception { - return IntrospectionSupport.setProperties(typeConverter, target, properties); - } - - public static boolean setProperty(Object target, String name, Object value) throws Exception { - return IntrospectionSupport.setProperty(target, name, value, false); - } - - public static boolean setProperty(Object target, String name, Object value, boolean builderPattern) throws Exception { - return IntrospectionSupport.setProperty(target, name, value, builderPattern); - } - - public static Map<String, Object> getProperties(Object target, String optionPrefix, boolean includeNull) { - Map<String, Object> properties = new HashMap<>(); - IntrospectionSupport.getProperties(target, properties, optionPrefix, includeNull); - - return properties; - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Main.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Main.java deleted file mode 100644 index 95d1088..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Main.java +++ /dev/null @@ -1,57 +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.k.adapter; - - -import org.apache.camel.CamelContext; -import org.apache.camel.ProducerTemplate; - -public class Main extends org.apache.camel.main.MainSupport { - public Main(CamelContext context) { - this.camelContext = context; - } - - @Override - protected void doStart() throws Exception { - super.doStart(); - postProcessCamelContext(camelContext); - - try { - // if we were veto started then mark as completed - this.camelContext.start(); - } finally { - if (this.camelContext.isVetoStarted()) { - completed(); - } - } - } - - protected void doStop() throws Exception { - super.doStop(); - this.camelContext.stop(); - } - - @Override - protected ProducerTemplate findOrCreateCamelTemplate() { - return this.camelContext.createProducerTemplate(); - } - - @Override - protected CamelContext createCamelContext() { - return this.camelContext; - } -} \ No newline at end of file diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Objects.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Objects.java deleted file mode 100644 index 1911e4e..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Objects.java +++ /dev/null @@ -1,27 +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.k.adapter; - -import java.util.Iterator; - -import org.apache.camel.support.ObjectHelper; - -public final class Objects { - public static Iterator<?> createIterator(Object value, String delimiter, boolean allowEmptyValues) { - return ObjectHelper.createIterator(value, delimiter, allowEmptyValues); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Processors.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Processors.java deleted file mode 100644 index 585dfa4..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Processors.java +++ /dev/null @@ -1,30 +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.k.adapter; - -import org.apache.camel.AsyncProcessor; -import org.apache.camel.Processor; -import org.apache.camel.support.AsyncProcessorConverterHelper; - -public final class Processors { - private Processors() { - } - - public static AsyncProcessor convertToAsync(Processor processor) { - return AsyncProcessorConverterHelper.convert(processor); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Registry.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Registry.java deleted file mode 100644 index c007f2d..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Registry.java +++ /dev/null @@ -1,20 +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.k.adapter; - -public interface Registry extends org.apache.camel.spi.Registry { -} \ No newline at end of file diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Resources.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Resources.java deleted file mode 100644 index 072478f..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Resources.java +++ /dev/null @@ -1,43 +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.k.adapter; - -import java.io.IOException; -import java.io.InputStream; - -import org.apache.camel.CamelContext; -import org.apache.camel.model.ModelHelper; -import org.apache.camel.model.RoutesDefinition; -import org.apache.camel.model.rest.RestsDefinition; -import org.apache.camel.support.ResourceHelper; - -public final class Resources { - private Resources() { - } - - public static InputStream resolveResourceAsInputStream(CamelContext camelContext, String uri) throws IOException { - return ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uri); - } - - public static RoutesDefinition loadRoutesDefinition(CamelContext camelContext, InputStream is) throws Exception { - return ModelHelper.loadRoutesDefinition(camelContext, is); - } - - public static RestsDefinition loadRestsDefinition(CamelContext camelContext, InputStream is) throws Exception { - return ModelHelper.loadRestsDefinition(camelContext, is); - } -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Routes.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Routes.java deleted file mode 100644 index 3cb96f2..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Routes.java +++ /dev/null @@ -1,26 +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.k.adapter; - -import org.apache.camel.model.FromDefinition; -import org.apache.camel.model.RouteDefinition; - -public final class Routes { - public static FromDefinition getInput(RouteDefinition definition) { - return definition.getInput(); - } -} \ No newline at end of file diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java deleted file mode 100644 index 26c8c72..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/ServiceSupport.java +++ /dev/null @@ -1,20 +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.k.adapter; - -public abstract class ServiceSupport extends org.apache.camel.support.service.ServiceSupport { -} diff --git a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Services.java b/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Services.java deleted file mode 100644 index fbf07f5..0000000 --- a/camel-k-adapter-camel-3/src/main/java/org/apache/camel/k/adapter/Services.java +++ /dev/null @@ -1,48 +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.k.adapter; - - -import java.util.Arrays; - -import org.apache.camel.support.service.ServiceHelper; - -public final class Services { - private Services() { - - } - - public static void start(Object... services) throws Exception { - ServiceHelper.startService(services); - } - - public static void stop(Object... services) throws Exception { - ServiceHelper.stopService(services); - } - - public static void suspend(Object... services) throws Exception { - ServiceHelper.suspendServices(Arrays.asList(services)); - } - - public static void resume(Object... services) throws Exception { - ServiceHelper.resumeService(Arrays.asList(services)); - } - - public static void shutdown(Object... services) throws Exception { - ServiceHelper.stopAndShutdownServices(Arrays.asList(services)); - } -} diff --git a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java index 8210295..69e6d00 100644 --- a/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java +++ b/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor_2_x.java @@ -94,7 +94,6 @@ public class CatalogProcessor_2_x implements CatalogProcessor { artifact.setGroupId("org.apache.camel.k"); artifact.setArtifactId("camel-k-runtime-jvm"); artifact.addDependency("org.apache.camel", "camel-core"); - artifact.addDependency("org.apache.camel.k", "camel-k-adapter-camel-2"); artifacts.put(artifact.getArtifactId(), artifact); } diff --git a/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor2Test.java b/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor2Test.java index b980ed4..bd8bba6 100644 --- a/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor2Test.java +++ b/camel-k-maven-plugin/src/test/java/org/apache/camel/k/tooling/maven/processors/CataloProcessor2Test.java @@ -89,9 +89,6 @@ public class CataloProcessor2Test extends AbstractCataloProcessorTest { assertThat(a.getDependencies()).anyMatch( d -> d.getGroupId().equals("org.apache.camel") && d.getArtifactId().equals("camel-core") ); - assertThat(a.getDependencies()).anyMatch( - d -> d.getGroupId().equals("org.apache.camel.k") && d.getArtifactId().equals("camel-k-adapter-camel-2") - ); }); assertThat(artifactMap.get("camel-k-runtime-groovy")).satisfies(a -> { assertThat(a.getDependencies()).anyMatch( diff --git a/camel-k-runtime-core/pom.xml b/camel-k-runtime-core/pom.xml index a6e49e8..ede33d9 100644 --- a/camel-k-runtime-core/pom.xml +++ b/camel-k-runtime-core/pom.xml @@ -117,39 +117,4 @@ </plugins> </build> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/InMemoryRegistry.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/InMemoryRegistry.java index 6188654..80f0a19 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/InMemoryRegistry.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/InMemoryRegistry.java @@ -16,7 +16,68 @@ */ package org.apache.camel.k; -import org.apache.camel.k.adapter.DefaultRegistry; -public class InMemoryRegistry extends DefaultRegistry implements Runtime.Registry { +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.stream.Collectors; + +import org.apache.camel.NoSuchBeanException; + +public class InMemoryRegistry implements Runtime.Registry { + private final ConcurrentMap<String, Object> registry; + + public InMemoryRegistry() { + this.registry = new ConcurrentHashMap<>(); + } + + @Override + public void bind(String name, Object bean) { + this.registry.put(name, bean); + } + + @Override + public Object lookupByName(String name) { + return registry.get(name); + } + + @Override + public <T> T lookupByNameAndType(String name, Class<T> type) { + final Object answer = lookupByName(name); + + if (answer != null) { + try { + return type.cast(answer); + } catch (Throwable t) { + throw new NoSuchBeanException( + name, + "Found bean: " + name + " in RuntimeRegistry: " + this + " of type: " + answer.getClass().getName() + " expected type was: " + type, + t + ); + } + } + + return null; + } + + @Override + public <T> Map<String, T> findByTypeWithName(Class<T> type) { + final Map<String, T> result = new HashMap<>(); + + registry.entrySet().stream() + .filter(entry -> type.isInstance(entry.getValue())) + .forEach(entry -> result.put(entry.getKey(), type.cast(entry.getValue()))); + + return result; + } + + @Override + public <T> Set<T> findByType(Class<T> type) { + return registry.values().stream() + .filter(type::isInstance) + .map(type::cast) + .collect(Collectors.toSet()); + } } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java index 4b1e6f7..549b1e2 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Runtime.java @@ -16,17 +16,24 @@ */ package org.apache.camel.k; +import java.util.Map; import java.util.Properties; import org.apache.camel.CamelContext; import org.apache.camel.Ordered; import org.apache.camel.component.properties.PropertiesComponent; +import org.apache.camel.spi.HasCamelContext; -public interface Runtime { +public interface Runtime extends HasCamelContext { /** * Returns the context associated to this runtime. + * + * @deprecated use {@link #getCamelContext()} */ - CamelContext getContext(); + @Deprecated + default CamelContext getContext() { + return getCamelContext(); + } /** * Returns the registry associated to this runtime. @@ -59,7 +66,23 @@ public interface Runtime { } } - interface Registry extends org.apache.camel.k.adapter.Registry { + interface Registry extends org.apache.camel.spi.Registry { + void bind(String name, Object bean); + + @SuppressWarnings("deprecation") + default Object lookup(String name) { + return lookupByName(name); + } + + @SuppressWarnings("deprecation") + default <T> T lookup(String name, Class<T> type) { + return lookupByNameAndType(name, type); + } + + @SuppressWarnings("deprecation") + default <T> Map<String, T> lookupByType(Class<T> type) { + return findByTypeWithName(type); + } } /** @@ -69,10 +92,10 @@ public interface Runtime { * @param registry the runtime registry * @return the runtime */ - static Runtime of( CamelContext camelContext, Registry registry) { + static Runtime of(CamelContext camelContext, Registry registry) { return new Runtime() { @Override - public CamelContext getContext() { + public CamelContext getCamelContext() { return camelContext; } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java index af806c7..3544ecf 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextConfigurer.java @@ -32,14 +32,14 @@ public class ContextConfigurer extends AbstractPhaseListener { // // camel.context.${name} = ${value} // - PropertiesSupport.bindProperties(runtime.getContext(), runtime.getContext(), "camel.context."); + PropertiesSupport.bindProperties(runtime.getCamelContext(), runtime.getCamelContext(), "camel.context."); // // Configure the camel rest definition using properties in the form: // // camel.rest.${name} = ${value} // - RuntimeSupport.configureRest(runtime.getContext()); + RuntimeSupport.configureRest(runtime.getCamelContext()); // // Programmatically configure the camel context. @@ -47,6 +47,6 @@ public class ContextConfigurer extends AbstractPhaseListener { // This is useful to configure services such as the ClusterService, // RouteController, etc // - RuntimeSupport.configureContext(runtime.getContext(), runtime.getRegistry()); + RuntimeSupport.configureContext(runtime.getCamelContext(), runtime.getRegistry()); } } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextLifecycleConfigurer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextLifecycleConfigurer.java index a01b886..21dc41d 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextLifecycleConfigurer.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/ContextLifecycleConfigurer.java @@ -16,6 +16,7 @@ */ package org.apache.camel.k.listener; +import org.apache.camel.CamelContext; import org.apache.camel.Component; import org.apache.camel.k.Runtime; import org.apache.camel.k.support.PropertiesSupport; @@ -28,10 +29,12 @@ public class ContextLifecycleConfigurer extends AbstractPhaseListener { @Override protected void accept(Runtime runtime) { + final CamelContext camelContext = runtime.getCamelContext(); + // // Configure components upon creation // - runtime.getContext().addLifecycleStrategy(new LifecycleStrategySupport() { + camelContext.addLifecycleStrategy(new LifecycleStrategySupport() { @SuppressWarnings("unchecked") @Override public void onComponentAdd(String name, Component component) { @@ -41,7 +44,7 @@ public class ContextLifecycleConfigurer extends AbstractPhaseListener { // // camel.component.${scheme}.${name} = ${value} // - PropertiesSupport.bindProperties(runtime.getContext(), component, "camel.component." + name + "."); + PropertiesSupport.bindProperties(camelContext, component, "camel.component." + name + "."); } }); } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java index 3b2c89c..9c0893b 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesConfigurer.java @@ -21,7 +21,6 @@ import org.apache.camel.k.Constants; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Runtime; import org.apache.camel.k.Source; -import org.apache.camel.k.adapter.Exceptions; import org.apache.camel.k.support.RuntimeSupport; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; @@ -62,10 +61,10 @@ public class RoutesConfigurer extends AbstractPhaseListener { try { source = Source.create(route); - loader = RuntimeSupport.loaderFor(runtime.getContext(), source); + loader = RuntimeSupport.loaderFor(runtime.getCamelContext(), source); builder = loader.load(runtime.getRegistry(), source); } catch (Exception e) { - throw Exceptions.wrapRuntimeCamelException(e); + throw ObjectHelper.wrapRuntimeCamelException(e); } if (builder == null) { @@ -75,9 +74,9 @@ public class RoutesConfigurer extends AbstractPhaseListener { LOGGER.info("Loading routes from: {}", route); try { - runtime.getContext().addRoutes(builder); + runtime.getCamelContext().addRoutes(builder); } catch (Exception e) { - throw Exceptions.wrapRuntimeCamelException(e); + throw ObjectHelper.wrapRuntimeCamelException(e); } } } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesDumper.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesDumper.java index 7f0eec6..d5cbd2a 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesDumper.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/RoutesDumper.java @@ -36,7 +36,7 @@ public class RoutesDumper extends AbstractPhaseListener { @Override protected void accept(Runtime runtime) { - CamelContext context = runtime.getContext(); + CamelContext context = runtime.getCamelContext(); RoutesDefinition routes = new RoutesDefinition(); routes.setRoutes(context.adapt(ModelCamelContext.class).getRouteDefinitions()); diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java index 8c5ee27..01af084 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java @@ -34,7 +34,7 @@ import java.util.function.Predicate; import org.apache.camel.CamelContext; import org.apache.camel.component.properties.PropertiesComponent; import org.apache.camel.k.Constants; -import org.apache.camel.k.adapter.Introspection; +import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.ObjectHelper; import org.apache.commons.io.FilenameUtils; @@ -78,7 +78,7 @@ public final class PropertiesSupport { final Object val = entry.getValue(); try { - if (Introspection.setProperty(target, key, val)) { + if (IntrospectionSupport.setProperty(target, key, val)) { count.incrementAndGet(); } } catch (Exception ex) { diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java index 3352840..540ab8f 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java @@ -26,7 +26,7 @@ import java.util.zip.GZIPInputStream; import org.apache.camel.CamelContext; import org.apache.camel.k.Constants; import org.apache.camel.k.Source; -import org.apache.camel.k.adapter.Resources; +import org.apache.camel.util.ResourceHelper; import org.apache.camel.util.StringHelper; @@ -46,7 +46,7 @@ public class URIResolver { // Using platform encoding on purpose is = new ByteArrayInputStream(content.getBytes()); } else { - is = Resources.resolveResourceAsInputStream(ctx, source.getLocation()); + is = ResourceHelper.resolveResourceAsInputStream(ctx.getClassResolver(), source.getLocation()); } return source.isCompressed() ? new GZIPInputStream(Base64.getDecoder().wrap(is)) : is; diff --git a/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml b/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml index 96a872d..c0dec7f 100644 --- a/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml +++ b/camel-k-runtime-examples/camel-k-runtime-example-health/pom.xml @@ -102,37 +102,4 @@ </plugins> </build> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml b/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml index 629cf87..88d6e3c 100644 --- a/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml +++ b/camel-k-runtime-examples/camel-k-runtime-example-servlet/pom.xml @@ -98,37 +98,4 @@ </plugins> </build> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-groovy/pom.xml b/camel-k-runtime-groovy/pom.xml index d234925..14ee5e4 100644 --- a/camel-k-runtime-groovy/pom.xml +++ b/camel-k-runtime-groovy/pom.xml @@ -119,45 +119,4 @@ </plugins> </build> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-groovy/src/main/groovy/org/apache/camel/k/groovy/dsl/ComponentConfiguration.groovy b/camel-k-runtime-groovy/src/main/groovy/org/apache/camel/k/groovy/dsl/ComponentConfiguration.groovy index bfc080d..3a1c74f 100644 --- a/camel-k-runtime-groovy/src/main/groovy/org/apache/camel/k/groovy/dsl/ComponentConfiguration.groovy +++ b/camel-k-runtime-groovy/src/main/groovy/org/apache/camel/k/groovy/dsl/ComponentConfiguration.groovy @@ -16,7 +16,8 @@ */ package org.apache.camel.k.groovy.dsl -import org.apache.camel.k.adapter.Introspection +import org.apache.camel.util.IntrospectionSupport + class ComponentConfiguration { private final org.apache.camel.Component component @@ -47,19 +48,19 @@ class ComponentConfiguration { } } - if (!Introspection.setProperty(component, name, value, true)) { + if (!IntrospectionSupport.setProperty(component, name, value, true)) { throw new MissingMethodException(name, this.component.class, args as Object[]) } } def propertyMissing(String name, value) { - if (!Introspection.setProperty(component, name, value, true)) { + if (!IntrospectionSupport.setProperty(component, name, value, true)) { throw new MissingMethodException(name, this.component.class, value) } } def propertyMissing(String name) { - def properties = Introspection.getProperties(component, properties, null, false) + def properties = IntrospectionSupport.getProperties(component, properties, null, false) return properties[name] } diff --git a/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/LoaderTest.groovy b/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/LoaderTest.groovy index a31e9ea..80747d3 100644 --- a/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/LoaderTest.groovy +++ b/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/LoaderTest.groovy @@ -19,7 +19,6 @@ package org.apache.camel.k.groovy import org.apache.camel.impl.DefaultCamelContext import org.apache.camel.k.InMemoryRegistry import org.apache.camel.k.Source -import org.apache.camel.k.adapter.Routes import org.apache.camel.k.support.RuntimeSupport import org.apache.camel.model.ToDefinition import spock.lang.Specification @@ -46,7 +45,6 @@ class LoaderTest extends Specification { routes.size() == 1 routes[0].outputs[0] instanceof ToDefinition - - Routes.getInput(routes[0]).endpointUri == 'timer:tick' + routes[0].inputs[0].endpointUri == 'timer:tick' } } diff --git a/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/IntegrationTest.groovy b/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/IntegrationTest.groovy index 5fbde31..4f7c569 100644 --- a/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/IntegrationTest.groovy +++ b/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/IntegrationTest.groovy @@ -69,9 +69,9 @@ class IntegrationTest extends Specification { def runtime = new ApplicationRuntime() runtime.addListener(RoutesConfigurer.forRoutes('classpath:routes-with-component-configuration.groovy')) runtime.addListener(Runtime.Phase.Started, { - def seda = it.context.getComponent('seda', SedaComponent) - def mySeda = it.context.getComponent('mySeda', SedaComponent) - def log = it.context.getComponent('log', LogComponent) + def seda = it.camelContext.getComponent('seda', SedaComponent) + def mySeda = it.camelContext.getComponent('mySeda', SedaComponent) + def log = it.camelContext.getComponent('log', LogComponent) assert seda != null assert mySeda != null diff --git a/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/extension/LogExtensionTest.groovy b/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/extension/LogExtensionTest.groovy index 8dd39e0..fee6475 100644 --- a/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/extension/LogExtensionTest.groovy +++ b/camel-k-runtime-groovy/src/test/groovy/org/apache/camel/k/groovy/dsl/extension/LogExtensionTest.groovy @@ -18,7 +18,7 @@ package org.apache.camel.k.groovy.dsl.extension import org.apache.camel.component.log.LogComponent import org.apache.camel.impl.DefaultCamelContext -import org.apache.camel.k.adapter.Exchanges +import org.apache.camel.impl.DefaultExchange import spock.lang.Specification class LogExtensionTest extends Specification { @@ -33,7 +33,7 @@ class LogExtensionTest extends Specification { "body: $it.in.body" } - def ex = Exchanges.newDefaultExchange(ctx) + def ex = new DefaultExchange(ctx) ex.in.body = 'hello' def result = log.exchangeFormatter.format(ex) diff --git a/camel-k-runtime-health/pom.xml b/camel-k-runtime-health/pom.xml index 0467a9f..ec2b8fe 100644 --- a/camel-k-runtime-health/pom.xml +++ b/camel-k-runtime-health/pom.xml @@ -99,45 +99,4 @@ </dependency> </dependencies> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-jvm/pom.xml b/camel-k-runtime-jvm/pom.xml index 0d28ed9..ddbeae6 100644 --- a/camel-k-runtime-jvm/pom.xml +++ b/camel-k-runtime-jvm/pom.xml @@ -127,45 +127,4 @@ </plugins> </build> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java index 7852665..e0d3cab 100644 --- a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java +++ b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/ApplicationRuntime.java @@ -16,19 +16,21 @@ */ package org.apache.camel.k.jvm; +import java.util.Collections; import java.util.Comparator; import java.util.LinkedHashSet; +import java.util.Map; import java.util.Set; import org.apache.camel.CamelContext; +import org.apache.camel.ProducerTemplate; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.InMemoryRegistry; import org.apache.camel.k.Runtime; -import org.apache.camel.k.adapter.Exceptions; -import org.apache.camel.k.adapter.Main; import org.apache.camel.k.support.PropertiesSupport; import org.apache.camel.main.MainSupport; import org.apache.camel.spi.HasId; +import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.function.ThrowingConsumer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,7 +56,7 @@ public final class ApplicationRuntime implements Runtime { } @Override - public CamelContext getContext() { + public CamelContext getCamelContext() { return context; } @@ -97,7 +99,7 @@ public final class ApplicationRuntime implements Runtime { consumer.accept(runtime); return true; } catch (Exception e) { - throw Exceptions.wrapRuntimeCamelException(e); + throw ObjectHelper.wrapRuntimeCamelException(e); } } @@ -105,6 +107,47 @@ public final class ApplicationRuntime implements Runtime { }); } + private class Main extends org.apache.camel.main.MainSupport { + private CamelContext context; + + public Main(CamelContext context) { + this.context = context; + } + + @Override + protected ProducerTemplate findOrCreateCamelTemplate() { + return context.createProducerTemplate(); + } + + @Override + protected Map<String, CamelContext> getCamelContextMap() { + return Collections.singletonMap(context.getName(), context); + } + + @Override + protected void doStart() throws Exception { + super.doStart(); + postProcessContext(); + + try { + context.start(); + } finally { + if (context.isVetoStarted()) { + completed(); + } + } + } + + @Override + protected void doStop() throws Exception { + super.doStop(); + + if (!getCamelContexts().isEmpty()) { + context.stop(); + } + } + } + private class MainListenerAdapter implements org.apache.camel.main.MainListener { @Override public void beforeStart(MainSupport main) { diff --git a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/loader/XmlLoader.java b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/loader/XmlLoader.java index 37a8dc7..6880e3e 100644 --- a/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/loader/XmlLoader.java +++ b/camel-k-runtime-jvm/src/main/java/org/apache/camel/k/jvm/loader/XmlLoader.java @@ -25,7 +25,6 @@ import org.apache.camel.builder.RouteBuilder; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Runtime; import org.apache.camel.k.Source; -import org.apache.camel.k.adapter.Resources; import org.apache.camel.k.support.URIResolver; import org.apache.camel.model.RoutesDefinition; import org.apache.camel.model.rest.RestsDefinition; @@ -47,7 +46,7 @@ public class XmlLoader implements RoutesLoader { public void configure() throws Exception { try (InputStream is = URIResolver.resolve(getContext(), source)) { try { - RoutesDefinition definition = Resources.loadRoutesDefinition(getContext(), is); + RoutesDefinition definition = getContext().loadRoutesDefinition(is); LOGGER.debug("Loaded {} routes from {}", definition.getRoutes().size(), source); setRouteCollection(definition); @@ -60,7 +59,7 @@ public class XmlLoader implements RoutesLoader { try (InputStream is = URIResolver.resolve(getContext(), source)) { try { - RestsDefinition definition = Resources.loadRestsDefinition(getContext(), is); + RestsDefinition definition = getContext().loadRestsDefinition(is); LOGGER.debug("Loaded {} rests from {}", definition.getRests().size(), source); setRestCollection(definition); diff --git a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java index 0374a2c..1704f51 100644 --- a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java +++ b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/PropertiesTest.java @@ -41,7 +41,7 @@ public class PropertiesTest { runtime.addListener(new ContextConfigurer()); runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); assertThat(context.resolvePropertyPlaceholders("{{root.key}}")).isEqualTo("root.value"); assertThat(context.resolvePropertyPlaceholders("{{001.key}}")).isEqualTo("001.value"); assertThat(context.resolvePropertyPlaceholders("{{002.key}}")).isEqualTo("002.value"); @@ -62,7 +62,7 @@ public class PropertiesTest { runtime.addListener(new ContextConfigurer()); runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); String value = context.resolvePropertyPlaceholders("{{my.property}}"); assertThat(value).isEqualTo("my.value"); @@ -90,7 +90,7 @@ public class PropertiesTest { runtime.addListener(new ContextConfigurer()); runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); assertThat(context.getComponent("seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize1); assertThat(context.getComponent("my-seda", true)).hasFieldOrPropertyWithValue("queueSize", queueSize2); runtime.stop(); @@ -114,7 +114,7 @@ public class PropertiesTest { runtime.addListener(new ContextConfigurer()); runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); assertThat(context.isMessageHistory()).isFalse(); assertThat(context.isLoadTypeConverters()).isFalse(); runtime.stop(); @@ -138,7 +138,7 @@ public class PropertiesTest { runtime.addListener(new ContextConfigurer()); runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); assertThat(context.isMessageHistory()).isFalse(); assertThat(context.isLoadTypeConverters()).isFalse(); runtime.stop(); @@ -161,7 +161,7 @@ public class PropertiesTest { camelContext.setLoadTypeConverters(false); }); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); assertThat(context.isMessageHistory()).isFalse(); assertThat(context.isLoadTypeConverters()).isFalse(); runtime.stop(); diff --git a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersCommonTest.java b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersCommonTest.java index 1bfe017..3a9c61a 100644 --- a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersCommonTest.java +++ b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersCommonTest.java @@ -24,7 +24,6 @@ import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.InMemoryRegistry; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Source; -import org.apache.camel.k.adapter.Routes; import org.apache.camel.k.jvm.loader.JavaClassLoader; import org.apache.camel.k.jvm.loader.JavaScriptLoader; import org.apache.camel.k.jvm.loader.JavaSourceLoader; @@ -54,7 +53,9 @@ public class RoutesLoadersCommonTest { List<RouteDefinition> routes = builder.getRouteCollection().getRoutes(); assertThat(routes).hasSize(1); - assertThat(Routes.getInput(routes.get(0)).getEndpointUri()).isEqualTo("timer:tick"); + assertThat(routes.get(0).getInputs()).hasSize(1); + assertThat(routes.get(0).getOutputs()).hasSize(1); + assertThat(routes.get(0).getInputs().get(0).getEndpointUri()).isEqualTo("timer:tick"); assertThat(routes.get(0).getOutputs().get(0)).isInstanceOf(ToDefinition.class); } diff --git a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersTest.java b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersTest.java index 02150ce..bc44345 100644 --- a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersTest.java +++ b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RoutesLoadersTest.java @@ -25,7 +25,6 @@ import org.apache.camel.k.InMemoryRegistry; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Runtime; import org.apache.camel.k.Source; -import org.apache.camel.k.adapter.Routes; import org.apache.camel.k.jvm.loader.JavaClassLoader; import org.apache.camel.k.jvm.loader.JavaSourceLoader; import org.apache.camel.k.support.RuntimeSupport; @@ -69,7 +68,7 @@ public class RoutesLoadersTest { List<RouteDefinition> routes = builder.getRouteCollection().getRoutes(); assertThat(routes).hasSize(1); - assertThat(Routes.getInput(routes.get(0)).getEndpointUri()).isEqualTo("timer:tick"); + assertThat(routes.get(0).getInputs().get(0).getEndpointUri()).isEqualTo("timer:tick"); assertThat(routes.get(0).getOutputs().get(0)).isInstanceOf(SetBodyDefinition.class); assertThat(routes.get(0).getOutputs().get(1)).isInstanceOf(ProcessDefinition.class); assertThat(routes.get(0).getOutputs().get(2)).isInstanceOf(ToDefinition.class); diff --git a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java index 805fcd5..09c4a0a 100644 --- a/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java +++ b/camel-k-runtime-jvm/src/test/java/org/apache/camel/k/jvm/RuntimeTest.java @@ -16,20 +16,16 @@ */ package org.apache.camel.k.jvm; -import java.io.InputStream; -import java.nio.charset.Charset; import java.util.List; import org.apache.camel.CamelContext; import org.apache.camel.Route; import org.apache.camel.k.Runtime; -import org.apache.camel.k.adapter.Resources; import org.apache.camel.k.listener.ContextConfigurer; import org.apache.camel.k.listener.ContextLifecycleConfigurer; import org.apache.camel.k.listener.RoutesConfigurer; import org.apache.camel.model.ModelCamelContext; import org.apache.camel.util.ObjectHelper; -import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Java6Assertions.assertThat; @@ -45,7 +41,7 @@ public class RuntimeTest { runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(RoutesConfigurer.forRoutes("classpath:r1.js", "classpath:r2.mytype?language=js")); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); List<Route> routes = context.getRoutes(); assertThat(routes).hasSize(2); @@ -70,7 +66,7 @@ public class RuntimeTest { runtime.addListener(new ContextLifecycleConfigurer()); runtime.addListener(RoutesConfigurer.forRoutes("classpath:routes.xml", "classpath:rests.xml")); runtime.addListener(Runtime.Phase.Started, r -> { - CamelContext context = r.getContext(); + CamelContext context = r.getCamelContext(); assertThat(context.adapt(ModelCamelContext.class).getRouteDefinitions()).isNotEmpty(); assertThat(context.adapt(ModelCamelContext.class).getRestDefinitions()).isNotEmpty(); diff --git a/camel-k-runtime-kotlin/pom.xml b/camel-k-runtime-kotlin/pom.xml index 9d40405..f1c4c0a 100644 --- a/camel-k-runtime-kotlin/pom.xml +++ b/camel-k-runtime-kotlin/pom.xml @@ -126,45 +126,4 @@ </plugins> </build> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/LoaderTest.kt b/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/LoaderTest.kt index a3831d4..c31af21 100644 --- a/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/LoaderTest.kt +++ b/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/LoaderTest.kt @@ -19,7 +19,6 @@ package org.apache.camel.k.kotlin import org.apache.camel.impl.DefaultCamelContext import org.apache.camel.k.InMemoryRegistry import org.apache.camel.k.Source -import org.apache.camel.k.adapter.Routes import org.apache.camel.k.support.RuntimeSupport import org.apache.camel.model.ProcessDefinition import org.apache.camel.model.ToDefinition @@ -43,7 +42,7 @@ class LoaderTest { val routes = builder.routeCollection.routes assertThat(routes).hasSize(1) - assertThat(Routes.getInput(routes[0]).endpointUri).isEqualTo("timer:tick") + assertThat(routes[0].inputs[0].endpointUri).isEqualTo("timer:tick") assertThat(routes[0].outputs[0]).isInstanceOf(ProcessDefinition::class.java) assertThat(routes[0].outputs[1]).isInstanceOf(ToDefinition::class.java) } diff --git a/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/dsl/IntegrationTest.kt b/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/dsl/IntegrationTest.kt index 9022b3c..9037cf1 100644 --- a/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/dsl/IntegrationTest.kt +++ b/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/dsl/IntegrationTest.kt @@ -37,12 +37,12 @@ class IntegrationTest { runtime.addListener(Runtime.Phase.Started) { runtime.stop() } runtime.run() - assertThat(runtime.context.restConfiguration.host).isEqualTo("my-host") - assertThat(runtime.context.restConfiguration.port).isEqualTo(9192) - assertThat(runtime.context.getRestConfiguration("undertow", false).host).isEqualTo("my-undertow-host") - assertThat(runtime.context.getRestConfiguration("undertow", false).port).isEqualTo(9193) - assertThat(runtime.context.adapt(ModelCamelContext::class.java).restDefinitions.size).isEqualTo(1) - assertThat(runtime.context.adapt(ModelCamelContext::class.java).restDefinitions[0].path).isEqualTo("/my/path") + assertThat(runtime.camelContext.restConfiguration.host).isEqualTo("my-host") + assertThat(runtime.camelContext.restConfiguration.port).isEqualTo(9192) + assertThat(runtime.camelContext.getRestConfiguration("undertow", false).host).isEqualTo("my-undertow-host") + assertThat(runtime.camelContext.getRestConfiguration("undertow", false).port).isEqualTo(9193) + assertThat(runtime.camelContext.adapt(ModelCamelContext::class.java).restDefinitions.size).isEqualTo(1) + assertThat(runtime.camelContext.adapt(ModelCamelContext::class.java).restDefinitions[0].path).isEqualTo("/my/path") } @Test @@ -52,8 +52,8 @@ class IntegrationTest { runtime.addListener(Runtime.Phase.Started) { runtime.stop() } runtime.run() - assertThat(runtime.context.registry.lookupByName("my-entry")).isEqualTo("myRegistryEntry1") - assertThat(runtime.context.registry.lookupByName("my-proc")).isInstanceOf(Processor::class.java) + assertThat(runtime.camelContext.registry.lookupByName("my-entry")).isEqualTo("myRegistryEntry1") + assertThat(runtime.camelContext.registry.lookupByName("my-proc")).isInstanceOf(Processor::class.java) } @Test @@ -67,9 +67,9 @@ class IntegrationTest { var runtime = ApplicationRuntime() runtime.addListener(RoutesConfigurer.forRoutes("classpath:routes-with-component-configuration.kts")) runtime.addListener(Runtime.Phase.Started) { - val seda = runtime.context.getComponent("seda", SedaComponent::class.java) - val mySeda = runtime.context.getComponent("mySeda", SedaComponent::class.java) - val log = runtime.context.getComponent("log", LogComponent::class.java) + val seda = runtime.camelContext.getComponent("seda", SedaComponent::class.java) + val mySeda = runtime.camelContext.getComponent("mySeda", SedaComponent::class.java) + val log = runtime.camelContext.getComponent("log", LogComponent::class.java) sedaSize.set(seda!!.queueSize) sedaConsumers.set(seda.concurrentConsumers) diff --git a/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/extension/LogExtensionTest.kt b/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/extension/LogExtensionTest.kt index 0d5a281..e8bee11 100644 --- a/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/extension/LogExtensionTest.kt +++ b/camel-k-runtime-kotlin/src/test/kotlin/org/apache/camel/k/kotlin/extension/LogExtensionTest.kt @@ -1,8 +1,24 @@ +/** + * 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.kotlin.extension import org.apache.camel.component.log.LogComponent import org.apache.camel.impl.DefaultCamelContext -import org.apache.camel.k.adapter.Exchanges +import org.apache.camel.impl.DefaultExchange import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -16,7 +32,7 @@ class LogExtensionTest { e -> "body: " + e.getIn().body } - var ex = Exchanges.newDefaultExchange(ctx) + var ex = DefaultExchange(ctx) ex.getIn().body = "hello" assertThat(log.exchangeFormatter.format(ex)).isEqualTo("body: hello") diff --git a/camel-k-runtime-servlet/pom.xml b/camel-k-runtime-servlet/pom.xml index 4f3ad1b..77c2788 100644 --- a/camel-k-runtime-servlet/pom.xml +++ b/camel-k-runtime-servlet/pom.xml @@ -115,45 +115,4 @@ </dependency> </dependencies> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-servlet/src/main/java/org/apache/camel/k/servlet/ServletEndpoint.java b/camel-k-runtime-servlet/src/main/java/org/apache/camel/k/servlet/ServletEndpoint.java index 26a0968..f0d3b51 100644 --- a/camel-k-runtime-servlet/src/main/java/org/apache/camel/k/servlet/ServletEndpoint.java +++ b/camel-k-runtime-servlet/src/main/java/org/apache/camel/k/servlet/ServletEndpoint.java @@ -26,7 +26,7 @@ import io.undertow.servlet.api.DeploymentInfo; import io.undertow.servlet.api.DeploymentManager; import io.undertow.servlet.util.ImmediateInstanceHandle; import org.apache.camel.CamelContext; -import org.apache.camel.k.adapter.ServiceSupport; +import org.apache.camel.support.ServiceSupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java index 627970b..011b80e 100644 --- a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java +++ b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletCustomizerTest.java @@ -20,7 +20,6 @@ import io.undertow.servlet.Servlets; import io.undertow.servlet.api.DeploymentManager; import io.undertow.servlet.core.ManagedServlet; import io.undertow.servlet.core.ManagedServlets; -import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.InMemoryRegistry; import org.apache.camel.k.Runtime; @@ -37,11 +36,11 @@ public class ServletCustomizerTest { Runtime runtime = Runtime.of(new DefaultCamelContext(registry), registry); ServletRegistrationContextCustomizer servletRegistrationCustomizer = new ServletRegistrationContextCustomizer("/webhook/*", "webhook-servlet"); - servletRegistrationCustomizer.apply(runtime.getContext(), runtime.getRegistry()); + servletRegistrationCustomizer.apply(runtime.getCamelContext(), runtime.getRegistry()); ServletContextCustomizer servletCustomizer = new ServletContextCustomizer(); servletCustomizer.setBindPort(AvailablePortFinder.getNextAvailable()); - servletCustomizer.apply(runtime.getContext(), runtime.getRegistry()); + servletCustomizer.apply(runtime.getCamelContext(), runtime.getRegistry()); DeploymentManager manager = Servlets.defaultContainer().getDeploymentByPath("/"); ManagedServlets managedServlets = manager.getDeployment().getServlets(); diff --git a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java index d39d3e4..86d2c02 100644 --- a/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java +++ b/camel-k-runtime-servlet/src/test/java/org/apache/camel/k/servlet/ServletRegistrationCustomizerTest.java @@ -20,7 +20,6 @@ import io.undertow.servlet.Servlets; import io.undertow.servlet.api.DeploymentManager; import io.undertow.servlet.core.ManagedServlet; import io.undertow.servlet.core.ManagedServlets; -import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.InMemoryRegistry; import org.apache.camel.k.Runtime; @@ -37,11 +36,11 @@ public class ServletRegistrationCustomizerTest { Runtime runtime = Runtime.of(new DefaultCamelContext(registry), registry); ServletRegistrationContextCustomizer servletRegistrationCustomizer = new ServletRegistrationContextCustomizer(); - servletRegistrationCustomizer.apply(runtime.getContext(), runtime.getRegistry()); + servletRegistrationCustomizer.apply(runtime.getCamelContext(), runtime.getRegistry()); ServletContextCustomizer servletCustomizer = new ServletContextCustomizer(); servletCustomizer.setBindPort(AvailablePortFinder.getNextAvailable()); - servletCustomizer.apply(runtime.getContext(), runtime.getRegistry()); + servletCustomizer.apply(runtime.getCamelContext(), runtime.getRegistry()); DeploymentManager manager = Servlets.defaultContainer().getDeploymentByPath("/"); ManagedServlets managedServlets = manager.getDeployment().getServlets(); diff --git a/camel-k-runtime-yaml/pom.xml b/camel-k-runtime-yaml/pom.xml index d6958ac..de8ec86 100644 --- a/camel-k-runtime-yaml/pom.xml +++ b/camel-k-runtime-yaml/pom.xml @@ -95,45 +95,4 @@ </dependency> </dependencies> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-k-runtime-yaml/src/test/java/org/apache/camel/k/yaml/RoutesLoaderTest.java b/camel-k-runtime-yaml/src/test/java/org/apache/camel/k/yaml/RoutesLoaderTest.java index 97bb164..45d11bd 100644 --- a/camel-k-runtime-yaml/src/test/java/org/apache/camel/k/yaml/RoutesLoaderTest.java +++ b/camel-k-runtime-yaml/src/test/java/org/apache/camel/k/yaml/RoutesLoaderTest.java @@ -24,7 +24,6 @@ import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.k.InMemoryRegistry; import org.apache.camel.k.RoutesLoader; import org.apache.camel.k.Source; -import org.apache.camel.k.adapter.Routes; import org.apache.camel.k.support.RuntimeSupport; import org.apache.camel.model.RouteDefinition; import org.apache.camel.model.ToDefinition; @@ -49,7 +48,7 @@ public class RoutesLoaderTest { List<RouteDefinition> routes = builder.getRouteCollection().getRoutes(); assertThat(routes).hasSize(1); - assertThat(Routes.getInput(routes.get(0)).getEndpointUri()).isEqualTo("timer:tick"); + assertThat(routes.get(0).getInputs().get(0).getEndpointUri()).isEqualTo("timer:tick"); assertThat(routes.get(0).getOutputs().get(0)).isInstanceOf(ToDefinition.class); } } diff --git a/camel-knative-http/pom.xml b/camel-knative-http/pom.xml index dbd4355..b95c69f 100644 --- a/camel-knative-http/pom.xml +++ b/camel-knative-http/pom.xml @@ -104,50 +104,4 @@ </dependencies> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>spi-annotations</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - </profile> - </profiles> - </project> diff --git a/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java b/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java index 92b61f8..42ec937 100644 --- a/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java +++ b/camel-knative-http/src/main/java/org/apache/camel/component/knative/http/KnativeHttpComponent.java @@ -54,12 +54,10 @@ import org.apache.camel.component.netty4.http.NettyHttpConfiguration; import org.apache.camel.component.netty4.http.NettyHttpConsumer; import org.apache.camel.component.netty4.http.NettyHttpHelper; import org.apache.camel.component.netty4.http.handlers.HttpServerChannelHandler; -import org.apache.camel.k.adapter.Exceptions; -import org.apache.camel.k.adapter.Objects; -import org.apache.camel.k.adapter.Services; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.support.RestConsumerContextPathMatcher; import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.ServiceHelper; import org.apache.camel.util.URISupport; import org.apache.camel.util.UnsafeUriCharactersEncoder; import org.slf4j.Logger; @@ -86,7 +84,7 @@ public class KnativeHttpComponent extends NettyHttpComponent { protected void doStop() throws Exception { super.doStop(); - Services.start(handlers.values()); + ServiceHelper.startService(handlers.values()); handlers.clear(); } @@ -237,7 +235,7 @@ public class KnativeHttpComponent extends NettyHttpComponent { break; } } catch (Exception e) { - throw Exceptions.wrapRuntimeCamelException(e); + throw ObjectHelper.wrapRuntimeCamelException(e); } } } @@ -351,7 +349,7 @@ public class KnativeHttpComponent extends NettyHttpComponent { } // use an iterator as there can be multiple values. (must not use a delimiter) - final Iterator<?> it = Objects.createIterator(value, null, true); + final Iterator<?> it = ObjectHelper.createIterator(value, null, true); while (it.hasNext()) { String headerValue = tc.convertTo(String.class, it.next()); diff --git a/camel-knative/pom.xml b/camel-knative/pom.xml index 4f6f14f..9c1a829 100644 --- a/camel-knative/pom.xml +++ b/camel-knative/pom.xml @@ -134,106 +134,35 @@ <scope>test</scope> </dependency> + <!-- catalog generation --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>apt</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> - <profiles> - <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>spi-annotations</artifactId> - <scope>provided</scope> - </dependency> - <!-- test --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-properties</artifactId> - <scope>test</scope> - </dependency> - <!-- catalog geenration --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>apt</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.camel</groupId> - <artifactId>camel-package-maven-plugin</artifactId> - <version>${camel3.version}</version> - <configuration> - <failFast>false</failFast> - </configuration> - <executions> - <execution> - <id>generate</id> - <goals> - <goal>prepare-components</goal> - </goals> - <phase>process-classes</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencies> - <!-- runtime --> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <scope>provided</scope> - </dependency> - <!-- catalog geenration --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>apt</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.camel</groupId> - <artifactId>camel-package-maven-plugin</artifactId> - <version>${camel2.version}</version> - <configuration> - <failFast>false</failFast> - </configuration> - <executions> - <execution> - <id>generate</id> - <goals> - <goal>prepare-components</goal> - </goals> - <phase>process-classes</phase> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> + <build> + <plugins> + <plugin> + <groupId>org.apache.camel</groupId> + <artifactId>camel-package-maven-plugin</artifactId> + <version>${camel.version}</version> + <configuration> + <failFast>false</failFast> + </configuration> + <executions> + <execution> + <id>generate</id> + <goals> + <goal>prepare-components</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java index 19f9dff..60b7835 100644 --- a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java +++ b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeComponent.java @@ -20,8 +20,8 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; -import org.apache.camel.k.adapter.DefaultComponent; -import org.apache.camel.k.adapter.Introspection; +import org.apache.camel.impl.DefaultComponent; +import org.apache.camel.util.IntrospectionSupport; import org.apache.camel.util.StringHelper; public class KnativeComponent extends DefaultComponent { @@ -101,7 +101,7 @@ public class KnativeComponent extends DefaultComponent { final KnativeConfiguration conf = getKnativeConfiguration(); // set properties from the endpoint uri - Introspection.setProperties(getCamelContext().getTypeConverter(), conf, parameters); + IntrospectionSupport.setProperties(getCamelContext().getTypeConverter(), conf, parameters); return new KnativeEndpoint(uri, this, Knative.Type.valueOf(type), target, conf); } diff --git a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java index 412136b..24640a5 100644 --- a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java +++ b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEndpoint.java @@ -16,6 +16,9 @@ */ package org.apache.camel.component.knative; +import java.util.HashMap; +import java.util.Map; + import org.apache.camel.CamelContext; import org.apache.camel.Consumer; import org.apache.camel.DelegateEndpoint; @@ -24,20 +27,16 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.cloud.ServiceDefinition; import org.apache.camel.component.knative.ce.CloudEventsProcessors; -import org.apache.camel.k.adapter.DefaultEndpoint; -import org.apache.camel.k.adapter.Exceptions; -import org.apache.camel.k.adapter.Services; +import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.processor.Pipeline; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriPath; import org.apache.camel.util.ObjectHelper; +import org.apache.camel.util.ServiceHelper; import org.apache.camel.util.StringHelper; import org.apache.camel.util.URISupport; -import java.util.HashMap; -import java.util.Map; - @UriEndpoint( firstVersion = "3.0.0", @@ -81,12 +80,12 @@ public class KnativeEndpoint extends DefaultEndpoint implements DelegateEndpoint @Override protected void doStart() throws Exception { super.doStart(); - Services.start(endpoint); + ServiceHelper.startServices(endpoint); } @Override protected void doStop() throws Exception { - Services.stop(endpoint); + ServiceHelper.stopService(endpoint); super.doStop(); } @@ -208,7 +207,7 @@ public class KnativeEndpoint extends DefaultEndpoint implements DelegateEndpoint return context.getEndpoint(uri); } catch (Exception e) { - throw Exceptions.wrapRuntimeCamelException(e); + throw ObjectHelper.wrapRuntimeCamelException(e); } } } diff --git a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEnvironment.java b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEnvironment.java index c1dfbc4..5969c9c 100644 --- a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEnvironment.java +++ b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeEnvironment.java @@ -16,14 +16,6 @@ */ package org.apache.camel.component.knative; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import org.apache.camel.CamelContext; -import org.apache.camel.impl.cloud.DefaultServiceDefinition; -import org.apache.camel.k.adapter.Resources; -import org.apache.camel.util.CollectionHelper; -import org.apache.camel.util.StringHelper; - import java.io.InputStream; import java.io.Reader; import java.io.StringReader; @@ -34,9 +26,15 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.UUID; import java.util.stream.Stream; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.apache.camel.CamelContext; +import org.apache.camel.impl.cloud.DefaultServiceDefinition; +import org.apache.camel.util.ResourceHelper; +import org.apache.camel.util.StringHelper; + /* * Assuming it is loaded from a json for now */ @@ -144,7 +142,7 @@ public class KnativeEnvironment { } public static KnativeEnvironment mandatoryLoadFromResource(CamelContext context, String path) throws Exception { - try (InputStream is = Resources.resolveResourceAsInputStream(context, path)) { + try (InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(context, path)) { // // read the knative environment from a file formatted as json, i.e. : diff --git a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java index 3e3aee4..b6d86e5 100644 --- a/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java +++ b/camel-knative/src/main/java/org/apache/camel/component/knative/KnativeProducer.java @@ -24,10 +24,10 @@ import org.apache.camel.AsyncProcessor; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; import org.apache.camel.Processor; -import org.apache.camel.k.adapter.DefaultAsyncProducer; -import org.apache.camel.k.adapter.Processors; -import org.apache.camel.k.adapter.Services; +import org.apache.camel.impl.DefaultAsyncProducer; import org.apache.camel.processor.Pipeline; +import org.apache.camel.util.AsyncProcessorConverterHelper; +import org.apache.camel.util.ServiceHelper; import org.apache.commons.collections4.CollectionUtils; public class KnativeProducer extends DefaultAsyncProducer { @@ -43,7 +43,7 @@ public class KnativeProducer extends DefaultAsyncProducer { Processor pipeline = Pipeline.newInstance(endpoint.getCamelContext(), elements); - this.processor = Processors.convertToAsync(pipeline); + this.processor = AsyncProcessorConverterHelper.convert(pipeline); } @Override @@ -53,27 +53,27 @@ public class KnativeProducer extends DefaultAsyncProducer { @Override protected void doStart() throws Exception { - Services.start(processor); + ServiceHelper.startService(processor); } @Override protected void doStop() throws Exception { - Services.start(processor); + ServiceHelper.stopService(processor); } @Override protected void doSuspend() throws Exception { - Services.suspend(processor); + ServiceHelper.suspendService(processor); } @Override protected void doResume() throws Exception { - Services.resume(processor); + ServiceHelper.resumeService(processor); } @Override protected void doShutdown() throws Exception { - Services.shutdown(processor); + ServiceHelper.stopAndShutdownService(processor); } } diff --git a/pom.xml b/pom.xml index 4e8cb02..dadc851 100644 --- a/pom.xml +++ b/pom.xml @@ -35,9 +35,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> - <camel2.version>2.24.0</camel2.version> - <camel3.version>3.0.0-M2</camel3.version> - <camel.version>${camel2.version}</camel.version> + <camel.version>2.24.0</camel.version> <catalog.version>${camel.version}</catalog.version> <junit.version>4.12</junit.version> <junit-jupiter.version>5.4.2</junit-jupiter.version> @@ -140,8 +138,6 @@ </build> <modules> - <module>camel-k-adapter-camel-2</module> - <module>camel-k-adapter-camel-3</module> <module>camel-k-maven-plugin</module> <module>camel-k-runtime-core</module> <module>camel-k-runtime-jvm</module> @@ -187,14 +183,11 @@ <dependencyManagement> <dependencies> <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-3</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-adapter-camel-2</artifactId> - <version>${project.version}</version> + <groupId>org.apache.camel</groupId> + <artifactId>camel-bom</artifactId> + <version>${camel.version}</version> + <type>pom</type> + <scope>import</scope> </dependency> <dependency> <groupId>org.apache.camel.k</groupId> @@ -246,45 +239,6 @@ <profiles> <profile> - <id>camel3</id> - <activation> - <property> - <name>camel3</name> - </property> - </activation> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-bom</artifactId> - <version>${camel3.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - </profile> - <profile> - <id>camel2</id> - <activation> - <property> - <name>!camel3</name> - </property> - </activation> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-bom</artifactId> - <version>${camel2.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - </profile> - - <profile> <id>deps</id> <activation> <activeByDefault>false</activeByDefault>