camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: CAMEL-8232: Camel Toolbox - Include documentation about data formats
Date Wed, 14 Jan 2015 08:47:07 GMT
Repository: camel
Updated Branches:
  refs/heads/master 7520551bf -> c106e0279


CAMEL-8232: Camel Toolbox - Include documentation about data formats


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

Branch: refs/heads/master
Commit: c106e0279422bfe8020ff28c1d18deaa038118b5
Parents: 7520551
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jan 14 09:40:14 2015 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jan 14 09:46:51 2015 +0100

----------------------------------------------------------------------
 .../camel/commands/AbstractCamelController.java |  6 +++++
 .../maven/packaging/PackageDataFormatMojo.java  | 26 +++++++++++++++++---
 2 files changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c106e027/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
----------------------------------------------------------------------
diff --git a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
index 585711e..1ff4805 100644
--- a/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
+++ b/platforms/commands/commands-core/src/main/java/org/apache/camel/commands/AbstractCamelController.java
@@ -173,6 +173,7 @@ public abstract class AbstractCamelController implements CamelController
{
             // - release = available from the Apache Camel release
             String status = "release";
             String type = null;
+            String modelJavaType = null;
             String groupId = null;
             String artifactId = null;
             String version = null;
@@ -185,6 +186,8 @@ public abstract class AbstractCamelController implements CamelController
{
                     label = row.get("label");
                 } else if (row.containsKey("javaType")) {
                     type = row.get("javaType");
+                } else if (row.containsKey("modelJavaType")) {
+                    modelJavaType = row.get("modelJavaType");
                 } else if (row.containsKey("groupId")) {
                     groupId = row.get("groupId");
                 } else if (row.containsKey("artifactId")) {
@@ -207,6 +210,9 @@ public abstract class AbstractCamelController implements CamelController
{
             if (type != null) {
                 row.put("type", type);
             }
+            if (modelJavaType != null) {
+                row.put("modelJavaType", modelJavaType);
+            }
             if (groupId != null) {
                 row.put("groupId", groupId);
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/c106e027/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
index b18c39c..bc986cb 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PackageDataFormatMojo.java
@@ -142,8 +142,11 @@ public class PackageDataFormatMojo extends AbstractMojo {
                 if (core != null) {
                     URL url = new URL("file", null, core.getAbsolutePath());
                     URLClassLoader loader = new URLClassLoader(new URL[]{url});
-                    for (String name : javaTypes.keySet()) {
+                    for (Map.Entry<String, String> entry : javaTypes.entrySet()) {
+                        String name = entry.getKey();
+                        String javaType = entry.getValue();
                         String modelName = asModelName(name);
+
                         InputStream is = loader.getResourceAsStream("org/apache/camel/model/dataformat/"
+ modelName + ".json");
                         if (is == null) {
                             // use file input stream if we build camel-core itself, and thus
do not have a JAR which can be loaded by URLClassLoader
@@ -154,8 +157,9 @@ public class PackageDataFormatMojo extends AbstractMojo {
                             DataFormatModel dataFormatModel = new DataFormatModel();
                             dataFormatModel.setName(name);
                             dataFormatModel.setModelName(modelName);
+                            dataFormatModel.setLabel("");
                             dataFormatModel.setDescription(project.getDescription());
-                            dataFormatModel.setJavaType(javaTypes.get(name));
+                            dataFormatModel.setJavaType(javaType);
                             dataFormatModel.setGroupId(project.getGroupId());
                             dataFormatModel.setArtifactId(project.getArtifactId());
                             dataFormatModel.setVersion(project.getVersion());
@@ -164,8 +168,9 @@ public class PackageDataFormatMojo extends AbstractMojo {
                             for (Map<String, String> row : rows) {
                                 if (row.containsKey("label")) {
                                     dataFormatModel.setLabel(row.get("label"));
-                                } else {
-                                    dataFormatModel.setLabel("");
+                                }
+                                if (row.containsKey("javaType")) {
+                                    dataFormatModel.setModelJavaType(row.get("javaType"));
                                 }
                                 // override description for camel-core, as otherwise its
too generic
                                 if ("camel-core".equals(project.getArtifactId())) {
@@ -275,6 +280,9 @@ public class PackageDataFormatMojo extends AbstractMojo {
         buffer.append("\n    \"description\": \"").append(dataFormatModel.getDescription()).append("\",");
         buffer.append("\n    \"label\": \"").append(dataFormatModel.getLabel()).append("\",");
         buffer.append("\n    \"javaType\": \"").append(dataFormatModel.getJavaType()).append("\",");
+        if (dataFormatModel.getModelJavaType() != null) {
+            buffer.append("\n    \"modelJavaType\": \"").append(dataFormatModel.getModelJavaType()).append("\",");
+        }
         buffer.append("\n    \"groupId\": \"").append(dataFormatModel.getGroupId()).append("\",");
         buffer.append("\n    \"artifactId\": \"").append(dataFormatModel.getArtifactId()).append("\",");
         buffer.append("\n    \"version\": \"").append(dataFormatModel.getVersion()).append("\"");
@@ -291,6 +299,7 @@ public class PackageDataFormatMojo extends AbstractMojo {
         private String description;
         private String label;
         private String javaType;
+        private String modelJavaType;
         private String groupId;
         private String artifactId;
         private String version;
@@ -311,6 +320,14 @@ public class PackageDataFormatMojo extends AbstractMojo {
             this.modelName = modelName;
         }
 
+        public String getModelJavaType() {
+            return modelJavaType;
+        }
+
+        public void setModelJavaType(String modelJavaType) {
+            this.modelJavaType = modelJavaType;
+        }
+
         public String getDescription() {
             return description;
         }
@@ -367,6 +384,7 @@ public class PackageDataFormatMojo extends AbstractMojo {
                     + ", description='" + description + '\''
                     + ", label='" + label + '\''
                     + ", javaType='" + javaType + '\''
+                    + ", modelJavaType='" + modelJavaType + '\''
                     + ", groupId='" + groupId + '\''
                     + ", artifactId='" + artifactId + '\''
                     + ", version='" + version + '\''


Mime
View raw message