camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/4] camel git commit: CAMEL-8379: Camel catalog - Include xml schema and maven archetype catalog
Date Thu, 19 Feb 2015 10:24:45 GMT
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/00b82cc0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/00b82cc0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/00b82cc0

Branch: refs/heads/master
Commit: 00b82cc0adffa6cb47cc4ea07e84cb8ea0f6221a
Parents: 0f6e1e7
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Feb 19 10:52:53 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Feb 19 10:52:53 2015 +0100

----------------------------------------------------------------------
 .../camel/catalog/CamelComponentCatalog.java    | 21 ++++++++
 .../catalog/DefaultCamelComponentCatalog.java   | 50 ++++++++++++++++++++
 2 files changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/00b82cc0/platforms/catalog/src/main/java/org/apache/camel/catalog/CamelComponentCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/CamelComponentCatalog.java
b/platforms/catalog/src/main/java/org/apache/camel/catalog/CamelComponentCatalog.java
index d9bb8ec..027cf83 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/CamelComponentCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/CamelComponentCatalog.java
@@ -123,4 +123,25 @@ public interface CamelComponentCatalog {
      * @return a set of all the labels.
      */
     Set<String> findModelLabels();
+
+    /**
+     * Returns the Apache Camel Maven Archetype catalog in XML format.
+     *
+     * @return the catalog in XML
+     */
+    String archetypeCatalogAsXml();
+
+    /**
+     * Returns the Camel Spring XML schema
+     *
+     * @return the spring XML schema
+     */
+    String springSchemaAsXml();
+
+    /**
+     * Returns the Camel Blueprint XML schema
+     *
+     * @return the blueprint XML schema
+     */
+    String blueprintSchemaAsXml();
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/00b82cc0/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelComponentCatalog.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelComponentCatalog.java
b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelComponentCatalog.java
index 47ecaa7..a633b98 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelComponentCatalog.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/DefaultCamelComponentCatalog.java
@@ -42,6 +42,8 @@ public class DefaultCamelComponentCatalog implements CamelComponentCatalog
{
     private static final String COMPONENTS_JSON = "org/apache/camel/catalog/components";
     private static final String DATA_FORMATS_JSON = "org/apache/camel/catalog/dataformats";
     private static final String LANGUAGE_JSON = "org/apache/camel/catalog/languages";
+    private static final String ARCHETYPES_CATALOG = "org/apache/camel/catalog/archetypes/camel-catalog.xml";
+    private static final String SCHEMAS_XML = "org/apache/camel/catalog/schemas";
 
     @Override
     public List<String> findComponentNames() {
@@ -383,6 +385,54 @@ public class DefaultCamelComponentCatalog implements CamelComponentCatalog
{
         return answer;
     }
 
+    @Override
+    public String archetypeCatalogAsXml() {
+        String file = ARCHETYPES_CATALOG;
+
+        InputStream is = DefaultCamelComponentCatalog.class.getClassLoader().getResourceAsStream(file);
+        if (is != null) {
+            try {
+                return loadText(is);
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+
+        return null;
+    }
+
+    @Override
+    public String springSchemaAsXml() {
+        String file = SCHEMAS_XML + "/camel-spring.xsd";
+
+        InputStream is = DefaultCamelComponentCatalog.class.getClassLoader().getResourceAsStream(file);
+        if (is != null) {
+            try {
+                return loadText(is);
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+
+        return null;
+    }
+
+    @Override
+    public String blueprintSchemaAsXml() {
+        String file = SCHEMAS_XML + "/camel-blueprint.xsd";
+
+        InputStream is = DefaultCamelComponentCatalog.class.getClassLoader().getResourceAsStream(file);
+        if (is != null) {
+            try {
+                return loadText(is);
+            } catch (IOException e) {
+                // ignore
+            }
+        }
+
+        return null;
+    }
+
     /**
      * Loads the entire stream into memory as a String and returns it.
      * <p/>


Mime
View raw message