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 2021/08/23 13:05:49 UTC

[camel] branch main updated: CAMEL-16881: camel-catalog - Remove the documentation files (adoc) as they are not in us

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

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


The following commit(s) were added to refs/heads/main by this push:
     new d829e56  CAMEL-16881: camel-catalog - Remove the documentation files (adoc) as they are not in us
d829e56 is described below

commit d829e560ffac5b62be3937df187b49056199e4b1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Aug 23 15:05:17 2021 +0200

    CAMEL-16881: camel-catalog - Remove the documentation files (adoc) as they are not in us
---
 .../org/apache/camel/catalog/CamelCatalog.java     |  72 --------
 .../apache/camel/catalog/DefaultCamelCatalog.java  | 189 ---------------------
 .../org/apache/camel/catalog/CamelCatalogTest.java |  43 -----
 .../ROOT/pages/camel-3x-upgrade-guide-3_12.adoc    |   8 +
 4 files changed, 8 insertions(+), 304 deletions(-)

diff --git a/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/CamelCatalog.java b/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/CamelCatalog.java
index 3de3254..007cd38 100644
--- a/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/CamelCatalog.java
+++ b/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/CamelCatalog.java
@@ -286,78 +286,6 @@ public interface CamelCatalog {
     String modelJSonSchema(String name);
 
     /**
-     * Returns the component documentation as Ascii doc format.
-     *
-     * @param  name the component name
-     * @return      component documentation in ascii doc format.
-     */
-    @Deprecated
-    String componentAsciiDoc(String name);
-
-    /**
-     * Returns the component documentation as HTML format.
-     *
-     * @param  name the component name
-     * @return      component documentation in html format.
-     */
-    @Deprecated
-    String componentHtmlDoc(String name);
-
-    /**
-     * Returns the data format documentation as Ascii doc format.
-     *
-     * @param  name the data format name
-     * @return      data format documentation in ascii doc format.
-     */
-    @Deprecated
-    String dataFormatAsciiDoc(String name);
-
-    /**
-     * Returns the data format documentation as HTML format.
-     *
-     * @param  name the data format name
-     * @return      data format documentation in HTML format.
-     */
-    @Deprecated
-    String dataFormatHtmlDoc(String name);
-
-    /**
-     * Returns the language documentation as Ascii doc format.
-     *
-     * @param  name the language name
-     * @return      language documentation in ascii doc format.
-     */
-    @Deprecated
-    String languageAsciiDoc(String name);
-
-    /**
-     * Returns the language documentation as HTML format.
-     *
-     * @param  name the language name
-     * @return      language documentation in HTML format.
-     */
-    @Deprecated
-    String languageHtmlDoc(String name);
-
-    /**
-     * Returns the other (miscellaneous) documentation as Ascii doc format.
-     *
-     * @param  name the other (miscellaneous) name
-     * @return      other (miscellaneous) documentation in ascii doc format.
-     */
-    @Deprecated
-    String otherAsciiDoc(String name);
-
-    /**
-     * Returns the other (miscellaneous) documentation as HTML format.
-     *
-     * @param  name the other (miscellaneous) name
-     * @return      other (miscellaneous) documentation in HTML format.
-     */
-    @Deprecated
-    String otherHtmlDoc(String name);
-
-    /**
      * Find all the unique label names all the components are using.
      *
      * @return a set of all the labels.
diff --git a/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java b/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
index b20f481..9934ffe 100644
--- a/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
+++ b/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/DefaultCamelCatalog.java
@@ -25,7 +25,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
@@ -60,7 +59,6 @@ import org.apache.camel.util.json.JsonObject;
 public class DefaultCamelCatalog extends AbstractCamelCatalog implements CamelCatalog {
 
     private static final String MODELS_CATALOG = "org/apache/camel/catalog/models.properties";
-    private static final String DOC_DIR = "org/apache/camel/catalog/docs";
     private static final String ARCHETYPES_CATALOG = "org/apache/camel/catalog/archetypes/archetype-catalog.xml";
     private static final String SCHEMAS_XML = "org/apache/camel/catalog/schemas";
     private static final String MAIN_DIR = "org/apache/camel/catalog/main";
@@ -354,193 +352,6 @@ public class DefaultCamelCatalog extends AbstractCamelCatalog implements CamelCa
     }
 
     @Override
-    public String componentAsciiDoc(String name) {
-        String answer = doComponentAsciiDoc(name);
-        if (answer == null) {
-            // maybe the name is an alternative scheme name, and then we need to find the component that
-            // has the name as alternative, and use the first scheme as the name to find the documentation
-            List<String> names = findComponentNames();
-            for (String alternative : names) {
-                String schemes = getAlternativeComponentName(alternative, name);
-                if (schemes != null && schemes.contains(name)) {
-                    String first = schemes.split(",")[0];
-                    if (Objects.equals(first, name)) {
-                        continue;
-                    }
-                    return componentAsciiDoc(first);
-                }
-            }
-        }
-        return answer;
-    }
-
-    @Override
-    public String componentHtmlDoc(String name) {
-        String answer = doComponentHtmlDoc(name);
-        if (answer == null) {
-            // maybe the name is an alternative scheme name, and then we need to find the component that
-            // has the name as alternative, and use the first scheme as the name to find the documentation
-            List<String> names = findComponentNames();
-            for (String alternative : names) {
-                String schemes = getAlternativeComponentName(alternative, name);
-                if (schemes != null && schemes.contains(name)) {
-                    String first = schemes.split(",")[0];
-                    return componentHtmlDoc(first);
-                }
-            }
-        }
-        return answer;
-    }
-
-    private String getAlternativeComponentName(String componentName, String alternativeTo) {
-        // optimize for this very call to avoid loading all schemas
-        String json = componentJSonSchema(componentName);
-        if (json.contains("alternativeSchemes") && json.contains(alternativeTo)) {
-            ComponentModel model = componentModel(componentName);
-            if (model != null) {
-                return model.getAlternativeSchemes();
-            }
-        }
-        return null;
-    }
-
-    private String doComponentAsciiDoc(String componentName) {
-        // special for mail component
-        String name;
-        if (componentName.equals("imap") || componentName.equals("imaps") || componentName.equals("pop3")
-                || componentName.equals("pop3s") || componentName.equals("smtp") || componentName.equals("smtps")) {
-            name = "mail";
-        } else {
-            name = componentName;
-        }
-        String file = DOC_DIR + "/" + name + "-component.adoc";
-        return cache(file, () -> {
-            if (findComponentNames().contains(componentName)) {
-                return loadResource(file);
-            } else if (extraComponents.containsKey(name)) {
-                String className = extraComponents.get(name);
-                String packageName = className.substring(0, className.lastIndexOf('.'));
-                packageName = packageName.replace('.', '/');
-                String path = packageName + "/" + name + "-component.adoc";
-                return loadResource(path);
-            } else {
-                return null;
-            }
-        });
-    }
-
-    private String doComponentHtmlDoc(String componentName) {
-        // special for mail component
-        String name;
-        if (componentName.equals("imap") || componentName.equals("imaps") || componentName.equals("pop3")
-                || componentName.equals("pop3s") || componentName.equals("smtp") || componentName.equals("smtps")) {
-            name = "mail";
-        } else {
-            name = componentName;
-        }
-        String file = DOC_DIR + "/" + name + "-component.html";
-        return cache(file, () -> {
-            if (findComponentNames().contains(name)) {
-                return loadResource(file);
-            } else if (extraComponents.containsKey(name)) {
-                String className = extraComponents.get(name);
-                String packageName = className.substring(0, className.lastIndexOf('.'));
-                packageName = packageName.replace('.', '/');
-                String path = packageName + "/" + name + "-component.html";
-                return loadResource(path);
-            } else {
-                return null;
-            }
-        });
-    }
-
-    @Override
-    public String dataFormatAsciiDoc(String dataformatName) {
-        // special for some name data formats
-        String name;
-        if (dataformatName.startsWith("bindy")) {
-            name = "bindy";
-        } else if (dataformatName.startsWith("univocity")) {
-            name = "univocity";
-        } else {
-            name = dataformatName;
-        }
-        String file = DOC_DIR + "/" + name + "-dataformat.adoc";
-        return cache(file, () -> {
-            if (findDataFormatNames().contains(dataformatName)) {
-                return loadResource(file);
-            } else if (extraDataFormats.containsKey(name)) {
-                String className = extraDataFormats.get(name);
-                String packageName = className.substring(0, className.lastIndexOf('.'));
-                packageName = packageName.replace('.', '/');
-                String path = packageName + "/" + name + "-dataformat.adoc";
-                return loadResource(path);
-            } else {
-                return null;
-            }
-        });
-    }
-
-    @Override
-    public String dataFormatHtmlDoc(String dataformatName) {
-        // special for some name data formats
-        String name;
-        if (dataformatName.startsWith("bindy")) {
-            name = "bindy";
-        } else if (dataformatName.startsWith("univocity")) {
-            name = "univocity";
-        } else {
-            name = dataformatName;
-        }
-        String file = DOC_DIR + "/" + name + "-dataformat.html";
-        return cache(file, () -> {
-            if (findDataFormatNames().contains(name)) {
-                return loadResource(file);
-            } else if (extraDataFormats.containsKey(name)) {
-                String className = extraDataFormats.get(name);
-                String packageName = className.substring(0, className.lastIndexOf('.'));
-                packageName = packageName.replace('.', '/');
-                String path = packageName + "/" + name + "-dataformat.html";
-                return loadResource(path);
-            } else {
-                return null;
-            }
-        });
-    }
-
-    @Override
-    public String languageAsciiDoc(String name) {
-        // if we try to look method then its in the bean.adoc file
-        if ("method".equals(name)) {
-            name = "bean";
-        }
-        String file = DOC_DIR + "/" + name + "-language.adoc";
-        return cache(file, this::loadResource);
-    }
-
-    @Override
-    public String languageHtmlDoc(String name) {
-        // if we try to look method then its in the bean.html file
-        if ("method".equals(name)) {
-            name = "bean";
-        }
-        String file = DOC_DIR + "/" + name + "-language.html";
-        return cache(file, this::loadResource);
-    }
-
-    @Override
-    public String otherAsciiDoc(String name) {
-        String file = DOC_DIR + "/" + name + ".adoc";
-        return cache(file, this::loadResource);
-    }
-
-    @Override
-    public String otherHtmlDoc(String name) {
-        String file = DOC_DIR + "/" + name + "-other.html";
-        return cache(file, this::loadResource);
-    }
-
-    @Override
     public Set<String> findModelLabels() {
         return cache("findModelLabels", () -> findLabels(this::findModelNames, this::eipModel));
     }
diff --git a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index 109929d..4af0c84 100644
--- a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++ b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -1113,24 +1113,6 @@ public class CamelCatalogTest {
     }
 
     @Test
-    public void testComponentAsciiDoc() {
-        String doc = catalog.componentAsciiDoc("mock");
-        assertNotNull(doc);
-        assertTrue(doc.contains("mock:someName"));
-
-        doc = catalog.componentAsciiDoc("geocoder");
-        assertNotNull(doc);
-        assertTrue(doc.contains("looking up geocodes"));
-
-        doc = catalog.componentAsciiDoc("smtp");
-        assertNotNull(doc);
-        assertTrue(doc.contains("The mail component"));
-
-        doc = catalog.componentAsciiDoc("unknown");
-        assertNull(doc);
-    }
-
-    @Test
     public void testTransactedAndPolicyNoOutputs() {
         String json = catalog.modelJSonSchema("transacted");
         assertNotNull(json);
@@ -1144,31 +1126,6 @@ public class CamelCatalogTest {
     }
 
     @Test
-    public void testDataFormatAsciiDoc() {
-        String doc = catalog.dataFormatAsciiDoc("json-jackson");
-        assertNotNull(doc);
-        assertTrue(doc.contains("Jackson dataformat"));
-
-        doc = catalog.dataFormatAsciiDoc("bindy-csv");
-        assertNotNull(doc);
-        assertTrue(doc.contains("CsvRecord"));
-    }
-
-    @Test
-    public void testLanguageAsciiDoc() {
-        String doc = catalog.languageAsciiDoc("jsonpath");
-        assertNotNull(doc);
-        assertTrue(doc.contains("JsonPath language"));
-    }
-
-    @Test
-    public void testOtherAsciiDoc() {
-        String doc = catalog.otherAsciiDoc("swagger-java");
-        assertNotNull(doc);
-        assertTrue(doc.contains("Swagger"));
-    }
-
-    @Test
     public void testValidateEndpointTwitterSpecial() {
         String uri = "twitter-search://java?{{%s}}";
 
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_12.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_12.adoc
index ae1e14d..0099d14 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_12.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_12.adoc
@@ -40,3 +40,11 @@ The `camel-spark` component has been upgraded from Spark 2.x to 3.x.
 
 Kamelet parameters that are named such as `host`, `port` are now always used with their configured value.
 Before the value in use may be from an ENV variable with the same name.
+
+=== camel-catalog
+
+Remove the APIs to return the website documentation in ascii doc and html format, it is the methods
+with naming pattern `...AsciiDoc` and `...HtmlDoc`.
+
+
+