You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/05/24 10:24:09 UTC
[camel-k-runtime] branch release-1.17.x updated: fix(#1029): Include miscellaneous components in Camel catalog
This is an automated email from the ASF dual-hosted git repository.
pcongiusti pushed a commit to branch release-1.17.x
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
The following commit(s) were added to refs/heads/release-1.17.x by this push:
new 946d13e7 fix(#1029): Include miscellaneous components in Camel catalog
946d13e7 is described below
commit 946d13e7ae8f712f4cd114de11231a4559362eac
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Tue May 23 11:40:26 2023 +0200
fix(#1029): Include miscellaneous components in Camel catalog
- Includes Camel components categorized as miscellaneous/other when building the Camel catalog via Maven plugin
---
.../k/catalog/model/CatalogOtherDefinition.java | 49 ++++++++++++++++++++++
.../camel/k/catalog/model/CatalogSupport.java | 4 ++
.../it/generate-catalog-with-exclusions/pom.xml | 1 +
.../generate-catalog-with-exclusions/verify.groovy | 4 ++
.../camel/k/tooling/maven/GenerateCatalogMojo.java | 21 ++++++++++
5 files changed, 79 insertions(+)
diff --git a/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CatalogOtherDefinition.java b/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CatalogOtherDefinition.java
new file mode 100644
index 00000000..eb13a277
--- /dev/null
+++ b/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CatalogOtherDefinition.java
@@ -0,0 +1,49 @@
+/*
+ * 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.catalog.model;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public final class CatalogOtherDefinition extends CatalogDefinition {
+ private String label;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ @JsonIgnoreProperties(ignoreUnknown = true)
+ public static final class Container {
+ private final CatalogOtherDefinition delegate;
+
+ @JsonCreator
+ public Container(
+ @JsonProperty("other") CatalogOtherDefinition delegate) {
+ this.delegate = delegate;
+ }
+
+ public CatalogOtherDefinition unwrap() {
+ return delegate;
+ }
+ }
+}
diff --git a/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CatalogSupport.java b/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CatalogSupport.java
index b7714433..f5435074 100644
--- a/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CatalogSupport.java
+++ b/support/camel-k-catalog-model/src/main/java/org/apache/camel/k/catalog/model/CatalogSupport.java
@@ -44,4 +44,8 @@ public final class CatalogSupport {
public static CatalogDataFormatDefinition unmarshallDataFormat(String json) {
return unmarshall(json, CatalogDataFormatDefinition.Container.class).unwrap();
}
+
+ public static CatalogOtherDefinition unmarshallOther(String json) {
+ return unmarshall(json, CatalogOtherDefinition.Container.class).unwrap();
+ }
}
diff --git a/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/pom.xml b/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/pom.xml
index b0cfd144..c48e56bf 100644
--- a/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/pom.xml
+++ b/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/pom.xml
@@ -37,6 +37,7 @@
<dataformats.exclusion.list>avro-jackson</dataformats.exclusion.list>
<languages.exclusion.list>csimple</languages.exclusion.list>
<components.exclusion.list>disruptor,disruptor-vm</components.exclusion.list>
+ <others.exclusion.list>jta,redis</others.exclusion.list>
<capabilities.exclusion.list>master</capabilities.exclusion.list>
</properties>
diff --git a/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/verify.groovy b/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/verify.groovy
index 9cc16de6..53725658 100644
--- a/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/verify.groovy
+++ b/support/camel-k-maven-plugin/src/it/generate-catalog-with-exclusions/verify.groovy
@@ -31,6 +31,10 @@ new File(basedir, "catalog.yaml").withReader {
assert catalog.spec.artifacts['camel-quarkus-csimple'] == null
assert catalog.spec.artifacts['camel-quarkus-disruptor'] == null
+ assert catalog.spec.artifacts['camel-quarkus-debug'] != null
+ assert catalog.spec.artifacts['camel-quarkus-jta'] == null
+ assert catalog.spec.artifacts['camel-quarkus-redis'] == null
+
assert catalog.spec.runtime.capabilities['master'] == null
assert catalog.spec.artifacts['camel-k-master'] == null
}
diff --git a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java
index 498bca32..810d5cf0 100644
--- a/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java
+++ b/support/camel-k-maven-plugin/src/main/java/org/apache/camel/k/tooling/maven/GenerateCatalogMojo.java
@@ -47,6 +47,7 @@ import org.apache.camel.k.catalog.model.CatalogComponentDefinition;
import org.apache.camel.k.catalog.model.CatalogDataFormatDefinition;
import org.apache.camel.k.catalog.model.CatalogDefinition;
import org.apache.camel.k.catalog.model.CatalogLanguageDefinition;
+import org.apache.camel.k.catalog.model.CatalogOtherDefinition;
import org.apache.camel.k.catalog.model.CatalogSupport;
import org.apache.camel.k.catalog.model.k8s.ObjectMeta;
import org.apache.camel.k.catalog.model.k8s.crd.CamelCatalog;
@@ -127,6 +128,9 @@ public class GenerateCatalogMojo extends AbstractMojo {
@Parameter(property = "languages.exclusion.list")
private Set<String> languagesExclusionList;
+ @Parameter(property = "others.exclusion.list")
+ private Set<String> othersExclusionList;
+
@Parameter(property = "dsls.exclusion.list")
private Set<String> dslsExclusionList;
@@ -334,6 +338,7 @@ public class GenerateCatalogMojo extends AbstractMojo {
processComponents(catalog, artifacts);
processLanguages(catalog, artifacts);
processDataFormats(catalog, artifacts);
+ processOthers(catalog, artifacts);
processLoaders(specBuilder);
specBuilder.putAllArtifacts(artifacts);
@@ -489,6 +494,22 @@ public class GenerateCatalogMojo extends AbstractMojo {
}
}
+ private void processOthers(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> artifacts) {
+ final Set<String> elements = new TreeSet<>(catalog.findOtherNames());
+
+ if (othersExclusionList != null) {
+ getLog().info("others.exclusion.list: " + othersExclusionList);
+ elements.removeAll(othersExclusionList);
+ }
+
+ for (String name : elements) {
+ String json = catalog.otherJSonSchema(name);
+ CatalogOtherDefinition definition = CatalogSupport.unmarshallOther(json);
+
+ artifacts.compute(definition.getArtifactId(), (key, artifact) -> artifactBuilder(artifact, definition).build());
+ }
+ }
+
private CamelArtifact.Builder artifactBuilder(CamelArtifact artifact, CatalogDefinition definition) {
CamelArtifact.Builder builder = new CamelArtifact.Builder();