CAMEL-8379: Camel catalog - Include xml schema and maven archetype catalog
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0f6e1e7d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0f6e1e7d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0f6e1e7d Branch: refs/heads/master Commit: 0f6e1e7d6bba0892940fb188f4a25da735095a94 Parents: 7d9038c Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Feb 19 10:21:28 2015 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Feb 19 10:21:28 2015 +0100 ---------------------------------------------------------------------- platforms/catalog/pom.xml | 3 +- .../maven/packaging/PrepareCatalogMojo.java | 47 ++++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/0f6e1e7d/platforms/catalog/pom.xml ---------------------------------------------------------------------- diff --git a/platforms/catalog/pom.xml b/platforms/catalog/pom.xml index 01110b2..aaac676 100644 --- a/platforms/catalog/pom.xml +++ b/platforms/catalog/pom.xml @@ -37,7 +37,8 @@ org.apache.camel.catalog.components, org.apache.camel.catalog.dataformats, org.apache.camel.catalog.languages, - org.apache.camel.catalog.models + org.apache.camel.catalog.models, + org.apache.camel.catalog.schemas </camel.osgi.export.pkg> </properties> http://git-wip-us.apache.org/repos/asf/camel/blob/0f6e1e7d/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 9c2f1fe..37f4041 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 @@ -97,6 +97,13 @@ public class PrepareCatalogMojo extends AbstractMojo { protected File archetypesOutDir; /** + * The output directory for XML schemas catalog + * + * @parameter default-value="${project.build.directory}/classes/org/apache/camel/catalog/schemas" + */ + protected File schemasOutDir; + + /** * The components directory where all the Apache Camel components are * * @parameter default-value="${project.build.directory}/../../../components" @@ -118,6 +125,20 @@ public class PrepareCatalogMojo extends AbstractMojo { protected File archetypesDir; /** + * The directory where the camel-spring XML schema are + * + * @parameter default-value="${project.build.directory}/../../../components/camel-spring/target/schema" + */ + protected File springSchemaDir; + + /** + * The directory where the camel-blueprint XML schema are + * + * @parameter default-value="${project.build.directory}/../../../components/camel-blueprint/target/schema" + */ + protected File blueprintSchemaDir; + + /** * Maven ProjectHelper. * * @component @@ -138,6 +159,7 @@ public class PrepareCatalogMojo extends AbstractMojo { executeDataFormats(); executeLanguages(); executeArchetypes(); + executeXmlSchemas(); } protected void executeModel() throws MojoExecutionException, MojoFailureException { @@ -622,6 +644,31 @@ public class PrepareCatalogMojo extends AbstractMojo { } } + protected void executeXmlSchemas() throws MojoExecutionException, MojoFailureException { + getLog().info("Copying Spring/Blueprint XML schemas"); + + schemasOutDir.mkdirs(); + + File file = new File(springSchemaDir, "camel-spring.xsd"); + if (file.exists() && file.isFile()) { + File to = new File(schemasOutDir, file.getName()); + try { + copyFile(file, to); + } catch (IOException e) { + throw new MojoFailureException("Cannot copy file from " + file + " -> " + to, e); + } + } + file = new File(blueprintSchemaDir, "camel-blueprint.xsd"); + if (file.exists() && file.isFile()) { + File to = new File(schemasOutDir, file.getName()); + try { + copyFile(file, to); + } catch (IOException e) { + throw new MojoFailureException("Cannot copy file from " + file + " -> " + to, e); + } + } + } + private void printModelsReport(Set<File> json, Set<File> duplicate, Set<File> missingLabels, Map<String, Set<String>> usedLabels, Set<File> missingJavaDoc) { getLog().info("================================================================================");