camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/3] camel git commit: Bad bad Claus to not refactor this as well when you changed yesterday
Date Fri, 10 Mar 2017 08:21:35 GMT
Repository: camel
Updated Branches:
  refs/heads/master 0d9cb0002 -> ca6249b06


Bad bad Claus to not refactor this as well when you changed yesterday


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

Branch: refs/heads/master
Commit: ca6249b060d6ba3fd954154a5f77df4688606fa6
Parents: 1e49195
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Mar 10 09:05:14 2017 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Mar 10 09:21:26 2017 +0100

----------------------------------------------------------------------
 .../nexus/ConnectorCatalogNexusRepository.java  | 25 +++++++++++++++-----
 .../LocalFileConnectorNexusRepository.java      |  6 +++--
 2 files changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ca6249b0/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
b/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
index ce03701..39b1cd9 100644
--- a/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
+++ b/platforms/camel-catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorCatalogNexusRepository.java
@@ -82,19 +82,21 @@ public class ConnectorCatalogNexusRepository extends BaseNexusRepository
{
      * @param dto                 the artifact
      * @param name                the name of connector
      * @param scheme              the connector scheme
+     * @param javaType            the connector java type
      * @param description         the description of connector
      * @param labels              the labels of connector
      * @param connectorJson       camel-connector JSon
      * @param connectorSchemaJson camel-connector-schema JSon
+     * @param componentSchemaJson camel-component-schema JSon
      */
-    protected void addConnector(NexusArtifactDto dto, String name, String scheme, String
description, String labels,
-                                String connectorJson, String connectorSchemaJson) {
+    protected void addConnector(NexusArtifactDto dto, String name, String scheme, String
javaType, String description, String labels,
+                                String connectorJson, String connectorSchemaJson, String
componentSchemaJson) {
 
         String groupId = dto.getGroupId();
         String artifactId = dto.getArtifactId();
         String version = dto.getVersion();
 
-        camelConnectorCatalog.addConnector(groupId, artifactId, version, name, scheme, description,
labels, connectorJson, connectorSchemaJson);
+        camelConnectorCatalog.addConnector(groupId, artifactId, version, name, scheme, javaType,
description, labels, connectorJson, connectorSchemaJson, componentSchemaJson);
         log.info("Added connector: {}:{}:{}", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
     }
 
@@ -110,6 +112,7 @@ public class ConnectorCatalogNexusRepository extends BaseNexusRepository
{
                 JsonNode tree = mapper.readTree(json[0]);
                 String name = tree.get("name").textValue();
                 String scheme = tree.get("scheme").textValue();
+                String javaType = tree.get("javaType").textValue();
                 String description = tree.get("description").textValue();
                 Iterator<JsonNode> it = tree.withArray("labels").iterator();
 
@@ -119,15 +122,15 @@ public class ConnectorCatalogNexusRepository extends BaseNexusRepository
{
                     csb.append(text);
                 }
 
-                addConnector(dto, name, scheme, description, csb.toString(), json[0], json[1]);
+                addConnector(dto, name, scheme, javaType, description, csb.toString(), json[0],
json[1], json[2]);
             }
         } catch (IOException e) {
             log.warn("Error scanning JAR for custom Camel components", e);
         }
     }
 
-    private String[] loadConnectorJSonSchema(URLClassLoader classLoader) {
-        String[] answer = new String[2];
+    private String[] loadConnectorJSonSchema(ClassLoader classLoader) {
+        String[] answer = new String[3];
 
         String path = "camel-connector.json";
         try {
@@ -149,6 +152,16 @@ public class ConnectorCatalogNexusRepository extends BaseNexusRepository
{
             log.warn("Error loading " + path + " file", e);
         }
 
+        path = "camel-component-schema.json";
+        try {
+            InputStream is = classLoader.getResourceAsStream(path);
+            if (is != null) {
+                answer[2] = loadText(is);
+            }
+        } catch (Throwable e) {
+            log.warn("Error loading " + path + " file", e);
+        }
+
         return answer;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/ca6249b0/platforms/camel-catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
b/platforms/camel-catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
index 2276576..5c4760e 100644
--- a/platforms/camel-catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
+++ b/platforms/camel-catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
@@ -45,8 +45,10 @@ public class LocalFileConnectorNexusRepository extends ConnectorCatalogNexusRepo
     }
 
     @Override
-    protected void addConnector(NexusArtifactDto dto, String name, String scheme, String
description, String labels, String connectorJson, String connectorSchemaJson) {
-        super.addConnector(dto, name, scheme, description, labels, connectorJson, connectorSchemaJson);
+    protected void addConnector(NexusArtifactDto dto, String name, String scheme, String
javaType,
+                                String description, String labels,
+                                String connectorJson, String connectorSchemaJson, String
componentSchemaJson) {
+        super.addConnector(dto, name, scheme, javaType, description, labels, connectorJson,
connectorSchemaJson, componentSchemaJson);
 
         if (onAddConnector != null) {
             onAddConnector.run();


Mime
View raw message