Repository: camel
Updated Branches:
  refs/heads/master a2d8ce667 -> 3f030d05b


CAMEL-10775: Polished


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/632f7bd7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/632f7bd7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/632f7bd7

Branch: refs/heads/master
Commit: 632f7bd7dfb5b0f96ff298f12dabe6c5428e8ef3
Parents: a2d8ce6
Author: Claus Ibsen <davscl...@apache.org>
Authored: Thu Feb 2 21:40:55 2017 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Feb 2 21:40:55 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/asterisk-component.adoc       |   2 +-
 .../src/main/docs/cql-component.adoc            |   3 -
 .../src/main/docs/cmis-component.adoc           |   5 +-
 .../src/main/docs/coap-component.adoc           |   4 +-
 .../src/main/docs/cometd-component.adoc         |   2 +
 .../src/main/docs/couchbase-component.adoc      |   1 -
 .../src/main/docs/crypto-component.adoc         |   1 +
 .../main/docs/crypto-digital-signatures.adoc    |   4 +-
 .../camel-eclipse/src/main/docs/eclipse.adoc    |   4 +-
 .../src/main/docs/gora-component.adoc           |   4 +-
 .../src/main/docs/grape-component.adoc          |   2 +-
 .../camel/component/ironmq/IronMQEndpoint.java  |   2 +-
 .../src/main/docs/paho-component.adoc           |   2 +-
 .../src/main/docs/sjms-batch-component.adoc     |   2 -
 .../src/main/docs/sjms-component.adoc           |  16 ---
 .../src/main/docs/smpp-component.adoc           |   2 +-
 .../src/main/docs/twitter-component.adoc        |  10 --
 .../maven/packaging/ReadmeComponentMojo.java    | 122 ++++++++++++++-----
 18 files changed, 106 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-asterisk/src/main/docs/asterisk-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-asterisk/src/main/docs/asterisk-component.adoc 
b/components/camel-asterisk/src/main/docs/asterisk-component.adoc
index 9f69aec..4fd1bcdf 100644
--- a/components/camel-asterisk/src/main/docs/asterisk-component.adoc
+++ b/components/camel-asterisk/src/main/docs/asterisk-component.adoc
@@ -1,6 +1,6 @@
 ## Asterisk Component
 
-*Available as of Camel 2.18*
+*Available as of Camel version 2.18.0*
 
 The *asterisk:* component allows you to work easily with an Asterisk PBX 
Server http://www.asterisk.org/ using https://asterisk-java.org/[asterisk-java]
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-cassandraql/src/main/docs/cql-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-cassandraql/src/main/docs/cql-component.adoc 
b/components/camel-cassandraql/src/main/docs/cql-component.adoc
index 3241c79..0d434f4 100644
--- a/components/camel-cassandraql/src/main/docs/cql-component.adoc
+++ b/components/camel-cassandraql/src/main/docs/cql-component.adoc
@@ -1,7 +1,4 @@
 ## Cassandra CQL Component
-[[Cassandra-CamelCassandraComponent]]
-Camel Cassandra Component
--------------------------
 
 *Available as of Camel 2.15*
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-cmis/src/main/docs/cmis-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-cmis/src/main/docs/cmis-component.adoc 
b/components/camel-cmis/src/main/docs/cmis-component.adoc
index 1abc87e..2da5e21 100644
--- a/components/camel-cmis/src/main/docs/cmis-component.adoc
+++ b/components/camel-cmis/src/main/docs/cmis-component.adoc
@@ -1,7 +1,8 @@
 ## CMIS Component
 
-*Available as of Camel 2.11* +
- The cmis component uses the
+*Available as of Camel version 2.11.0*
+
+The cmis component uses the
 http://chemistry.apache.org/java/opencmis.html[Apache Chemistry] client
 API and allows you to add/read nodes to/from a CMIS compliant content
 repositories.

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-coap/src/main/docs/coap-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-coap/src/main/docs/coap-component.adoc 
b/components/camel-coap/src/main/docs/coap-component.adoc
index e7719c4..3949ca7 100644
--- a/components/camel-coap/src/main/docs/coap-component.adoc
+++ b/components/camel-coap/src/main/docs/coap-component.adoc
@@ -1,12 +1,12 @@
 ## CoAP Component
 
+*Available as of Camel 2.16*
+
 *Camel-CoAP* is an http://camel.apache.org/[Apache Camel] component that
 allows you to work with CoAP, a lightweight REST-type protocol for 
machine-to-machine operation. 
 http://coap.technology/[CoAP], Constrained Application Protocol is a 
specialized web transfer protocol 
 for use with constrained nodes and constrained networks and it is based on RFC 
7252.
 
-*Available as of Camel 2.16*
-
 Maven users will need to add the following dependency to their pom.xml
 for this component:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-cometd/src/main/docs/cometd-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-cometd/src/main/docs/cometd-component.adoc 
b/components/camel-cometd/src/main/docs/cometd-component.adoc
index 1ab0cf7..1034b7b 100644
--- a/components/camel-cometd/src/main/docs/cometd-component.adoc
+++ b/components/camel-cometd/src/main/docs/cometd-component.adoc
@@ -1,5 +1,7 @@
 ## CometD Component
 
+*Available as of Camel version 2.0.0*
+
 The *cometd:* component is a transport for working with the
 http://www.mortbay.org/jetty[jetty] implementation of the
 http://docs.codehaus.org/display/JETTY/Cometd+%28aka+Bayeux%29[cometd/bayeux

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-couchbase/src/main/docs/couchbase-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-couchbase/src/main/docs/couchbase-component.adoc 
b/components/camel-couchbase/src/main/docs/couchbase-component.adoc
index e0a50a8..a5213ef 100644
--- a/components/camel-couchbase/src/main/docs/couchbase-component.adoc
+++ b/components/camel-couchbase/src/main/docs/couchbase-component.adoc
@@ -1,5 +1,4 @@
 ## Couchbase Component
-## Couchbase Component
 
 *Available as of Camel 2.19*
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-crypto/src/main/docs/crypto-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-crypto/src/main/docs/crypto-component.adoc 
b/components/camel-crypto/src/main/docs/crypto-component.adoc
index dc57907..7efb5b0 100644
--- a/components/camel-crypto/src/main/docs/crypto-component.adoc
+++ b/components/camel-crypto/src/main/docs/crypto-component.adoc
@@ -1,6 +1,7 @@
 ## Crypto (JCE) Component
 
 *Available as of Camel 2.3* 
+
 *PGP Available as of Camel 2.9*
 
 The Crypto link:data-format.html[Data Format] integrates the Java

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-crypto/src/main/docs/crypto-digital-signatures.adoc
----------------------------------------------------------------------
diff --git 
a/components/camel-crypto/src/main/docs/crypto-digital-signatures.adoc 
b/components/camel-crypto/src/main/docs/crypto-digital-signatures.adoc
index 7b0aac2..c090b0a 100644
--- a/components/camel-crypto/src/main/docs/crypto-digital-signatures.adoc
+++ b/components/camel-crypto/src/main/docs/crypto-digital-signatures.adoc
@@ -1,6 +1,4 @@
-[[CryptocomponentforDigitalSignatures]]
-Crypto component for Digital Signatures
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+## Crypto
 
 *Available as of Camel 2.3*
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-eclipse/src/main/docs/eclipse.adoc
----------------------------------------------------------------------
diff --git a/components/camel-eclipse/src/main/docs/eclipse.adoc 
b/components/camel-eclipse/src/main/docs/eclipse.adoc
index f3c22c9..23e42e5 100644
--- a/components/camel-eclipse/src/main/docs/eclipse.adoc
+++ b/components/camel-eclipse/src/main/docs/eclipse.adoc
@@ -1,6 +1,4 @@
-[[camel-eclipse-camel-eclipse]]
-Eclipse Component
-~~~~~~~~~~~~~~~~~
+## Eclipse Component
 
 *Available as of Camel 2.3*
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-gora/src/main/docs/gora-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-gora/src/main/docs/gora-component.adoc 
b/components/camel-gora/src/main/docs/gora-component.adoc
index f09fbb8..5d93e77 100644
--- a/components/camel-gora/src/main/docs/gora-component.adoc
+++ b/components/camel-gora/src/main/docs/gora-component.adoc
@@ -1,11 +1,11 @@
 ## Gora Component
 
+*Available as of Camel 2.14*
+
 *Camel-Gora* is an http://camel.apache.org/[Apache Camel] component that
 allows you to work with NoSQL databases using the
 http://gora.apache.org/[Apache Gora] framework.
 
-*Available as of Camel 2.14*
-
 Maven users will need to add the following dependency to their pom.xml
 for this component:
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-grape/src/main/docs/grape-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-grape/src/main/docs/grape-component.adoc 
b/components/camel-grape/src/main/docs/grape-component.adoc
index 4cddf27..9cc6553 100644
--- a/components/camel-grape/src/main/docs/grape-component.adoc
+++ b/components/camel-grape/src/main/docs/grape-component.adoc
@@ -1,6 +1,6 @@
 ## Grape Component
 
-Available as of Camel 2.16 
+*Available as of Camel 2.16*
 
 http://docs.groovy-lang.org/latest/html/documentation/grape.html[Grape]
 component allows you to fetch, load and manage additional jars when

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java
 
b/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java
index ea47639..28d9f36 100644
--- 
a/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java
+++ 
b/components/camel-ironmq/src/main/java/org/apache/camel/component/ironmq/IronMQEndpoint.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
 /**
  * The ironmq provides integration with <a 
href="https://www.iron.io/";>IronMQ</a> an elastic and durable hosted message 
queue as a service.
  */
-@UriEndpoint(firstVersion = "2.17.0", scheme = "ironmq", syntax = 
"ironmq:queueName", title = "ironmq", consumerClass = IronMQConsumer.class, 
label = "cloud,messaging")
+@UriEndpoint(firstVersion = "2.17.0", scheme = "ironmq", syntax = 
"ironmq:queueName", title = "IronMQ", consumerClass = IronMQConsumer.class, 
label = "cloud,messaging")
 public class IronMQEndpoint extends ScheduledPollEndpoint {
     private static final Logger LOG = 
LoggerFactory.getLogger(IronMQEndpoint.class);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-paho/src/main/docs/paho-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-paho/src/main/docs/paho-component.adoc 
b/components/camel-paho/src/main/docs/paho-component.adoc
index c1c4a55..d01240a 100644
--- a/components/camel-paho/src/main/docs/paho-component.adoc
+++ b/components/camel-paho/src/main/docs/paho-component.adoc
@@ -1,6 +1,6 @@
 ## Paho Component
 
-INFO: Available as of Camel 2.16 
+*Available as of Camel version 2.16.0*
 
 Paho component provides connector for the MQTT messaging protocol using
 the https://eclipse.org/paho/[Eclipse Paho] library. Paho is one of the

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-sjms/src/main/docs/sjms-batch-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/docs/sjms-batch-component.adoc 
b/components/camel-sjms/src/main/docs/sjms-batch-component.adoc
index 241b47d..0309baf 100644
--- a/components/camel-sjms/src/main/docs/sjms-batch-component.adoc
+++ b/components/camel-sjms/src/main/docs/sjms-batch-component.adoc
@@ -1,6 +1,4 @@
 ## Simple JMS Batch Component
-[[ConfluenceContent]]
-### SJMS Batch Component
 
 *Available as of Camel 2.16*
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-sjms/src/main/docs/sjms-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/docs/sjms-component.adoc 
b/components/camel-sjms/src/main/docs/sjms-component.adoc
index 3e74bfc..bf3e36a 100644
--- a/components/camel-sjms/src/main/docs/sjms-component.adoc
+++ b/components/camel-sjms/src/main/docs/sjms-component.adoc
@@ -1,20 +1,4 @@
 ## Simple JMS Component
-ifdef::env-github[]
-:icon-smile: :smiley:
-:caution-caption: :boom:
-:important-caption: :exclamation:
-:note-caption: :information_source:
-:tip-caption: :bulb:
-:warning-caption: :warning:
-endif::[]
-
-ifndef::env-github[]
-:icons: font
-:icon-smile: icon:smile-o[fw,role=yellow]
-endif::[]
-
-[[ConfluenceContent]]
-### SJMS Component
 
 *Available as of Camel 2.11*
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-smpp/src/main/docs/smpp-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/docs/smpp-component.adoc 
b/components/camel-smpp/src/main/docs/smpp-component.adoc
index c83cf21..24937b4 100644
--- a/components/camel-smpp/src/main/docs/smpp-component.adoc
+++ b/components/camel-smpp/src/main/docs/smpp-component.adoc
@@ -1,6 +1,6 @@
 ## SMPP Component
 
-*CamelSmppFinalStatusAvailable as of Camel 2.2*
+*Available as of Camel 2.2*
 
 This component provides access to an SMSC (Short Message Service Center)
 over the http://smsforum.net/SMPP_v3_4_Issue1_2.zip[SMPP] protocol to

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/components/camel-twitter/src/main/docs/twitter-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-twitter/src/main/docs/twitter-component.adoc 
b/components/camel-twitter/src/main/docs/twitter-component.adoc
index 72196d3..0fdf242 100644
--- a/components/camel-twitter/src/main/docs/twitter-component.adoc
+++ b/components/camel-twitter/src/main/docs/twitter-component.adoc
@@ -1,14 +1,4 @@
 ## Twitter Component
-ifdef::env-github[]
-:caution-caption: :boom:
-:important-caption: :exclamation:
-:note-caption: :information_source:
-:tip-caption: :bulb:
-:warning-caption: :warning:
-endif::[]
-
-[[ConfluenceContent]]
-### Twitter
 
 *Available as of Camel 2.10*
 

http://git-wip-us.apache.org/repos/asf/camel/blob/632f7bd7/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
index b3a7ec0..dbbc984 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ReadmeComponentMojo.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -130,9 +131,10 @@ public class ReadmeComponentMojo extends AbstractMojo {
                     }
 
                     boolean exists = file.exists();
-                    boolean updated = false;
+                    boolean updated;
 
-                    updated |= updateTitles(file, model.getTitle() + " 
Component");
+                    updated = updateTitles(file, model.getTitle() + " 
Component");
+                    updated |= updateAvailableFrom(file, 
model.getFirstVersion());
 
                     if (model.getComponentOptions() != null) {
                         String options = templateComponentOptions(model);
@@ -181,9 +183,10 @@ public class ReadmeComponentMojo extends AbstractMojo {
                     model.setTitle(title);
 
                     boolean exists = file.exists();
-                    boolean updated = false;
+                    boolean updated;
 
-                    updated |= updateTitles(file, model.getTitle() + " 
DataFormat");
+                    updated = updateTitles(file, model.getTitle() + " 
DataFormat");
+                    updated |= updateAvailableFrom(file, 
model.getFirstVersion());
 
                     if (model.getDataFormatOptions() != null) {
                         String options = templateDataFormatOptions(model);
@@ -214,33 +217,6 @@ public class ReadmeComponentMojo extends AbstractMojo {
         }
     }
 
-    private static String asComponentTitle(String name, String title) {
-        // special for some components which share the same readme file
-        if (name.equals("imap") || name.equals("imaps") || name.equals("pop3") 
|| name.equals("pop3s") || name.equals("smtp") || name.equals("smtps")) {
-            return "Mail";
-        } else {
-            return title;
-        }
-    }
-
-    private static String asDataFormatName(String name) {
-        // special for some dataformats which share the same readme file
-        if (name.startsWith("bindy")) {
-            return "bindy";
-        } else {
-            return name;
-        }
-    }
-
-    private static String asDataFormatTitle(String name, String title) {
-        // special for some dataformats which share the same readme file
-        if (name.startsWith("bindy")) {
-            return "Bindy";
-        } else {
-            return title;
-        }
-    }
-
     private void executeLanguage() throws MojoExecutionException, 
MojoFailureException {
         // find the language names
         List<String> languageNames = findLanguageNames();
@@ -259,9 +235,10 @@ public class ReadmeComponentMojo extends AbstractMojo {
                     LanguageModel model = generateLanguageModel(languageName, 
json);
 
                     boolean exists = file.exists();
-                    boolean updated = false;
+                    boolean updated;
 
-                    updated |= updateTitles(file, model.getTitle() + " 
Language");
+                    updated = updateTitles(file, model.getTitle() + " 
Language");
+                    updated |= updateAvailableFrom(file, 
model.getFirstVersion());
 
                     if (model.getLanguageOptions() != null) {
                         String options = templateLanguageOptions(model);
@@ -283,6 +260,33 @@ public class ReadmeComponentMojo extends AbstractMojo {
         }
     }
 
+    private static String asComponentTitle(String name, String title) {
+        // special for some components which share the same readme file
+        if (name.equals("imap") || name.equals("imaps") || name.equals("pop3") 
|| name.equals("pop3s") || name.equals("smtp") || name.equals("smtps")) {
+            return "Mail";
+        } else {
+            return title;
+        }
+    }
+
+    private static String asDataFormatName(String name) {
+        // special for some dataformats which share the same readme file
+        if (name.startsWith("bindy")) {
+            return "bindy";
+        } else {
+            return name;
+        }
+    }
+
+    private static String asDataFormatTitle(String name, String title) {
+        // special for some dataformats which share the same readme file
+        if (name.startsWith("bindy")) {
+            return "Bindy";
+        } else {
+            return title;
+        }
+    }
+
     private boolean updateTitles(File file, String title) throws 
MojoExecutionException {
         if (!file.exists()) {
             return false;
@@ -348,6 +352,58 @@ public class ReadmeComponentMojo extends AbstractMojo {
         return updated;
     }
 
+    private boolean updateAvailableFrom(File file, String firstVersion) throws 
MojoExecutionException {
+        if (firstVersion == null || !file.exists()) {
+            return false;
+        }
+
+        boolean updated = false;
+
+        try {
+            String text = loadText(new FileInputStream(file));
+
+            String[] lines = text.split("\n");
+
+            List<String> newLines = new ArrayList<>();
+
+            // copy over to all new lines
+            newLines.addAll(Arrays.asList(lines));
+
+            // check the first four lines
+            boolean title = lines[0].startsWith("##");
+            boolean empty = lines[1].trim().isEmpty();
+            boolean availableFrom = lines[2].trim().contains("Available as 
of");
+            boolean empty2 = lines[3].trim().isEmpty();
+
+            if (title && empty && availableFrom) {
+                String newLine = "*Available as of Camel version " + 
firstVersion + "*";
+                if (!newLine.equals(lines[2])) {
+                    newLines.set(2, newLine);
+                    updated = true;
+                }
+                if (!empty2) {
+                    newLines.add(3, "");
+                    updated = true;
+                }
+            } else if (!availableFrom) {
+                String newLine = "*Available as of Camel version " + 
firstVersion + "*";
+                newLines.add(2, newLine);
+                newLines.add(3, "");
+                updated = true;
+            }
+
+            if (updated) {
+                // build the new updated text
+                String newText = 
newLines.stream().collect(Collectors.joining("\n"));
+                writeText(file, newText);
+            }
+        } catch (Exception e) {
+            throw new MojoExecutionException("Error reading file " + file + " 
Reason: " + e, e);
+        }
+
+        return updated;
+    }
+
     private boolean updateComponentOptions(File file, String changed) throws 
MojoExecutionException {
         if (!file.exists()) {
             return false;

Reply via email to