You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2020/03/30 08:13:33 UTC

[camel-karaf] branch master updated: CAMEL-14803: documentation for camel-karaf modules

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

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


The following commit(s) were added to refs/heads/master by this push:
     new c9180fe  CAMEL-14803: documentation for camel-karaf modules
c9180fe is described below

commit c9180fe061160e61ec62353f6ff4dceb1faa19b5
Author: Zoran Regvart <zr...@apache.org>
AuthorDate: Mon Mar 30 01:48:46 2020 +0200

    CAMEL-14803: documentation for camel-karaf modules
    
    This makes sure that the documentation for modules within camel-karaf is
    copied over to the Antora documentation directory and that the links
    from components.adoc point to the documents there.
---
 .../camel-blueprint/src/main/docs/blueprint.adoc   |  1 +
 .../src/main/docs/eventadmin-component.adoc        |  1 +
 components/camel-kura/src/main/docs/kura.adoc      |  1 +
 .../src/main/docs/osgi-activator.adoc              |  1 +
 .../src/main/docs/paxlogging-component.adoc        |  1 +
 .../modules/ROOT/pages}/blueprint.adoc             |  1 +
 docs/modules/ROOT/pages/components.adoc            | 10 ++++----
 .../modules/ROOT/pages}/eventadmin-component.adoc  |  1 +
 .../docs => docs/modules/ROOT/pages}/kura.adoc     |  1 +
 .../modules/ROOT/pages}/osgi-activator.adoc        |  1 +
 .../modules/ROOT/pages}/paxlogging-component.adoc  |  1 +
 .../apache/camel/karaf/maven/ExtMvelHelper.java    | 18 ++++++++++---
 .../karaf/maven/UpdateDocComponentsListMojo.java   | 30 ++++++++++++++++++++++
 13 files changed, 59 insertions(+), 9 deletions(-)

diff --git a/components/camel-blueprint/src/main/docs/blueprint.adoc b/components/camel-blueprint/src/main/docs/blueprint.adoc
index c17b0e0..953031b 100644
--- a/components/camel-blueprint/src/main/docs/blueprint.adoc
+++ b/components/camel-blueprint/src/main/docs/blueprint.adoc
@@ -1,4 +1,5 @@
 = Using OSGi blueprint with Camel
+:page-source: components/camel-blueprint/src/main/docs/blueprint.adoc
 
 A custom XML namespace for Blueprint has been created to let you leverage the nice XML dialect.
 Given Blueprint custom namespaces are not standardized yet, this namespace can only be used on the Apache Aries Blueprint
diff --git a/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc b/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
index ed5dc69..1c08cac 100644
--- a/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
+++ b/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
@@ -1,5 +1,6 @@
 [[eventadmin-component]]
 = OSGi EventAdmin Component
+:page-source: components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
 
 *Since Camel 2.6*
 
diff --git a/components/camel-kura/src/main/docs/kura.adoc b/components/camel-kura/src/main/docs/kura.adoc
index 43945d5..6fb6246 100644
--- a/components/camel-kura/src/main/docs/kura.adoc
+++ b/components/camel-kura/src/main/docs/kura.adoc
@@ -1,5 +1,6 @@
 [[Kura-EclipseKuracomponent]]
 = Eclipse Kura component
+:page-source: components/camel-kura/src/main/docs/kura.adoc
 
 *Since Camel 2.15*
 
diff --git a/components/camel-osgi-activator/src/main/docs/osgi-activator.adoc b/components/camel-osgi-activator/src/main/docs/osgi-activator.adoc
index 407e4b6..e4de6bb 100644
--- a/components/camel-osgi-activator/src/main/docs/osgi-activator.adoc
+++ b/components/camel-osgi-activator/src/main/docs/osgi-activator.adoc
@@ -1,5 +1,6 @@
 [[OsgiActivator]]
 = OSGi Camel Routes Activator
+:page-source: components/camel-osgi-activator/src/main/docs/osgi-activator.adoc
 
 *Since Camel 3.1*
 
diff --git a/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc b/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
index f6b46e2..f469cd9 100644
--- a/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
+++ b/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
@@ -1,5 +1,6 @@
 [[paxlogging-component]]
 = OSGi PAX Logging Component
+:page-source: components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
 
 *Since Camel 2.6*
 
diff --git a/components/camel-blueprint/src/main/docs/blueprint.adoc b/docs/modules/ROOT/pages/blueprint.adoc
similarity index 96%
copy from components/camel-blueprint/src/main/docs/blueprint.adoc
copy to docs/modules/ROOT/pages/blueprint.adoc
index c17b0e0..953031b 100644
--- a/components/camel-blueprint/src/main/docs/blueprint.adoc
+++ b/docs/modules/ROOT/pages/blueprint.adoc
@@ -1,4 +1,5 @@
 = Using OSGi blueprint with Camel
+:page-source: components/camel-blueprint/src/main/docs/blueprint.adoc
 
 A custom XML namespace for Blueprint has been created to let you leverage the nice XML dialect.
 Given Blueprint custom namespaces are not standardized yet, this namespace can only be used on the Apache Aries Blueprint
diff --git a/docs/modules/ROOT/pages/components.adoc b/docs/modules/ROOT/pages/components.adoc
index 41b29d2..7aeda2f 100644
--- a/docs/modules/ROOT/pages/components.adoc
+++ b/docs/modules/ROOT/pages/components.adoc
@@ -428,10 +428,10 @@ Number of Camel components: 210 in 210 JAR artifacts (1 deprecated)
 | xref:components::optaplanner-component.adoc[OptaPlanner] (camel-optaplanner) +
 `optaplanner:configFile` | 2.13 | Solves the planning problem contained in a message with OptaPlanner.
 
-| xref:components::eventadmin-component.adoc[OSGi EventAdmin] (camel-eventadmin) +
+| xref:camel-karaf::eventadmin-component.adoc[OSGi EventAdmin] (camel-eventadmin) +
 `eventadmin:topic` | 2.6 | The eventadmin component can be used in an OSGi environment to receive OSGi EventAdmin events and process them.
 
-| xref:components::paxlogging-component.adoc[OSGi PAX Logging] (camel-paxlogging) +
+| xref:camel-karaf::paxlogging-component.adoc[OSGi PAX Logging] (camel-paxlogging) +
 `paxlogging:appender` | 2.6 | The paxlogging component can be used in an OSGi environment to receive PaxLogging events and process them.
 
 | xref:components::paho-component.adoc[Paho] (camel-paho) +
@@ -865,7 +865,7 @@ Number of miscellaneous extensions: 16 in 16 JAR artifacts (0 deprecated)
 | xref:components::aws-xray.adoc[AWS XRay] +
 (camel-aws-xray) | 2.21 | Distributed tracing using AWS XRay
 
-| xref:components::blueprint.adoc[Blueprint] +
+| xref:camel-karaf::blueprint.adoc[Blueprint] +
 (camel-blueprint) | 2.4 | Using Camel with OSGi Blueprint
 
 | xref:components::hystrix.adoc[Hystrix] +
@@ -874,7 +874,7 @@ Number of miscellaneous extensions: 16 in 16 JAR artifacts (0 deprecated)
 | xref:components::jasypt.adoc[Jasypt] +
 (camel-jasypt) | 2.5 | Security using Jasypt
 
-| xref:components::kura.adoc[Kura] +
+| xref:camel-karaf::kura.adoc[Kura] +
 (camel-kura) | 2.15 | Using Camel with Eclipse Kura (OSGi)
 
 | xref:components::leveldb.adoc[LevelDB] +
@@ -889,7 +889,7 @@ Number of miscellaneous extensions: 16 in 16 JAR artifacts (0 deprecated)
 | xref:components::opentracing.adoc[OpenTracing] +
 (camel-opentracing) | 2.19 | Distributed tracing using OpenTracing
 
-| xref:components::osgi-activator.adoc[Osgi Activator] +
+| xref:camel-karaf::osgi-activator.adoc[Osgi Activator] +
 (camel-osgi-activator) | 3.1 | Camel OSGi Activator for running Camel routes from other bundles
 
 | xref:components::reactor.adoc[Reactor] +
diff --git a/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc b/docs/modules/ROOT/pages/eventadmin-component.adoc
similarity index 98%
copy from components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
copy to docs/modules/ROOT/pages/eventadmin-component.adoc
index ed5dc69..1c08cac 100644
--- a/components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
+++ b/docs/modules/ROOT/pages/eventadmin-component.adoc
@@ -1,5 +1,6 @@
 [[eventadmin-component]]
 = OSGi EventAdmin Component
+:page-source: components/camel-eventadmin/src/main/docs/eventadmin-component.adoc
 
 *Since Camel 2.6*
 
diff --git a/components/camel-kura/src/main/docs/kura.adoc b/docs/modules/ROOT/pages/kura.adoc
similarity index 99%
copy from components/camel-kura/src/main/docs/kura.adoc
copy to docs/modules/ROOT/pages/kura.adoc
index 43945d5..6fb6246 100644
--- a/components/camel-kura/src/main/docs/kura.adoc
+++ b/docs/modules/ROOT/pages/kura.adoc
@@ -1,5 +1,6 @@
 [[Kura-EclipseKuracomponent]]
 = Eclipse Kura component
+:page-source: components/camel-kura/src/main/docs/kura.adoc
 
 *Since Camel 2.15*
 
diff --git a/components/camel-osgi-activator/src/main/docs/osgi-activator.adoc b/docs/modules/ROOT/pages/osgi-activator.adoc
similarity index 96%
copy from components/camel-osgi-activator/src/main/docs/osgi-activator.adoc
copy to docs/modules/ROOT/pages/osgi-activator.adoc
index 407e4b6..e4de6bb 100644
--- a/components/camel-osgi-activator/src/main/docs/osgi-activator.adoc
+++ b/docs/modules/ROOT/pages/osgi-activator.adoc
@@ -1,5 +1,6 @@
 [[OsgiActivator]]
 = OSGi Camel Routes Activator
+:page-source: components/camel-osgi-activator/src/main/docs/osgi-activator.adoc
 
 *Since Camel 3.1*
 
diff --git a/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc b/docs/modules/ROOT/pages/paxlogging-component.adoc
similarity index 98%
copy from components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
copy to docs/modules/ROOT/pages/paxlogging-component.adoc
index f6b46e2..f469cd9 100644
--- a/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
+++ b/docs/modules/ROOT/pages/paxlogging-component.adoc
@@ -1,5 +1,6 @@
 [[paxlogging-component]]
 = OSGi PAX Logging Component
+:page-source: components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
 
 *Since Camel 2.6*
 
diff --git a/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/ExtMvelHelper.java b/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/ExtMvelHelper.java
index b77c297..4d05005 100644
--- a/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/ExtMvelHelper.java
+++ b/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/ExtMvelHelper.java
@@ -46,8 +46,13 @@ public class ExtMvelHelper {
         if (localDocExists(model)) {
             return getLocalDocLink(model);
         } else if (model instanceof ComponentModel) {
-            return String.format("xref:components::%s-component.adoc",
-                    invokeGetter(model, "getScheme"));
+            final ComponentModel component = (ComponentModel) model;
+            final String scheme = component.getScheme();
+            if ("org.apache.camel.karaf".equals(component.getGroupId())) {
+                return String.format("xref:camel-karaf::%s-component.adoc", scheme);
+            } else {
+                return String.format("xref:components::%s-component.adoc", scheme);
+            }
         } else if (model instanceof DataFormatModel) {
             return String.format("xref:components:dataformats:%s-dataformat.adoc",
                     invokeGetter(model, "getName"));
@@ -55,8 +60,13 @@ public class ExtMvelHelper {
             return String.format("xref:components:languages:%s-language.adoc",
                     invokeGetter(model, "getName"));
         } else if (model instanceof OtherModel) {
-            return String.format("xref:components::%s.adoc",
-                    invokeGetter(model, "getName"));
+            final OtherModel other = (OtherModel) model;
+            final String name = other.getName();
+            if ("org.apache.camel.karaf".equals(other.getGroupId())) {
+                return String.format("xref:camel-karaf::%s.adoc", name);
+            } else {
+                return String.format("xref:components::%s.adoc", name);
+            }
         } else {
             return null;
         }
diff --git a/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/UpdateDocComponentsListMojo.java b/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/UpdateDocComponentsListMojo.java
index 6110052..254cdf3 100644
--- a/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/UpdateDocComponentsListMojo.java
+++ b/tooling/camel-karaf-docs-maven-plugin/src/main/java/org/apache/camel/karaf/maven/UpdateDocComponentsListMojo.java
@@ -19,8 +19,12 @@ package org.apache.camel.karaf.maven;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.CopyOption;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -30,7 +34,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.function.Function;
 
+import org.apache.camel.tooling.model.BaseModel;
 import org.apache.camel.tooling.model.ComponentModel;
 import org.apache.camel.tooling.model.DataFormatModel;
 import org.apache.camel.tooling.model.JsonMapper;
@@ -186,11 +192,18 @@ public class UpdateDocComponentsListMojo extends AbstractMojo {
                 getLog().warn("No components.adoc file: " + file);
             }
 
+            publishDocumentation(components, ComponentModel::getGroupId, ComponentModel::getArtifactId);
         } catch (IOException e) {
             throw new MojoFailureException("Error due " + e.getMessage(), e);
         }
     }
 
+    private <T extends BaseModel<?>> void publishDocumentation(final List<T> components, final Function<T, String> groupId, final Function<T, String> artifactId) {
+        components.stream()
+            .filter(m -> "org.apache.camel.karaf".equals(groupId.apply(m)))
+            .forEach(m -> copyToPublishedDocumentation(artifactId.apply(m)));
+    }
+
     protected void executeDataFormatsReadme() throws MojoExecutionException, MojoFailureException {
         Set<File> dataFormatFiles = new TreeSet<>();
 
@@ -351,6 +364,7 @@ public class UpdateDocComponentsListMojo extends AbstractMojo {
                 getLog().warn("No components.adoc file: " + file);
             }
 
+            publishDocumentation(others, OtherModel::getGroupId, OtherModel::getArtifactId);
         } catch (IOException e) {
             throw new MojoFailureException("Error due " + e.getMessage(), e);
         }
@@ -558,6 +572,22 @@ public class UpdateDocComponentsListMojo extends AbstractMojo {
         }
     }
 
+    private void copyToPublishedDocumentation(final String artifactId) {
+        final Path docs = Paths.get("components", artifactId, "src/main/docs");
+
+        try {
+            Files.list(docs).forEach(d -> {
+                try {
+                    Files.copy(d, Paths.get(docBaseDir.getCanonicalPath(), d.getFileName().toString()), StandardCopyOption.REPLACE_EXISTING);
+                } catch (IOException e) {
+                    throw new UncheckedIOException("Unable to copy component documentation for: " + artifactId, e);
+                }
+            });
+        } catch (IOException e) {
+            throw new UncheckedIOException("Unable to list component documentation for: " + artifactId, e);
+        }
+    }
+
     private static class ComponentComparator implements Comparator<ComponentModel> {
 
         @Override