You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/01/14 13:08:23 UTC

[camel] branch master updated: CAMEL-13051: The component json metafiles need to be enriched later with more details after the compilation process.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 0900a82  CAMEL-13051: The component json metafiles need to be enriched later with more details after the compilation process.
0900a82 is described below

commit 0900a82b4a6fa6a674a73c03ddef727039d8d2b3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jan 14 13:51:53 2019 +0100

    CAMEL-13051: The component json metafiles need to be enriched later with more details after the compilation process.
---
 .../tools/apt/EndpointAnnotationProcessor.java     | 62 +++++-----------------
 .../java/org/apache/camel/spi/UriEndpoint.java     |  1 +
 2 files changed, 15 insertions(+), 48 deletions(-)

diff --git a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
index cca1496..7bb2c9c 100644
--- a/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
+++ b/tooling/apt/src/main/java/org/apache/camel/tools/apt/EndpointAnnotationProcessor.java
@@ -352,55 +352,21 @@ public class EndpointAnnotationProcessor extends AbstractCamelAnnotationProcesso
             model.setFirstVersion(firstVersion);
         }
 
-        String data = loadResource(processingEnv, "META-INF/services/org/apache/camel/component", scheme);
-        if (data != null) {
-            Map<String, String> map = parseAsMap(data);
-            model.setJavaType(map.get("class"));
-        }
-
-        data = loadResource(processingEnv, "META-INF/services/org/apache/camel", "component.properties");
-        if (data != null) {
-            Map<String, String> map = parseAsMap(data);
-            // now we have a lot more data, so we need to load it as key/value
-            // need to sanitize the description first
-            String doc = map.get("projectDescription");
-            if (doc != null) {
-                model.setDescription(sanitizeDescription(doc, true));
-            } else {
-                model.setDescription("");
-            }
-
-            // we can mark a component as deprecated by using the annotation or in the pom.xml
-            boolean deprecated = endpointClassElement.getAnnotation(Deprecated.class) != null;
-            if (!deprecated) {
-                String name = map.get("projectName");
-                // we may have marked a component as deprecated in the project name
-                deprecated = name != null && name.contains("(deprecated)");
-            }
-            model.setDeprecated(deprecated);
-
-            String deprecationNote = null;
-            if (endpointClassElement.getAnnotation(Metadata.class) != null) {
-                deprecationNote = endpointClassElement.getAnnotation(Metadata.class).deprecationNote();
-            }
-            model.setDeprecationNote(deprecationNote);
-
-            if (map.containsKey("groupId")) {
-                model.setGroupId(map.get("groupId"));
-            } else {
-                model.setGroupId("");
-            }
-            if (map.containsKey("artifactId")) {
-                model.setArtifactId(map.get("artifactId"));
-            } else {
-                model.setArtifactId("");
-            }
-            if (map.containsKey("version")) {
-                model.setVersionId(map.get("version"));
-            } else {
-                model.setVersionId("");
-            }
+        // we can mark a component as deprecated by using the annotation
+        boolean deprecated = endpointClassElement.getAnnotation(Deprecated.class) != null;
+        model.setDeprecated(deprecated);
+        String deprecationNote = null;
+        if (endpointClassElement.getAnnotation(Metadata.class) != null) {
+            deprecationNote = endpointClassElement.getAnnotation(Metadata.class).deprecationNote();
         }
+        model.setDeprecationNote(deprecationNote);
+
+        // these information is not available at compile time and we enrich these later during the camel-package-maven-plugin
+        model.setJavaType("REPLACE-ME");
+        model.setDescription("REPLACE-ME");
+        model.setGroupId("REPLACE-ME");
+        model.setArtifactId("REPLACE-ME");
+        model.setVersionId("REPLACE-ME");
 
         // favor to use endpoint class javadoc as description
         Elements elementUtils = processingEnv.getElementUtils();
diff --git a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java
index 7722ed6..2877d32 100644
--- a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java
+++ b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/UriEndpoint.java
@@ -91,6 +91,7 @@ public @interface UriEndpoint {
     /**
      * Represents the consumer class which is injected and created by consumers
      */
+    @Deprecated
     Class<?> consumerClass() default Object.class;
 
     /**