Repository: camel Updated Branches: refs/heads/master 6b43d62ac -> 960331d63
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/960331d6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/960331d6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/960331d6 Branch: refs/heads/master Commit: 960331d6329e3eab4b25579756f0b78f08666590 Parents: 6b43d62 Author: Claus Ibsen <[email protected]> Authored: Sat Jun 20 08:56:21 2015 +0200 Committer: Claus Ibsen <[email protected]> Committed: Sat Jun 20 08:56:21 2015 +0200 ---------------------------------------------------------------------- .../maven/packaging/PrepareCatalogMojo.java | 174 +++++-------------- 1 file changed, 43 insertions(+), 131 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/960331d6/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java index 169486b..337c1bf 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java @@ -169,9 +169,8 @@ public class PrepareCatalogMojo extends AbstractMojo { executeXmlSchemas(); } - // TODO: Remove some of the missing check as we should have that out of the box with the validate goal - protected void executeModel() throws MojoExecutionException, MojoFailureException { + getLog().info("================================================================================"); getLog().info("Copying all Camel model json descriptors"); // lets use sorted set/maps @@ -286,10 +285,6 @@ public class PrepareCatalogMojo extends AbstractMojo { Set<File> duplicateJsonFiles = new TreeSet<File>(); Set<File> componentFiles = new TreeSet<File>(); Set<File> missingComponents = new TreeSet<File>(); - Set<File> missingLabels = new TreeSet<File>(); - Set<File> missingUriPaths = new TreeSet<File>(); - Set<File> missingComponentJavaDoc = new TreeSet<File>(); - Set<File> missingEndpointJavaDoc = new TreeSet<File>(); Map<String, Set<String>> usedLabels = new TreeMap<String, Set<String>>(); // find all json files in components and camel-core @@ -359,47 +354,19 @@ public class PrepareCatalogMojo extends AbstractMojo { // check if we have a label as we want the components to include labels try { String text = loadText(new FileInputStream(file)); - // just do a basic label check - if (text.contains("\"label\": \"\"")) { - missingLabels.add(file); - } else { - String name = asComponentName(file); - Matcher matcher = LABEL_PATTERN.matcher(text); - // grab the label, and remember it in the used labels - if (matcher.find()) { - String label = matcher.group(1); - String[] labels = label.split(","); - for (String s : labels) { - Set<String> components = usedLabels.get(s); - if (components == null) { - components = new TreeSet<String>(); - usedLabels.put(s, components); - } - components.add(name); + String name = asComponentName(file); + Matcher matcher = LABEL_PATTERN.matcher(text); + // grab the label, and remember it in the used labels + if (matcher.find()) { + String label = matcher.group(1); + String[] labels = label.split(","); + for (String s : labels) { + Set<String> components = usedLabels.get(s); + if (components == null) { + components = new TreeSet<String>(); + usedLabels.put(s, components); } - } - } - if (!text.contains("\"kind\": \"path\"")) { - missingUriPaths.add(file); - } - - // check all the component properties if they have description - List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("componentProperties", text, true); - for (Map<String, String> row : rows) { - String doc = row.get("description"); - if (doc == null || doc.isEmpty()) { - missingComponentJavaDoc.add(file); - break; - } - } - - // check all the endpoint properties if they have description - rows = JSonSchemaHelper.parseJsonSchema("properties", text, true); - for (Map<String, String> row : rows) { - String doc = row.get("description"); - if (doc == null || doc.isEmpty()) { - missingEndpointJavaDoc.add(file); - break; + components.add(name); } } } catch (IOException e) { @@ -434,7 +401,7 @@ public class PrepareCatalogMojo extends AbstractMojo { throw new MojoFailureException("Error writing to file " + all); } - printComponentsReport(jsonFiles, duplicateJsonFiles, missingComponents, missingEndpointJavaDoc, missingComponentJavaDoc, missingUriPaths, missingLabels, usedLabels); + printComponentsReport(jsonFiles, duplicateJsonFiles, missingComponents, usedLabels); } protected void executeDataFormats() throws MojoExecutionException, MojoFailureException { @@ -444,7 +411,6 @@ public class PrepareCatalogMojo extends AbstractMojo { Set<File> jsonFiles = new TreeSet<File>(); Set<File> duplicateJsonFiles = new TreeSet<File>(); Set<File> dataFormatFiles = new TreeSet<File>(); - Set<File> missingLabels = new TreeSet<File>(); Map<String, Set<String>> usedLabels = new TreeMap<String, Set<String>>(); // find all data formats from the components directory @@ -485,24 +451,19 @@ public class PrepareCatalogMojo extends AbstractMojo { // check if we have a label as we want the data format to include labels try { String text = loadText(new FileInputStream(file)); - // just do a basic label check - if (text.contains("\"label\": \"\"")) { - missingLabels.add(file); - } else { - String name = asComponentName(file); - Matcher matcher = LABEL_PATTERN.matcher(text); - // grab the label, and remember it in the used labels - if (matcher.find()) { - String label = matcher.group(1); - String[] labels = label.split(","); - for (String s : labels) { - Set<String> dataFormats = usedLabels.get(s); - if (dataFormats == null) { - dataFormats = new TreeSet<String>(); - usedLabels.put(s, dataFormats); - } - dataFormats.add(name); + String name = asComponentName(file); + Matcher matcher = LABEL_PATTERN.matcher(text); + // grab the label, and remember it in the used labels + if (matcher.find()) { + String label = matcher.group(1); + String[] labels = label.split(","); + for (String s : labels) { + Set<String> dataFormats = usedLabels.get(s); + if (dataFormats == null) { + dataFormats = new TreeSet<String>(); + usedLabels.put(s, dataFormats); } + dataFormats.add(name); } } } catch (IOException e) { @@ -537,7 +498,7 @@ public class PrepareCatalogMojo extends AbstractMojo { throw new MojoFailureException("Error writing to file " + all); } - printDataFormatsReport(jsonFiles, duplicateJsonFiles, missingLabels, usedLabels); + printDataFormatsReport(jsonFiles, duplicateJsonFiles, usedLabels); } protected void executeLanguages() throws MojoExecutionException, MojoFailureException { @@ -547,7 +508,6 @@ public class PrepareCatalogMojo extends AbstractMojo { Set<File> jsonFiles = new TreeSet<File>(); Set<File> duplicateJsonFiles = new TreeSet<File>(); Set<File> languageFiles = new TreeSet<File>(); - Set<File> missingLabels = new TreeSet<File>(); Map<String, Set<String>> usedLabels = new TreeMap<String, Set<String>>(); // find all languages from the components directory @@ -588,24 +548,19 @@ public class PrepareCatalogMojo extends AbstractMojo { // check if we have a label as we want the data format to include labels try { String text = loadText(new FileInputStream(file)); - // just do a basic label check - if (text.contains("\"label\": \"\"")) { - missingLabels.add(file); - } else { - String name = asComponentName(file); - Matcher matcher = LABEL_PATTERN.matcher(text); - // grab the label, and remember it in the used labels - if (matcher.find()) { - String label = matcher.group(1); - String[] labels = label.split(","); - for (String s : labels) { - Set<String> languages = usedLabels.get(s); - if (languages == null) { - languages = new TreeSet<String>(); - usedLabels.put(s, languages); - } - languages.add(name); + String name = asComponentName(file); + Matcher matcher = LABEL_PATTERN.matcher(text); + // grab the label, and remember it in the used labels + if (matcher.find()) { + String label = matcher.group(1); + String[] labels = label.split(","); + for (String s : labels) { + Set<String> languages = usedLabels.get(s); + if (languages == null) { + languages = new TreeSet<String>(); + usedLabels.put(s, languages); } + languages.add(name); } } } catch (IOException e) { @@ -640,7 +595,7 @@ public class PrepareCatalogMojo extends AbstractMojo { throw new MojoFailureException("Error writing to file " + all); } - printLanguagesReport(jsonFiles, duplicateJsonFiles, missingLabels, usedLabels); + printLanguagesReport(jsonFiles, duplicateJsonFiles, usedLabels); } protected void executeArchetypes() throws MojoExecutionException, MojoFailureException { @@ -732,8 +687,7 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().info("================================================================================"); } - private void printComponentsReport(Set<File> json, Set<File> duplicate, Set<File> missing, Set<File> missingEndpointJavaDoc, Set<File> missingComponentJavaDoc, - Set<File> missingUriPaths, Set<File>missingLabels, Map<String, Set<String>> usedLabels) { + private void printComponentsReport(Set<File> json, Set<File> duplicate, Set<File> missing, Map<String, Set<String>> usedLabels) { getLog().info("================================================================================"); getLog().info(""); getLog().info("Camel component catalog report"); @@ -759,34 +713,6 @@ public class PrepareCatalogMojo extends AbstractMojo { } } } - if (!missingLabels.isEmpty()) { - getLog().info(""); - getLog().warn("\tMissing labels detected: " + missingLabels.size()); - for (File file : missingLabels) { - getLog().warn("\t\t" + asComponentName(file)); - } - } - if (!missingUriPaths.isEmpty()) { - getLog().info(""); - getLog().warn("\tMissing @UriPath detected: " + missingUriPaths.size()); - for (File file : missingUriPaths) { - getLog().warn("\t\t" + asComponentName(file)); - } - } - if (!missingComponentJavaDoc.isEmpty()) { - getLog().info(""); - getLog().warn("\tMissing component options javadoc detected: " + missingComponentJavaDoc.size()); - for (File file : missingComponentJavaDoc) { - getLog().warn("\t\t" + asComponentName(file)); - } - } - if (!missingEndpointJavaDoc.isEmpty()) { - getLog().info(""); - getLog().warn("\tMissing endpoint options javadoc detected: " + missingEndpointJavaDoc.size()); - for (File file : missingEndpointJavaDoc) { - getLog().warn("\t\t" + asComponentName(file)); - } - } if (!missing.isEmpty()) { getLog().info(""); getLog().warn("\tMissing components detected: " + missing.size()); @@ -798,7 +724,7 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().info("================================================================================"); } - private void printDataFormatsReport(Set<File> json, Set<File> duplicate, Set<File> missingLabels, Map<String, Set<String>> usedLabels) { + private void printDataFormatsReport(Set<File> json, Set<File> duplicate, Map<String, Set<String>> usedLabels) { getLog().info("================================================================================"); getLog().info(""); getLog().info("Camel data format catalog report"); @@ -814,13 +740,6 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().warn("\t\t" + asComponentName(file)); } } - if (!missingLabels.isEmpty()) { - getLog().info(""); - getLog().warn("\tMissing labels detected: " + missingLabels.size()); - for (File file : missingLabels) { - getLog().warn("\t\t" + asComponentName(file)); - } - } if (!usedLabels.isEmpty()) { getLog().info(""); getLog().info("\tUsed labels: " + usedLabels.size()); @@ -835,7 +754,7 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().info("================================================================================"); } - private void printLanguagesReport(Set<File> json, Set<File> duplicate, Set<File> missingLabels, Map<String, Set<String>> usedLabels) { + private void printLanguagesReport(Set<File> json, Set<File> duplicate, Map<String, Set<String>> usedLabels) { getLog().info("================================================================================"); getLog().info(""); getLog().info("Camel language catalog report"); @@ -851,13 +770,6 @@ public class PrepareCatalogMojo extends AbstractMojo { getLog().warn("\t\t" + asComponentName(file)); } } - if (!missingLabels.isEmpty()) { - getLog().info(""); - getLog().warn("\tMissing labels detected: " + missingLabels.size()); - for (File file : missingLabels) { - getLog().warn("\t\t" + asComponentName(file)); - } - } if (!usedLabels.isEmpty()) { getLog().info(""); getLog().info("\tUsed labels: " + usedLabels.size());
