This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit 7c4f4c3219c5c57758ef76283b7fc8ea558def16 Author: Otavio Rodolfo Piske <[email protected]> AuthorDate: Tue May 25 13:12:46 2021 +0200 Remove camel-kamelet-reify (GH issue #667) --- camel-k-kamelet-reify/runtime/pom.xml | 2 +- components/camel-kamelet-reify/pom.xml | 146 ------------------ .../KameletReifyComponentConfigurer.java | 61 -------- .../KameletReifyEndpointConfigurer.java | 67 --------- .../org/apache/camel/component/kamelet-reify | 2 - .../camel/configurer/kamelet-reify-component | 2 - .../apache/camel/configurer/kamelet-reify-endpoint | 2 - .../component/kameletreify/kamelet-reify.json | 36 ----- .../camel/component/kameletreify/KameletReify.java | 45 ------ .../kameletreify/KameletReifyComponent.java | 91 ------------ .../kameletreify/KameletReifyEndpoint.java | 163 --------------------- .../kameletreify/KameletReifyBasicTest.java | 116 --------------- .../src/test/resources/log4j2-test.xml | 42 ------ components/pom.xml | 1 - .../src/it/generate-catalog/verify.groovy | 15 +- .../maven/processors/CatalogProcessor3x.java | 9 -- support/camel-k-runtime-bom/pom.xml | 5 - 17 files changed, 2 insertions(+), 803 deletions(-) diff --git a/camel-k-kamelet-reify/runtime/pom.xml b/camel-k-kamelet-reify/runtime/pom.xml index f58f317..6574573 100644 --- a/camel-k-kamelet-reify/runtime/pom.xml +++ b/camel-k-kamelet-reify/runtime/pom.xml @@ -33,7 +33,7 @@ <artifactId>camel-k-core</artifactId> </dependency> <dependency> - <groupId>org.apache.camel.k</groupId> + <groupId>org.apache.camel</groupId> <artifactId>camel-kamelet-reify</artifactId> </dependency> </dependencies> diff --git a/components/camel-kamelet-reify/pom.xml b/components/camel-kamelet-reify/pom.xml deleted file mode 100644 index 4494ff0..0000000 --- a/components/camel-kamelet-reify/pom.xml +++ /dev/null @@ -1,146 +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-components</artifactId> - <version>1.8.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>camel-kamelet-reify</artifactId> - <description>The Kamelet Reify Component provides support for configuring component options from the URI</description> - - <dependencies> - - <!-- ****************************** --> - <!-- --> - <!-- RUNTIME --> - <!-- --> - <!-- ****************************** --> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-engine</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-catalog</artifactId> - </dependency> - - <!-- ****************************** --> - <!-- --> - <!-- TESTS --> - <!-- --> - <!-- ****************************** --> - - <dependency> - <groupId>org.apache.camel.k</groupId> - <artifactId>camel-k-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-core-languages</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-timer</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-log</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-activemq</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-mock</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-testcontainers-junit5</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.jboss.jandex</groupId> - <artifactId>jandex-maven-plugin</artifactId> - <executions> - <execution> - <id>make-index</id> - <goals> - <goal>jandex</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.camel</groupId> - <artifactId>camel-component-maven-plugin</artifactId> - <executions> - <execution> - <id>generate</id> - <goals> - <goal>generate</goal> - </goals> - <phase>process-classes</phase> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>build-helper-maven-plugin</artifactId> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>add-source</goal> - <goal>add-resource</goal> - </goals> - <configuration> - <sources> - <source>src/generated/java</source> - </sources> - <resources> - <resource> - <directory>src/generated/resources</directory> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> diff --git a/components/camel-kamelet-reify/src/generated/java/org/apache/camel/component/kameletreify/KameletReifyComponentConfigurer.java b/components/camel-kamelet-reify/src/generated/java/org/apache/camel/component/kameletreify/KameletReifyComponentConfigurer.java deleted file mode 100644 index 044d16e..0000000 --- a/components/camel-kamelet-reify/src/generated/java/org/apache/camel/component/kameletreify/KameletReifyComponentConfigurer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* Generated by camel build tools - do NOT edit this file! */ -package org.apache.camel.component.kameletreify; - -import java.util.Map; - -import org.apache.camel.CamelContext; -import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; -import org.apache.camel.spi.PropertyConfigurerGetter; -import org.apache.camel.spi.ConfigurerStrategy; -import org.apache.camel.spi.GeneratedPropertyConfigurer; -import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.support.component.PropertyConfigurerSupport; - -/** - * Generated by camel build tools - do NOT edit this file! - */ -@SuppressWarnings("unchecked") -public class KameletReifyComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { - - @Override - public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - KameletReifyComponent target = (KameletReifyComponent) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "autowiredenabled": - case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true; - case "bridgeerrorhandler": - case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true; - case "lazystartproducer": - case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; - default: return false; - } - } - - @Override - public Class<?> getOptionType(String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "autowiredenabled": - case "autowiredEnabled": return boolean.class; - case "bridgeerrorhandler": - case "bridgeErrorHandler": return boolean.class; - case "lazystartproducer": - case "lazyStartProducer": return boolean.class; - default: return null; - } - } - - @Override - public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - KameletReifyComponent target = (KameletReifyComponent) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "autowiredenabled": - case "autowiredEnabled": return target.isAutowiredEnabled(); - case "bridgeerrorhandler": - case "bridgeErrorHandler": return target.isBridgeErrorHandler(); - case "lazystartproducer": - case "lazyStartProducer": return target.isLazyStartProducer(); - default: return null; - } - } -} - diff --git a/components/camel-kamelet-reify/src/generated/java/org/apache/camel/component/kameletreify/KameletReifyEndpointConfigurer.java b/components/camel-kamelet-reify/src/generated/java/org/apache/camel/component/kameletreify/KameletReifyEndpointConfigurer.java deleted file mode 100644 index c949e1e..0000000 --- a/components/camel-kamelet-reify/src/generated/java/org/apache/camel/component/kameletreify/KameletReifyEndpointConfigurer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* Generated by camel build tools - do NOT edit this file! */ -package org.apache.camel.component.kameletreify; - -import java.util.Map; - -import org.apache.camel.CamelContext; -import org.apache.camel.spi.ExtendedPropertyConfigurerGetter; -import org.apache.camel.spi.PropertyConfigurerGetter; -import org.apache.camel.spi.ConfigurerStrategy; -import org.apache.camel.spi.GeneratedPropertyConfigurer; -import org.apache.camel.util.CaseInsensitiveMap; -import org.apache.camel.support.component.PropertyConfigurerSupport; - -/** - * Generated by camel build tools - do NOT edit this file! - */ -@SuppressWarnings("unchecked") -public class KameletReifyEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter { - - @Override - public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) { - KameletReifyEndpoint target = (KameletReifyEndpoint) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "bridgeerrorhandler": - case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true; - case "exceptionhandler": - case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true; - case "exchangepattern": - case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true; - case "lazystartproducer": - case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true; - default: return false; - } - } - - @Override - public Class<?> getOptionType(String name, boolean ignoreCase) { - switch (ignoreCase ? name.toLowerCase() : name) { - case "bridgeerrorhandler": - case "bridgeErrorHandler": return boolean.class; - case "exceptionhandler": - case "exceptionHandler": return org.apache.camel.spi.ExceptionHandler.class; - case "exchangepattern": - case "exchangePattern": return org.apache.camel.ExchangePattern.class; - case "lazystartproducer": - case "lazyStartProducer": return boolean.class; - default: return null; - } - } - - @Override - public Object getOptionValue(Object obj, String name, boolean ignoreCase) { - KameletReifyEndpoint target = (KameletReifyEndpoint) obj; - switch (ignoreCase ? name.toLowerCase() : name) { - case "bridgeerrorhandler": - case "bridgeErrorHandler": return target.isBridgeErrorHandler(); - case "exceptionhandler": - case "exceptionHandler": return target.getExceptionHandler(); - case "exchangepattern": - case "exchangePattern": return target.getExchangePattern(); - case "lazystartproducer": - case "lazyStartProducer": return target.isLazyStartProducer(); - default: return null; - } - } -} - diff --git a/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/component/kamelet-reify b/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/component/kamelet-reify deleted file mode 100644 index d3b0633..0000000 --- a/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/component/kamelet-reify +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.kameletreify.KameletReifyComponent diff --git a/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/configurer/kamelet-reify-component b/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/configurer/kamelet-reify-component deleted file mode 100644 index 73dc8e4..0000000 --- a/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/configurer/kamelet-reify-component +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.kameletreify.KameletReifyComponentConfigurer diff --git a/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/configurer/kamelet-reify-endpoint b/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/configurer/kamelet-reify-endpoint deleted file mode 100644 index babbb50..0000000 --- a/components/camel-kamelet-reify/src/generated/resources/META-INF/services/org/apache/camel/configurer/kamelet-reify-endpoint +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.kameletreify.KameletReifyEndpointConfigurer diff --git a/components/camel-kamelet-reify/src/generated/resources/org/apache/camel/component/kameletreify/kamelet-reify.json b/components/camel-kamelet-reify/src/generated/resources/org/apache/camel/component/kameletreify/kamelet-reify.json deleted file mode 100644 index f03ba9f..0000000 --- a/components/camel-kamelet-reify/src/generated/resources/org/apache/camel/component/kameletreify/kamelet-reify.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "component": { - "kind": "component", - "name": "kamelet-reify", - "title": "KameletReify", - "description": "The Kamelet Reify Component provides support for configuring component options from the URI", - "deprecated": false, - "firstVersion": "3.6.0", - "label": "core", - "javaType": "org.apache.camel.component.kameletreify.KameletReifyComponent", - "supportLevel": "Preview", - "groupId": "org.apache.camel.k", - "artifactId": "camel-kamelet-reify", - "version": "1.7.0-SNAPSHOT", - "scheme": "kamelet-reify", - "extendsScheme": "", - "syntax": "kamelet-reify:delegateUri", - "async": false, - "api": false, - "consumerOnly": false, - "producerOnly": false, - "lenientProperties": true - }, - "componentProperties": { - "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a me [...] - "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during star [...] - "autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which t [...] - }, - "properties": { - "delegateUri": { "kind": "path", "displayName": "Delegate Uri", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The delegated uri" }, - "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a m [...] - "exceptionHandler": { "kind": "parameter", "displayName": "Exception Handler", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", "deprecated": false, "autowired": false, "secret": false, "description": "To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the con [...] - "exchangePattern": { "kind": "parameter", "displayName": "Exchange Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "object", "javaType": "org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", "InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false, "description": "Sets the exchange pattern when the consumer creates an exchange." }, - "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during sta [...] - } -} diff --git a/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReify.java b/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReify.java deleted file mode 100644 index 051075a..0000000 --- a/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReify.java +++ /dev/null @@ -1,45 +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.component.kameletreify; - -import org.apache.camel.CamelContext; -import org.apache.camel.Component; -import org.apache.camel.ExtendedCamelContext; - -public final class KameletReify { - public static final String SCHEME = "kamelet-reify"; - - private KameletReify() { - } - - public static Component newComponentInstance(CamelContext context, String scheme) throws Exception { - // first check if there's an instance of the given component in the registry - Component answer = context.getRegistry().lookupByNameAndType(scheme, Component.class); - if (answer != null) { - // and then create a new instance using it's class - return context.getInjector().newInstance(answer.getClass()); - } - - // if not, fallback to the factory finder way - answer = context.adapt(ExtendedCamelContext.class).getComponentResolver().resolveComponent(scheme, context); - if (answer == null) { - throw new IllegalStateException("Unable to create an instance of the component with scheme: " + scheme); - } - - return answer; - } -} diff --git a/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReifyComponent.java b/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReifyComponent.java deleted file mode 100644 index e29f607..0000000 --- a/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReifyComponent.java +++ /dev/null @@ -1,91 +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.component.kameletreify; - -import java.net.URI; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.camel.CamelContext; -import org.apache.camel.Endpoint; -import org.apache.camel.spi.annotations.Component; -import org.apache.camel.support.DefaultComponent; -import org.apache.camel.support.PropertyBindingSupport; -import org.apache.camel.util.StringHelper; -import org.apache.camel.util.URISupport; -import org.apache.camel.util.UnsafeUriCharactersEncoder; - -@Component(KameletReify.SCHEME) -public class KameletReifyComponent extends DefaultComponent { - private static final AtomicInteger COUNTER = new AtomicInteger(); - - public KameletReifyComponent() { - this(null); - } - - public KameletReifyComponent(CamelContext context) { - super(context); - } - - @Override - protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - final String query; - - int idx = uri.indexOf('?'); - if (idx > -1) { - query = uri.substring(idx + 1); - } else { - final String encoded = UnsafeUriCharactersEncoder.encode(uri); - final URI u = new URI(encoded); - - query = u.getRawQuery(); - } - - final Map<String, Object> queryParams = URISupport.parseQuery(query, true); - final String scheme = StringHelper.before(remaining, ":"); - final String path = StringHelper.after(remaining, ":"); - final String newScheme = scheme + "-" + COUNTER.getAndIncrement(); - final org.apache.camel.Component newComponent = KameletReify.newComponentInstance(getCamelContext(), scheme); - - for (Map.Entry<String, Object> entry: parameters.entrySet()) { - String key = entry.getKey(); - Object val = entry.getValue(); - - boolean bound = PropertyBindingSupport.build() - .withConfigurer(newComponent.getComponentPropertyConfigurer()) - .withReference(true) - .withRemoveParameters(true) - .bind(getCamelContext(), newComponent, key, val); - - if (bound) { - queryParams.remove(key); - } - } - - getCamelContext().addComponent(newScheme, newComponent); - - return new KameletReifyEndpoint( - uri, - this, - URISupport.appendParametersToURI(newScheme + ":" + path, queryParams)); - } - - @Override - public boolean useRawUri() { - return true; - } -} diff --git a/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReifyEndpoint.java b/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReifyEndpoint.java deleted file mode 100644 index 10c585b..0000000 --- a/components/camel-kamelet-reify/src/main/java/org/apache/camel/component/kameletreify/KameletReifyEndpoint.java +++ /dev/null @@ -1,163 +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.component.kameletreify; - -import org.apache.camel.AsyncCallback; -import org.apache.camel.AsyncProducer; -import org.apache.camel.Category; -import org.apache.camel.Consumer; -import org.apache.camel.DelegateEndpoint; -import org.apache.camel.Endpoint; -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.Producer; -import org.apache.camel.spi.Metadata; -import org.apache.camel.spi.UriEndpoint; -import org.apache.camel.spi.UriPath; -import org.apache.camel.support.DefaultAsyncProducer; -import org.apache.camel.support.DefaultConsumer; -import org.apache.camel.support.DefaultEndpoint; -import org.apache.camel.support.service.ServiceHelper; - -@UriEndpoint( - firstVersion = "3.6.0", - scheme = "kamelet-reify", - syntax = "kamelet-reify:delegateUri", - title = "KameletReify", - lenientProperties = true, - category = Category.CORE) -public class KameletReifyEndpoint extends DefaultEndpoint implements DelegateEndpoint { - @Metadata(required = true) - @UriPath(description = "The delegated uri") - private final String delegateUri; - - private final Endpoint delegateEndpoint; - - public KameletReifyEndpoint(String uri, KameletReifyComponent component, String delegateUri) { - super(uri, component); - - this.delegateUri = delegateUri; - this.delegateEndpoint = component.getCamelContext().getEndpoint(delegateUri); - } - - public String getDelegateUri() { - return delegateUri; - } - - @Override - public Endpoint getEndpoint() { - return delegateEndpoint; - } - - @Override - public KameletReifyComponent getComponent() { - return (KameletReifyComponent) super.getComponent(); - } - - @Override - public boolean isLenientProperties() { - return true; - } - - @Override - public boolean isSingleton() { - return false; - } - - @Override - public Producer createProducer() throws Exception { - return new KameletProducer(); - } - - @Override - public Consumer createConsumer(Processor processor) throws Exception { - Consumer answer = new KemeletConsumer(processor); - configureConsumer(answer); - return answer; - } - - @Override - protected void doStart() throws Exception { - ServiceHelper.startService(delegateEndpoint); - super.doStart(); - } - - @Override - protected void doStop() throws Exception { - ServiceHelper.stopService(delegateEndpoint); - super.doStart(); - } - - // ********************************* - // - // Helpers - // - // ********************************* - - private class KemeletConsumer extends DefaultConsumer { - private volatile Consumer consumer; - - public KemeletConsumer(Processor processor) { - super(KameletReifyEndpoint.this, processor); - } - - @Override - protected void doStart() throws Exception { - consumer = delegateEndpoint.createConsumer(getProcessor()); - - ServiceHelper.startService(consumer); - super.doStart(); - } - - @Override - protected void doStop() throws Exception { - ServiceHelper.stopService(consumer); - super.doStop(); - } - } - - private class KameletProducer extends DefaultAsyncProducer { - private volatile AsyncProducer producer; - - public KameletProducer() { - super(KameletReifyEndpoint.this); - } - - @Override - public boolean process(Exchange exchange, AsyncCallback callback) { - if (producer != null) { - return producer.process(exchange, callback); - } else { - callback.done(true); - return true; - } - } - - @Override - protected void doStart() throws Exception { - producer = delegateEndpoint.createAsyncProducer(); - ServiceHelper.startService(producer); - super.doStart(); - } - - @Override - protected void doStop() throws Exception { - ServiceHelper.stopService(producer); - super.doStop(); - } - } -} \ No newline at end of file diff --git a/components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyBasicTest.java b/components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyBasicTest.java deleted file mode 100644 index 53c099a..0000000 --- a/components/camel-kamelet-reify/src/test/java/org/apache/camel/component/kameletreify/KameletReifyBasicTest.java +++ /dev/null @@ -1,116 +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.component.kameletreify; - -import java.util.Properties; - -import javax.jms.ConnectionFactory; - -import org.apache.activemq.ActiveMQConnectionFactory; -import org.apache.camel.BindToRegistry; -import org.apache.camel.PropertyInject; -import org.apache.camel.RoutesBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.testcontainers.junit5.ContainerAwareTestSupport; -import org.apache.http.annotation.Obsolete; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.output.Slf4jLogConsumer; -import org.testcontainers.containers.wait.strategy.Wait; - -import static org.assertj.core.api.Assertions.assertThat; - -public class KameletReifyBasicTest extends ContainerAwareTestSupport { - private static final Logger LOGGER = LoggerFactory.getLogger(KameletReifyBasicTest.class); - private static final String CONTAINER_NAME = "activemq"; - private static final String CONTAINER_IMAGE = "rmohr/activemq:5.15.9-alpine"; - private static final int TCP_PORT = 61616; - private static final String QUEUE_NAME = "my-queue"; - - @Test - public void componentsAreWrapped() throws Exception { - assertThat(context().getComponentNames()) - .filteredOn(n -> n.startsWith("activemq-")) - .hasSize(2); - - assertThat(context().getEndpoints()) - .filteredOn(e -> e.getEndpointUri().startsWith("activemq-")) - .hasSize(2); - assertThat(context().getEndpoints()) - .filteredOn(e -> e.getEndpointUri().startsWith("activemq:")) - .isEmpty(); - - getMockEndpoint("mock:result") - .expectedBodiesReceived("test"); - - fluentTemplate() - .to("direct:start") - .withBody("test") - .send(); - - getMockEndpoint("mock:result") - .assertIsSatisfied(); - } - - // ********************************************** - // - // test set-up - // - // ********************************************** - - @Obsolete - protected RoutesBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - from("direct:start") - .to("kamelet-reify:activemq:{{amqQueueName}}?brokerURL={{amqBrokerUrl}}"); - from("kamelet-reify:activemq:{{amqQueueName}}?connectionFactory=#amqcf") - .to("mock:result"); - } - }; - } - - @Override - protected GenericContainer<?> createContainer() { - return new GenericContainer<>(CONTAINER_IMAGE) - .withNetworkAliases(CONTAINER_NAME) - .withExposedPorts(TCP_PORT) - .withLogConsumer(new Slf4jLogConsumer(LOGGER)) - .waitingFor(Wait.forListeningPort()); - } - - @Override - protected Properties useOverridePropertiesWithPropertiesComponent() { - final String host = getContainerHost(CONTAINER_NAME); - final int port = getContainerPort(CONTAINER_NAME, TCP_PORT); - final String brokerUrl = String.format("tcp://%s:%d", host, port); - - Properties properties = new Properties(); - properties.setProperty("amqBrokerUrl", brokerUrl); - properties.setProperty("amqQueueName", QUEUE_NAME); - - return properties; - } - - @BindToRegistry("amqcf") - public ConnectionFactory activeMQConnectionFactory(@PropertyInject("amqBrokerUrl") String brokerUrl) { - return new ActiveMQConnectionFactory(brokerUrl); - } -} diff --git a/components/camel-kamelet-reify/src/test/resources/log4j2-test.xml b/components/camel-kamelet-reify/src/test/resources/log4j2-test.xml deleted file mode 100644 index 9721446..0000000 --- a/components/camel-kamelet-reify/src/test/resources/log4j2-test.xml +++ /dev/null @@ -1,42 +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. - ---> -<Configuration status="INFO"> - <Appenders> - <Console name="STDOUT" target="SYSTEM_OUT"> - <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level|%t|%c{1} - %msg%n"/> - </Console> - <File name="FILE" filename="target/camel-kamelet-reify-test.log"> - <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> - </File> - <Null name="NONE"/> - </Appenders> - - <Loggers> - <Logger name="org.apache.camel.component.kameletreify" level="TRACE"/> - - <Root level="INFO"> - <!-- - <AppenderRef ref="STDOUT"/> - --> - <AppenderRef ref="FILE"/> - </Root> - </Loggers> - -</Configuration> \ No newline at end of file diff --git a/components/pom.xml b/components/pom.xml index 7990e89..09333fa 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -31,6 +31,5 @@ <modules> <module>camel-cloudevents</module> <module>camel-knative</module> - <module>camel-kamelet-reify</module> </modules> </project> diff --git a/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy b/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy index 816fd38..aae3b13 100644 --- a/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy +++ b/support/camel-k-maven-plugin/src/it/generate-catalog/verify.groovy @@ -86,17 +86,4 @@ new File(basedir, "catalog.yaml").withReader { assert producer.dependencies[0].artifactId == 'camel-k-knative-producer' } } - - catalog.spec.artifacts['camel-k-kamelet-reify'].with { - assert dependencies == null - assert requiredCapabilities == null - - assert schemes.size() == 1 - - schemes[0].with { - assert id == 'kamelet-reify' - assert passive == false - assert http == false - } - } -} \ No newline at end of file +} diff --git a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java index 181f110..4aae669 100644 --- a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java +++ b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/processors/CatalogProcessor3x.java @@ -146,15 +146,6 @@ public class CatalogProcessor3x implements CatalogProcessor { .build()) .build() ); - specBuilder.putArtifact( - new CamelArtifact.Builder() - .groupId("org.apache.camel.k") - .artifactId("camel-k-kamelet-reify") - .addScheme(new CamelScheme.Builder() - .id("kamelet-reify") - .build()) - .build() - ); } private static void processLoaders(CamelCatalogSpec.Builder specBuilder) { diff --git a/support/camel-k-runtime-bom/pom.xml b/support/camel-k-runtime-bom/pom.xml index f868f11..1dfbf65 100644 --- a/support/camel-k-runtime-bom/pom.xml +++ b/support/camel-k-runtime-bom/pom.xml @@ -147,11 +147,6 @@ </dependency> <dependency> <groupId>org.apache.camel.k</groupId> - <artifactId>camel-kamelet-reify</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.camel.k</groupId> <artifactId>camel-k-webhook-impl</artifactId> <version>${project.version}</version> </dependency>
