You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/02/20 13:24:16 UTC

[1/4] camel git commit: CAMEL-10828: camel-catalog-nexus - add docs

Repository: camel
Updated Branches:
  refs/heads/master e5824c357 -> a97db7cd5


CAMEL-10828: camel-catalog-nexus - add docs


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

Branch: refs/heads/master
Commit: 5aae583a23c3802c195770cff392c1f10c865376
Parents: e5824c3
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Feb 20 11:24:11 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Feb 20 11:24:46 2017 +0100

----------------------------------------------------------------------
 platforms/catalog-nexus/readme.md | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5aae583a/platforms/catalog-nexus/readme.md
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/readme.md b/platforms/catalog-nexus/readme.md
new file mode 100644
index 0000000..8e51fa1
--- /dev/null
+++ b/platforms/catalog-nexus/readme.md
@@ -0,0 +1,24 @@
+## catalog-nexus
+
+The catalog-nexus is an extension to the Camel Catalog which can be used 
+to index a Nexus Maven repository and discover new Camel Components and
+add them to the CamelCatalog.
+
+For example to index an in-house nexus repository and allow developers to
+discover what Camel components is available.
+
+The Camel Catalog can then be used by tooling to present the list of components to developers.
+
+### Nexus
+
+The Nexus repository must provide a REST API which allows this module to query it.
+
+The url is configured on `ComponentNexusRepository` in the `nexusUrl` setter.
+
+For example if you have a nexus repository at: `http://company-nexus` then the url can be set as
+
+    http://company-nexus/service/local/data_index
+    
+The nexus repository is periodically scanner (once per minute by default).
+    
+    


[2/4] camel git commit: CAMEL-10828: camel-catalog-nexus - more work

Posted by da...@apache.org.
CAMEL-10828: camel-catalog-nexus - more work


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

Branch: refs/heads/master
Commit: d492153a9392dbf2c7cf6f54e306dcb5d320254e
Parents: 5aae583
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Feb 20 13:49:50 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Feb 20 13:54:14 2017 +0100

----------------------------------------------------------------------
 platforms/catalog-nexus/readme.md               |   2 +-
 .../nexus/ComponentCatalogNexusRepository.java  | 152 +++++++++++++++++++
 .../catalog/nexus/ComponentNexusRepository.java | 152 -------------------
 .../camel/catalog/nexus/ConnectorDataStore.java |  37 +++++
 .../ConnectorDataStoreNexusRepository.java      | 140 +++++++++++++++++
 .../camel/catalog/nexus/ConnectorDto.java       |  85 +++++++++++
 .../catalog/nexus/MemoryConnectorDataStore.java |  40 +++++
 .../camel/catalog/nexus/NexusRepository.java    |  35 -----
 ...ocalFileComponentCatalogNexusRepository.java |  57 +++++++
 .../catalog/nexus/LocalFileNexusRepository.java |  57 -------
 ...ocalNexusComponentCatalogRepositoryTest.java |  54 +++++++
 .../catalog/nexus/LocalNexusRepositoryTest.java |  54 -------
 .../org/apache/camel/catalog/CatalogHelper.java |  51 ++++++-
 13 files changed, 616 insertions(+), 300 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/readme.md
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/readme.md b/platforms/catalog-nexus/readme.md
index 8e51fa1..283fb08cbf 100644
--- a/platforms/catalog-nexus/readme.md
+++ b/platforms/catalog-nexus/readme.md
@@ -13,7 +13,7 @@ The Camel Catalog can then be used by tooling to present the list of components
 
 The Nexus repository must provide a REST API which allows this module to query it.
 
-The url is configured on `ComponentNexusRepository` in the `nexusUrl` setter.
+The url is configured on `ComponentCatalogNexusRepository` in the `nexusUrl` setter.
 
 For example if you have a nexus repository at: `http://company-nexus` then the url can be set as
 

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
new file mode 100644
index 0000000..2e606f9
--- /dev/null
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
@@ -0,0 +1,152 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.camel.catalog.CamelCatalog;
+
+import static org.apache.camel.catalog.CatalogHelper.loadText;
+
+/**
+ * Nexus repository that can scan for custom Camel components and add to the {@link org.apache.camel.catalog.CamelCatalog}.
+ */
+public class ComponentCatalogNexusRepository extends BaseNexusRepository {
+
+    public ComponentCatalogNexusRepository() {
+        super("component");
+    }
+
+    @Override
+    public void onNewArtifacts(Set<NexusArtifactDto> newArtifacts) {
+        // now download the new artifact JARs and look inside to find more details
+        for (NexusArtifactDto dto : newArtifacts) {
+            try {
+                log.debug("Processing new artifact: {}:{}:{}", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
+                String url = createArtifactURL(dto);
+                URL jarUrl = new URL(url);
+                addCustomCamelComponentsFromArtifact(dto, jarUrl);
+            } catch (Throwable e) {
+                log.warn("Error downloading component JAR " + dto.getArtifactLink() + ". This exception is ignored. " + e.getMessage());
+            }
+        }
+    }
+
+    /**
+     * Adds the component to the {@link CamelCatalog}
+     *
+     * @param dto           the artifact
+     * @param camelCatalog  the Camel Catalog
+     * @param scheme        component name
+     * @param javaType      component java class
+     * @param json          component json schema
+     */
+    protected void addComponent(NexusArtifactDto dto, CamelCatalog camelCatalog, String scheme, String javaType, String json) {
+        log.info("Added component: {}:{}:{} to Camel Catalog", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
+        camelCatalog.addComponent(scheme, javaType, json);
+    }
+
+    /**
+     * Adds any discovered third party Camel components from the artifact.
+     */
+    private void addCustomCamelComponentsFromArtifact(NexusArtifactDto dto, URL jarUrl ) {
+        try (URLClassLoader classLoader = new URLClassLoader(new URL[]{jarUrl});) {
+            // is there any custom Camel components in this library?
+            Properties properties = loadComponentProperties(classLoader);
+            if (properties != null) {
+                String components = (String) properties.get("components");
+                if (components != null) {
+                    String[] part = components.split("\\s");
+                    for (String scheme : part) {
+                        if (!getCamelCatalog().findComponentNames().contains(scheme)) {
+                            // find the class name
+                            String javaType = extractComponentJavaType(classLoader, scheme);
+                            if (javaType != null) {
+                                String json = loadComponentJSonSchema(classLoader, scheme);
+                                if (json != null) {
+                                    addComponent(dto, getCamelCatalog(), scheme, javaType, json);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        } catch (IOException e) {
+            log.warn("Error scanning JAR for custom Camel components", e);
+        }
+    }
+
+    private Properties loadComponentProperties(URLClassLoader classLoader) {
+        Properties answer = new Properties();
+        try {
+            // load the component files using the recommended way by a component.properties file
+            InputStream is = classLoader.getResourceAsStream("META-INF/services/org/apache/camel/component.properties");
+            if (is != null) {
+                answer.load(is);
+            }
+        } catch (Throwable e) {
+            log.warn("Error loading META-INF/services/org/apache/camel/component.properties file", e);
+        }
+        return answer;
+    }
+
+    private String extractComponentJavaType(URLClassLoader classLoader, String scheme) {
+        try {
+            InputStream is = classLoader.getResourceAsStream("META-INF/services/org/apache/camel/component/" + scheme);
+            if (is != null) {
+                Properties props = new Properties();
+                props.load(is);
+                return (String) props.get("class");
+            }
+        } catch (Throwable e) {
+            log.warn("Error loading META-INF/services/org/apache/camel/component/" + scheme + " file", e);
+        }
+
+        return null;
+    }
+
+    private String loadComponentJSonSchema(URLClassLoader classLoader, String scheme) {
+        String answer = null;
+
+        String path = null;
+        String javaType = extractComponentJavaType(classLoader, scheme);
+        if (javaType != null) {
+            int pos = javaType.lastIndexOf(".");
+            path = javaType.substring(0, pos);
+            path = path.replace('.', '/');
+            path = path + "/" + scheme + ".json";
+        }
+
+        if (path != null) {
+            try {
+                InputStream is = classLoader.getResourceAsStream(path);
+                if (is != null) {
+                    answer = loadText(is);
+                }
+            } catch (Throwable e) {
+                log.warn("Error loading " + path + " file", e);
+            }
+        }
+
+        return answer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java
deleted file mode 100644
index 2fb15c3..0000000
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentNexusRepository.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.catalog.nexus;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.camel.catalog.CamelCatalog;
-
-import static org.apache.camel.catalog.CatalogHelper.loadText;
-
-/**
- * Nexus repository that can scan for custom Camel components and add to the {@link org.apache.camel.catalog.CamelCatalog}.
- */
-public class ComponentNexusRepository extends BaseNexusRepository {
-
-    public ComponentNexusRepository() {
-        super("component");
-    }
-
-    @Override
-    public void onNewArtifacts(Set<NexusArtifactDto> newArtifacts) {
-        // now download the new artifact JARs and look inside to find more details
-        for (NexusArtifactDto dto : newArtifacts) {
-            try {
-                log.debug("Processing new artifact: {}:{}:{}", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
-                String url = createArtifactURL(dto);
-                URL jarUrl = new URL(url);
-                addCustomCamelComponentsFromArtifact(dto, jarUrl);
-            } catch (Throwable e) {
-                log.warn("Error downloading component JAR " + dto.getArtifactLink() + ". This exception is ignored. " + e.getMessage());
-            }
-        }
-    }
-
-    /**
-     * Adds the component to the {@link CamelCatalog}
-     *
-     * @param dto           the artifact
-     * @param camelCatalog  the Camel Catalog
-     * @param scheme        component name
-     * @param javaType      component java class
-     * @param json          component json schema
-     */
-    protected void addComponent(NexusArtifactDto dto, CamelCatalog camelCatalog, String scheme, String javaType, String json) {
-        log.info("Added component: {}:{}:{} to Camel Catalog", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
-        camelCatalog.addComponent(scheme, javaType, json);
-    }
-
-    /**
-     * Adds any discovered third party Camel components from the artifact.
-     */
-    private void addCustomCamelComponentsFromArtifact(NexusArtifactDto dto, URL jarUrl ) {
-        try (URLClassLoader classLoader = new URLClassLoader(new URL[]{jarUrl});) {
-            // is there any custom Camel components in this library?
-            Properties properties = loadComponentProperties(classLoader);
-            if (properties != null) {
-                String components = (String) properties.get("components");
-                if (components != null) {
-                    String[] part = components.split("\\s");
-                    for (String scheme : part) {
-                        if (!getCamelCatalog().findComponentNames().contains(scheme)) {
-                            // find the class name
-                            String javaType = extractComponentJavaType(classLoader, scheme);
-                            if (javaType != null) {
-                                String json = loadComponentJSonSchema(classLoader, scheme);
-                                if (json != null) {
-                                    addComponent(dto, getCamelCatalog(), scheme, javaType, json);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        } catch (IOException e) {
-            log.warn("Error scanning JAR for custom Camel components", e);
-        }
-    }
-
-    private Properties loadComponentProperties(URLClassLoader classLoader) {
-        Properties answer = new Properties();
-        try {
-            // load the component files using the recommended way by a component.properties file
-            InputStream is = classLoader.getResourceAsStream("META-INF/services/org/apache/camel/component.properties");
-            if (is != null) {
-                answer.load(is);
-            }
-        } catch (Throwable e) {
-            log.warn("Error loading META-INF/services/org/apache/camel/component.properties file", e);
-        }
-        return answer;
-    }
-
-    private String extractComponentJavaType(URLClassLoader classLoader, String scheme) {
-        try {
-            InputStream is = classLoader.getResourceAsStream("META-INF/services/org/apache/camel/component/" + scheme);
-            if (is != null) {
-                Properties props = new Properties();
-                props.load(is);
-                return (String) props.get("class");
-            }
-        } catch (Throwable e) {
-            log.warn("Error loading META-INF/services/org/apache/camel/component/" + scheme + " file", e);
-        }
-
-        return null;
-    }
-
-    private String loadComponentJSonSchema(URLClassLoader classLoader, String scheme) {
-        String answer = null;
-
-        String path = null;
-        String javaType = extractComponentJavaType(classLoader, scheme);
-        if (javaType != null) {
-            int pos = javaType.lastIndexOf(".");
-            path = javaType.substring(0, pos);
-            path = path.replace('.', '/');
-            path = path + "/" + scheme + ".json";
-        }
-
-        if (path != null) {
-            try {
-                InputStream is = classLoader.getResourceAsStream(path);
-                if (is != null) {
-                    answer = loadText(is);
-                }
-            } catch (Throwable e) {
-                log.warn("Error loading " + path + " file", e);
-            }
-        }
-
-        return answer;
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java
new file mode 100644
index 0000000..68c9858
--- /dev/null
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.util.List;
+
+public interface ConnectorDataStore {
+
+    /**
+     * Adds a connector to the data store.
+     */
+    void addConnector(ConnectorDto connector);
+
+    /**
+     * Search for connectors in the data store.
+     *
+     * @param filter            the filter connectors based on their names, description or labels.
+     * @param latestVersionOnly to only include the latest version of a given Maven <tt>groupId:artifactId</tt>
+     * @return the found connectors, or an empty list if none found
+     */
+    List<ConnectorDto> searchArtifacts(String filter, boolean latestVersionOnly);
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java
new file mode 100644
index 0000000..50e0190
--- /dev/null
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java
@@ -0,0 +1,140 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Set;
+
+import org.apache.camel.catalog.CatalogHelper;
+
+import static org.apache.camel.catalog.CatalogHelper.loadText;
+
+/**
+ * Nexus repository that can scan for custom Camel connectors and add to the {@link ConnectorDataStore}.
+ */
+public class ConnectorDataStoreNexusRepository extends BaseNexusRepository {
+
+    private ConnectorDataStore connectorDataStore;
+
+    public ConnectorDataStoreNexusRepository() {
+        super("connector");
+    }
+
+    public ConnectorDataStore getConnectorDataStore() {
+        return connectorDataStore;
+    }
+
+    public void setConnectorDataStore(ConnectorDataStore connectorDataStore) {
+        this.connectorDataStore = connectorDataStore;
+    }
+
+    @Override
+    public void onNewArtifacts(Set<NexusArtifactDto> newArtifacts) {
+        // now download the new artifact JARs and look inside to find more details
+        for (NexusArtifactDto dto : newArtifacts) {
+            try {
+                log.debug("Processing new artifact: {}:{}:{}", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
+                String url = createArtifactURL(dto);
+                URL jarUrl = new URL(url);
+                addCustomCamelConnectorFromArtifact(dto, jarUrl);
+            } catch (Throwable e) {
+                log.warn("Error downloading connector JAR " + dto.getArtifactLink() + ". This exception is ignored. " + e.getMessage());
+            }
+        }
+    }
+
+    /**
+     * Adds the connector to the data store
+     *
+     * @param dto                 the artifact
+     * @param name                name of connector
+     * @param connectorJson       camel-connector JSon
+     * @param connectorSchemaJson camel-connector-schema JSon
+     */
+    protected void addConnector(NexusArtifactDto dto, String name, String connectorJson, String connectorSchemaJson) {
+        if (connectorDataStore != null) {
+            ConnectorDto connector = new ConnectorDto(dto, name, connectorJson, connectorSchemaJson);
+            log.info("Added connector: {}:{}:{}", dto.getGroupId(), dto.getArtifactId(), dto.getVersion());
+            connectorDataStore.addConnector(connector);
+        }
+    }
+
+    /**
+     * Adds any discovered third party Camel connectors from the artifact.
+     */
+    private void addCustomCamelConnectorFromArtifact(NexusArtifactDto dto, URL jarUrl) {
+        try (URLClassLoader classLoader = new URLClassLoader(new URL[] {jarUrl});) {
+            String[] json = loadConnectorJSonSchema(classLoader);
+            if (json != null) {
+                addConnector(dto, 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[3];
+
+        String path = "camel-connector.json";
+        try {
+            InputStream is = classLoader.getResourceAsStream(path);
+            if (is != null) {
+                answer[1] = loadText(is);
+            }
+        } catch (Throwable e) {
+            log.warn("Error loading " + path + " file", e);
+        }
+
+        path = "camel-connector-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);
+        }
+
+        String name = extractConnectorName(answer[1]);
+        answer[0] = name;
+
+        return answer;
+    }
+
+    /**
+     * Extracts the name of the connector from the json blob
+     */
+    private static String extractConnectorName(String json) {
+        String[] lines = json.split("\n");
+        for (String line : lines) {
+            line = line.trim();
+            if (line.startsWith("\"name\":")) {
+                String name = CatalogHelper.after(line, ":");
+                if (name != null) {
+                    name = name.trim();
+                    return CatalogHelper.removeLeadingAndEndingQuotes(name);
+                }
+            }
+        }
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java
new file mode 100644
index 0000000..1aa2b98
--- /dev/null
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java
@@ -0,0 +1,85 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.io.Serializable;
+
+public class ConnectorDto implements Serializable {
+
+    private NexusArtifactDto nexusArtifactDto;
+    private String name;
+    private String connectorJson;
+    private String connectorSchemaJson;
+
+    public ConnectorDto(NexusArtifactDto nexusArtifactDto, String name, String connectorJson, String connectorSchemaJson) {
+        this.nexusArtifactDto = nexusArtifactDto;
+        this.name = name;
+        this.connectorJson = connectorJson;
+        this.connectorSchemaJson = connectorSchemaJson;
+    }
+
+    public NexusArtifactDto getNexusArtifactDto() {
+        return nexusArtifactDto;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getConnectorJson() {
+        return connectorJson;
+    }
+
+    public String getConnectorSchemaJson() {
+        return connectorSchemaJson;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        ConnectorDto that = (ConnectorDto) o;
+
+        if (!nexusArtifactDto.equals(that.nexusArtifactDto)) {
+            return false;
+        }
+        return name.equals(that.name);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = nexusArtifactDto.hashCode();
+        result = 31 * result + name.hashCode();
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectorDto[" +
+            "groupId='" + nexusArtifactDto.getGroupId() + '\'' +
+            ", artifactId='" + nexusArtifactDto.getArtifactId() + '\'' +
+            ", version='" + nexusArtifactDto.getVersion() + '\'' +
+            ", name='" + name + '\'' +
+            ']';
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java
new file mode 100644
index 0000000..b78e96a
--- /dev/null
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A in-memory based {@link ConnectorDataStore}.
+ */
+public class MemoryConnectorDataStore implements ConnectorDataStore {
+
+    private final Set<ConnectorDto> connectors = new LinkedHashSet<>();
+
+    @Override
+    public void addConnector(ConnectorDto connector) {
+        connectors.add(connector);
+    }
+
+    @Override
+    public List<ConnectorDto> searchArtifacts(String filter, boolean latestVersionOnly) {
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusRepository.java
deleted file mode 100644
index 153df3a..0000000
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusRepository.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.catalog.nexus;
-
-import java.util.List;
-
-/**
- * Nexus repository
- */
-public interface NexusRepository {
-
-    /**
-     * Search for new artifacts in the Nexus repository.
-     *
-     * @param filter the filter artifacts
-     * @param latestVersionOnly to only include the latest version of a given Maven <tt>groupId:artifactId</tt>
-     * @return the found artifacts
-     */
-    List<NexusArtifactDto> searchArtifacts(String filter, boolean latestVersionOnly);
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
new file mode 100644
index 0000000..6d18289
--- /dev/null
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.camel.catalog.CamelCatalog;
+
+public class LocalFileComponentCatalogNexusRepository extends ComponentCatalogNexusRepository {
+
+    private Runnable onAddComponent;
+
+    public Runnable getOnAddComponent() {
+        return onAddComponent;
+    }
+
+    public void setOnAddComponent(Runnable onAddComponent) {
+        this.onAddComponent = onAddComponent;
+    }
+
+    @Override
+    protected URL createNexusUrl() throws MalformedURLException {
+        File file = new File("target/test-classes/nexus-sample-result.xml");
+        return new URL("file:" + file.getAbsolutePath());
+    }
+
+    @Override
+    protected String createArtifactURL(NexusArtifactDto dto) {
+        // load from local file instead
+        return "file:target/localrepo/" + dto.getArtifactId() + "-" + dto.getVersion() + ".jar";
+    }
+
+    @Override
+    protected void addComponent(NexusArtifactDto dto, CamelCatalog camelCatalog, String scheme, String javaType, String json) {
+        super.addComponent(dto, camelCatalog, scheme, javaType, json);
+
+        if (onAddComponent != null) {
+            onAddComponent.run();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
deleted file mode 100644
index 3a05b5f..0000000
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileNexusRepository.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.catalog.nexus;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.camel.catalog.CamelCatalog;
-
-public class LocalFileNexusRepository extends ComponentNexusRepository {
-
-    private Runnable onAddComponent;
-
-    public Runnable getOnAddComponent() {
-        return onAddComponent;
-    }
-
-    public void setOnAddComponent(Runnable onAddComponent) {
-        this.onAddComponent = onAddComponent;
-    }
-
-    @Override
-    protected URL createNexusUrl() throws MalformedURLException {
-        File file = new File("target/test-classes/nexus-sample-result.xml");
-        return new URL("file:" + file.getAbsolutePath());
-    }
-
-    @Override
-    protected String createArtifactURL(NexusArtifactDto dto) {
-        // load from local file instead
-        return "file:target/localrepo/" + dto.getArtifactId() + "-" + dto.getVersion() + ".jar";
-    }
-
-    @Override
-    protected void addComponent(NexusArtifactDto dto, CamelCatalog camelCatalog, String scheme, String javaType, String json) {
-        super.addComponent(dto, camelCatalog, scheme, javaType, json);
-
-        if (onAddComponent != null) {
-            onAddComponent.run();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java
new file mode 100644
index 0000000..454bfdf
--- /dev/null
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+import org.apache.camel.catalog.CamelCatalog;
+import org.apache.camel.catalog.DefaultCamelCatalog;
+import org.junit.Test;
+
+public class LocalNexusComponentCatalogRepositoryTest extends TestCase {
+
+    private final CamelCatalog catalog = new DefaultCamelCatalog();
+
+    @Test
+    public void testLocalNexus() throws Exception {
+        int before = catalog.findComponentNames().size();
+
+        LocalFileComponentCatalogNexusRepository repo = new LocalFileComponentCatalogNexusRepository();
+        repo.setCamelCatalog(catalog);
+        repo.setInitialDelay(2);
+        repo.setDelay(3);
+        repo.setNexusUrl("dummy");
+
+        final CountDownLatch latch = new CountDownLatch(1);
+        repo.setOnAddComponent(latch::countDown);
+
+        repo.start();
+
+        assertTrue("Should have found component", latch.await(10, TimeUnit.SECONDS));
+
+        repo.stop();
+
+        int after = catalog.findComponentNames().size();
+
+        assertTrue("There should be 1 component found", after - before == 1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
deleted file mode 100644
index 4c8a8c0..0000000
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusRepositoryTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.catalog.nexus;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import junit.framework.TestCase;
-import org.apache.camel.catalog.CamelCatalog;
-import org.apache.camel.catalog.DefaultCamelCatalog;
-import org.junit.Test;
-
-public class LocalNexusRepositoryTest extends TestCase {
-
-    private final CamelCatalog catalog = new DefaultCamelCatalog();
-
-    @Test
-    public void testLocalNexus() throws Exception {
-        int before = catalog.findComponentNames().size();
-
-        LocalFileNexusRepository repo = new LocalFileNexusRepository();
-        repo.setCamelCatalog(catalog);
-        repo.setInitialDelay(2);
-        repo.setDelay(3);
-        repo.setNexusUrl("dummy");
-
-        final CountDownLatch latch = new CountDownLatch(1);
-        repo.setOnAddComponent(latch::countDown);
-
-        repo.start();
-
-        assertTrue("Should have found component", latch.await(10, TimeUnit.SECONDS));
-
-        repo.stop();
-
-        int after = catalog.findComponentNames().size();
-
-        assertTrue("There should be 1 component found", after - before == 1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/d492153a/platforms/catalog/src/main/java/org/apache/camel/catalog/CatalogHelper.java
----------------------------------------------------------------------
diff --git a/platforms/catalog/src/main/java/org/apache/camel/catalog/CatalogHelper.java b/platforms/catalog/src/main/java/org/apache/camel/catalog/CatalogHelper.java
index 2ce8089..f7c0072 100644
--- a/platforms/catalog/src/main/java/org/apache/camel/catalog/CatalogHelper.java
+++ b/platforms/catalog/src/main/java/org/apache/camel/catalog/CatalogHelper.java
@@ -28,7 +28,6 @@ public final class CatalogHelper {
     private CatalogHelper() {
     }
 
-
     /**
      * Loads the entire stream into memory as a String and returns it.
      * <p/>
@@ -143,4 +142,54 @@ public final class CatalogHelper {
         return before(text, before);
     }
 
+    /**
+     * Tests whether the value is <tt>null</tt> or an empty string.
+     *
+     * @param value  the value, if its a String it will be tested for text length as well
+     * @return true if empty
+     */
+    public static boolean isEmpty(Object value) {
+        return !isNotEmpty(value);
+    }
+
+    /**
+     * Tests whether the value is <b>not</b> <tt>null</tt> or an empty string.
+     *
+     * @param value  the value, if its a String it will be tested for text length as well
+     * @return true if <b>not</b> empty
+     */
+    public static boolean isNotEmpty(Object value) {
+        if (value == null) {
+            return false;
+        } else if (value instanceof String) {
+            String text = (String) value;
+            return text.trim().length() > 0;
+        } else {
+            return true;
+        }
+    }
+
+    /**
+     * Removes all leading and ending quotes (single and double) from the string
+     *
+     * @param s  the string
+     * @return the string without leading and ending quotes (single and double)
+     */
+    public static String removeLeadingAndEndingQuotes(String s) {
+        if (isEmpty(s)) {
+            return s;
+        }
+
+        String copy = s.trim();
+        if (copy.startsWith("'") && copy.endsWith("'")) {
+            return copy.substring(1, copy.length() - 1);
+        }
+        if (copy.startsWith("\"") && copy.endsWith("\"")) {
+            return copy.substring(1, copy.length() - 1);
+        }
+
+        // no quotes, so return as-is
+        return s;
+    }
+
 }


[3/4] camel git commit: CAMEL-10828: camel-catalog-nexus - more work

Posted by da...@apache.org.
CAMEL-10828: camel-catalog-nexus - more work


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

Branch: refs/heads/master
Commit: 8d4a41f88503d004bf4fb8ff6d13fc8afe05221c
Parents: d492153
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Feb 20 14:19:10 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Feb 20 14:19:10 2017 +0100

----------------------------------------------------------------------
 platforms/catalog-nexus/pom.xml                 |   6 +
 .../catalog/nexus/BaseNexusRepository.java      |  13 --
 .../nexus/ComponentCatalogNexusRepository.java  |  19 +++
 .../camel/catalog/nexus/ConnectorDataStore.java |   5 +
 .../ConnectorDataStoreNexusRepository.java      |  13 ++
 .../catalog/nexus/MemoryConnectorDataStore.java |   6 +-
 ...ocalFileComponentCatalogNexusRepository.java |   2 +-
 .../LocalFileConnectorNexusRepository.java      |  55 ++++++++
 .../LocalNexusConnectorRepositoryTest.java      |  53 +++++++
 .../resources/nexus-sample-component-result.xml |  37 +++++
 .../resources/nexus-sample-connector-result.xml |  37 +++++
 .../src/test/resources/nexus-sample-result.xml  |  37 -----
 platforms/myfoo-connector/pom.xml               | 138 +++++++++++++++++++
 .../org/myfoo/connector/MyFooComponent.java     |  27 ++++
 .../services/org/apache/camel/component/my-foo  |  18 +++
 .../main/resources/camel-connector-schema.json  |  26 ++++
 .../src/main/resources/camel-connector.json     |  21 +++
 platforms/pom.xml                               |   3 +-
 18 files changed, 463 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/pom.xml b/platforms/catalog-nexus/pom.xml
index a3653bf..bb0d970 100644
--- a/platforms/catalog-nexus/pom.xml
+++ b/platforms/catalog-nexus/pom.xml
@@ -111,6 +111,12 @@
                     <include>*.jar</include>
                   </includes>
                 </resource>
+                <resource>
+                  <directory>../myfoo-connector/target</directory>
+                  <includes>
+                    <include>*.jar</include>
+                  </includes>
+                </resource>
               </resources>
             </configuration>
           </execution>

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
index 02cd8c7..8e7653e 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
@@ -49,7 +49,6 @@ public abstract class BaseNexusRepository {
     private volatile ScheduledExecutorService executorService;
     private AtomicBoolean started = new AtomicBoolean();
 
-    private CamelCatalog camelCatalog;
     private int initialDelay = 10;
     private int delay = 60;
     private String nexusUrl = "http://nexus/service/local/data_index";
@@ -59,14 +58,6 @@ public abstract class BaseNexusRepository {
         this.classifier = classifier;
     }
 
-    public CamelCatalog getCamelCatalog() {
-        return camelCatalog;
-    }
-
-    public void setCamelCatalog(CamelCatalog camelCatalog) {
-        this.camelCatalog = camelCatalog;
-    }
-
     public String getNexusUrl() {
         return nexusUrl;
     }
@@ -116,10 +107,6 @@ public abstract class BaseNexusRepository {
      * Starts the Nexus indexer.
      */
     public void start() {
-        if (camelCatalog == null) {
-            throw new IllegalArgumentException("CamelCatalog must be configured");
-        }
-
         if (nexusUrl == null || nexusUrl.isEmpty()) {
             log.warn("Nexus service not found. Indexing Nexus is not enabled!");
             return;

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
index 2e606f9..03844b1 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
@@ -32,10 +32,29 @@ import static org.apache.camel.catalog.CatalogHelper.loadText;
  */
 public class ComponentCatalogNexusRepository extends BaseNexusRepository {
 
+    private CamelCatalog camelCatalog;
+
     public ComponentCatalogNexusRepository() {
         super("component");
     }
 
+    public CamelCatalog getCamelCatalog() {
+        return camelCatalog;
+    }
+
+    public void setCamelCatalog(CamelCatalog camelCatalog) {
+        this.camelCatalog = camelCatalog;
+    }
+
+    @Override
+    public void start() {
+        if (camelCatalog == null) {
+            throw new IllegalArgumentException("CamelCatalog must be configured");
+        }
+
+        super.start();
+    }
+
     @Override
     public void onNewArtifacts(Set<NexusArtifactDto> newArtifacts) {
         // now download the new artifact JARs and look inside to find more details

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java
index 68c9858..b1daa7a 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStore.java
@@ -34,4 +34,9 @@ public interface ConnectorDataStore {
      */
     List<ConnectorDto> searchArtifacts(String filter, boolean latestVersionOnly);
 
+    /**
+     * Number of connectors in the data store.
+     */
+    int size();
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java
index 50e0190..3e7426a 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDataStoreNexusRepository.java
@@ -46,6 +46,15 @@ public class ConnectorDataStoreNexusRepository extends BaseNexusRepository {
     }
 
     @Override
+    public void start() {
+        if (connectorDataStore == null) {
+            throw new IllegalArgumentException("ConnectorDataStore must be configured");
+        }
+
+        super.start();
+    }
+
+    @Override
     public void onNewArtifacts(Set<NexusArtifactDto> newArtifacts) {
         // now download the new artifact JARs and look inside to find more details
         for (NexusArtifactDto dto : newArtifacts) {
@@ -130,6 +139,10 @@ public class ConnectorDataStoreNexusRepository extends BaseNexusRepository {
                 String name = CatalogHelper.after(line, ":");
                 if (name != null) {
                     name = name.trim();
+                    if (name.endsWith(",")) {
+                        // skip last comma
+                        name = name.substring(0, name.length() - 1);
+                    }
                     return CatalogHelper.removeLeadingAndEndingQuotes(name);
                 }
             }

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java
index b78e96a..e3d5995 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/MemoryConnectorDataStore.java
@@ -34,7 +34,11 @@ public class MemoryConnectorDataStore implements ConnectorDataStore {
 
     @Override
     public List<ConnectorDto> searchArtifacts(String filter, boolean latestVersionOnly) {
-
         return null;
     }
+
+    @Override
+    public int size() {
+        return connectors.size();
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
index 6d18289..4327166 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
@@ -36,7 +36,7 @@ public class LocalFileComponentCatalogNexusRepository extends ComponentCatalogNe
 
     @Override
     protected URL createNexusUrl() throws MalformedURLException {
-        File file = new File("target/test-classes/nexus-sample-result.xml");
+        File file = new File("target/test-classes/nexus-sample-component-result.xml");
         return new URL("file:" + file.getAbsolutePath());
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
new file mode 100644
index 0000000..00d1c6a
--- /dev/null
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class LocalFileConnectorNexusRepository extends ConnectorDataStoreNexusRepository {
+
+    private Runnable onAddConnector;
+
+    public Runnable getOnAddConnector() {
+        return onAddConnector;
+    }
+
+    public void setOnAddConnector(Runnable onAddConnector) {
+        this.onAddConnector = onAddConnector;
+    }
+
+    @Override
+    protected URL createNexusUrl() throws MalformedURLException {
+        File file = new File("target/test-classes/nexus-sample-connector-result.xml");
+        return new URL("file:" + file.getAbsolutePath());
+    }
+
+    @Override
+    protected String createArtifactURL(NexusArtifactDto dto) {
+        // load from local file instead
+        return "file:target/localrepo/" + dto.getArtifactId() + "-" + dto.getVersion() + ".jar";
+    }
+
+    @Override
+    protected void addConnector(NexusArtifactDto dto, String name, String connectorJson, String connectorSchemaJson) {
+        super.addConnector(dto, name, connectorJson, connectorSchemaJson);
+
+        if (onAddConnector != null) {
+            onAddConnector.run();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java
new file mode 100644
index 0000000..b415cfd
--- /dev/null
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.catalog.nexus;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+import org.junit.Test;
+
+public class LocalNexusConnectorRepositoryTest extends TestCase {
+
+    private MemoryConnectorDataStore dataStore = new MemoryConnectorDataStore();
+
+    @Test
+    public void testLocalNexus() throws Exception {
+        LocalFileConnectorNexusRepository repo = new LocalFileConnectorNexusRepository();
+        repo.setInitialDelay(2);
+        repo.setDelay(3);
+        repo.setNexusUrl("dummy");
+        repo.setConnectorDataStore(dataStore);
+
+        final CountDownLatch latch = new CountDownLatch(1);
+        repo.setOnAddConnector(latch::countDown);
+
+        int before = dataStore.size();
+
+        repo.start();
+
+        assertTrue("Should have found connector", latch.await(10, TimeUnit.SECONDS));
+
+        repo.stop();
+
+        int after = dataStore.size();
+
+        assertTrue("There should be 1 connector found", after - before == 1);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/test/resources/nexus-sample-component-result.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/resources/nexus-sample-component-result.xml b/platforms/catalog-nexus/src/test/resources/nexus-sample-component-result.xml
new file mode 100644
index 0000000..aae70b6
--- /dev/null
+++ b/platforms/catalog-nexus/src/test/resources/nexus-sample-component-result.xml
@@ -0,0 +1,37 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<search-results>
+  <totalCount>1</totalCount>
+  <from>-1</from>
+  <count>-1</count>
+  <tooManyResults>false</tooManyResults>
+  <data>
+    <artifact>
+      <resourceURI>http://nexus.dummy/service/local/repositories/staging/content/org/apache/camel/dummy-component/${project.version}/dummy-component-${project.version}.jar</resourceURI>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>dummy-component</artifactId>
+      <version>${project.version}</version>
+      <packaging>jar</packaging>
+      <extension>jar</extension>
+      <repoId>staging</repoId>
+      <contextId>Staging</contextId>
+      <pomLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&amp;g=org.apache.camel&amp;a=dummy-component&amp;v=${project.version}&amp;e=pom</pomLink>
+      <artifactLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&amp;g=org.apache.camel&amp;a=dummy-component&amp;v=${project.version}&amp;e=jar</artifactLink>
+      <highlightedFragment>&lt;blockquote&gt;Artifact ID&lt;UL&gt;&lt;LI&gt;dummy-&lt;B&gt;component&lt;/B&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/blockquote&gt;</highlightedFragment>
+    </artifact>
+  </data>
+</search-results>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/test/resources/nexus-sample-connector-result.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/resources/nexus-sample-connector-result.xml b/platforms/catalog-nexus/src/test/resources/nexus-sample-connector-result.xml
new file mode 100644
index 0000000..05173b5
--- /dev/null
+++ b/platforms/catalog-nexus/src/test/resources/nexus-sample-connector-result.xml
@@ -0,0 +1,37 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<search-results>
+  <totalCount>1</totalCount>
+  <from>-1</from>
+  <count>-1</count>
+  <tooManyResults>false</tooManyResults>
+  <data>
+    <artifact>
+      <resourceURI>http://nexus.dummy/service/local/repositories/staging/content/org/apache/camel/myfoo-connector/${project.version}/myfoo-connector-${project.version}.jar</resourceURI>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>myfoo-connector</artifactId>
+      <version>${project.version}</version>
+      <packaging>jar</packaging>
+      <extension>jar</extension>
+      <repoId>staging</repoId>
+      <contextId>Staging</contextId>
+      <pomLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&amp;g=org.apache.camel&amp;a=myfoo-connector&amp;v=${project.version}&amp;e=pom</pomLink>
+      <artifactLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&amp;g=org.apache.camel&amp;a=myfoo-connector&amp;v=${project.version}&amp;e=jar</artifactLink>
+      <highlightedFragment>&lt;blockquote&gt;Artifact ID&lt;UL&gt;&lt;LI&gt;myfoo-&lt;B&gt;connector&lt;/B&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/blockquote&gt;</highlightedFragment>
+    </artifact>
+  </data>
+</search-results>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml b/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
deleted file mode 100644
index aae70b6..0000000
--- a/platforms/catalog-nexus/src/test/resources/nexus-sample-result.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<search-results>
-  <totalCount>1</totalCount>
-  <from>-1</from>
-  <count>-1</count>
-  <tooManyResults>false</tooManyResults>
-  <data>
-    <artifact>
-      <resourceURI>http://nexus.dummy/service/local/repositories/staging/content/org/apache/camel/dummy-component/${project.version}/dummy-component-${project.version}.jar</resourceURI>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>dummy-component</artifactId>
-      <version>${project.version}</version>
-      <packaging>jar</packaging>
-      <extension>jar</extension>
-      <repoId>staging</repoId>
-      <contextId>Staging</contextId>
-      <pomLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&amp;g=org.apache.camel&amp;a=dummy-component&amp;v=${project.version}&amp;e=pom</pomLink>
-      <artifactLink>http://nexus.dummy/service/local/artifact/maven/redirect?r=staging&amp;g=org.apache.camel&amp;a=dummy-component&amp;v=${project.version}&amp;e=jar</artifactLink>
-      <highlightedFragment>&lt;blockquote&gt;Artifact ID&lt;UL&gt;&lt;LI&gt;dummy-&lt;B&gt;component&lt;/B&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/blockquote&gt;</highlightedFragment>
-    </artifact>
-  </data>
-</search-results>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/myfoo-connector/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/myfoo-connector/pom.xml b/platforms/myfoo-connector/pom.xml
new file mode 100644
index 0000000..a63e079
--- /dev/null
+++ b/platforms/myfoo-connector/pom.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>platforms</artifactId>
+    <version>2.19.0-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>myfoo-connector</artifactId>
+  <name>Camel :: Platforms :: My Foo Connector</name>
+  <description>Camel My Foo Connector</description>
+  <packaging>jar</packaging>
+
+  <dependencies>
+
+    <!-- base component to use for this connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- camel-connector -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-connector</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- support camel documentation -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>apt</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>${maven-compiler-plugin-version}</version>
+        <configuration>
+          <source>1.8</source>
+          <target>1.8</target>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>${maven-resources-plugin-version}</version>
+        <configuration>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+
+      <!-- generate components meta-data and validate component includes documentation etc -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-package-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>prepare</id>
+            <goals>
+              <goal>prepare-components</goal>
+            </goals>
+            <phase>generate-resources</phase>
+          </execution>
+          <execution>
+            <id>validate</id>
+            <goals>
+              <goal>validate-components</goal>
+            </goals>
+            <phase>prepare-package</phase>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- turn off jar plugin as we use connector plugin to jar instead -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>${maven-jar-plugin-version}</version>
+        <executions>
+          <execution>
+            <id>default-jar</id>
+            <phase/>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- connector plugin will build the jar -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-connector-maven-plugin</artifactId>
+        <version>${project.version}</version>
+        <executions>
+          <execution>
+            <id>connector</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+    </plugins>
+  </build>
+  
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/myfoo-connector/src/main/java/org/myfoo/connector/MyFooComponent.java
----------------------------------------------------------------------
diff --git a/platforms/myfoo-connector/src/main/java/org/myfoo/connector/MyFooComponent.java b/platforms/myfoo-connector/src/main/java/org/myfoo/connector/MyFooComponent.java
new file mode 100644
index 0000000..1817f9f
--- /dev/null
+++ b/platforms/myfoo-connector/src/main/java/org/myfoo/connector/MyFooComponent.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.myfoo.connector;
+
+import org.apache.camel.component.connector.DefaultConnectorComponent;
+
+public class MyFooComponent extends DefaultConnectorComponent {
+
+    public MyFooComponent() {
+        super("myfoo", "org.myfoo.connector.MyFooComponent");
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/myfoo-connector/src/main/resources/META-INF/services/org/apache/camel/component/my-foo
----------------------------------------------------------------------
diff --git a/platforms/myfoo-connector/src/main/resources/META-INF/services/org/apache/camel/component/my-foo b/platforms/myfoo-connector/src/main/resources/META-INF/services/org/apache/camel/component/my-foo
new file mode 100644
index 0000000..6a0b504
--- /dev/null
+++ b/platforms/myfoo-connector/src/main/resources/META-INF/services/org/apache/camel/component/my-foo
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+class=org.myfoo.connector.MyFooComponent
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/myfoo-connector/src/main/resources/camel-connector-schema.json
----------------------------------------------------------------------
diff --git a/platforms/myfoo-connector/src/main/resources/camel-connector-schema.json b/platforms/myfoo-connector/src/main/resources/camel-connector-schema.json
new file mode 100644
index 0000000..7bdf1c9
--- /dev/null
+++ b/platforms/myfoo-connector/src/main/resources/camel-connector-schema.json
@@ -0,0 +1,26 @@
+{
+  "component": {
+    "kind": "component",
+    "baseScheme": "timer",
+    "scheme": "my-foo",
+    "syntax": "my-foo:timerName",
+    "title": "MyFoo",
+    "description": "Something cool",
+    "label": "foo,timer",
+    "deprecated": false,
+    "async": false,
+    "consumerOnly": true,
+    "lenientProperties": false,
+    "javaType": "org.myfoo.connector.MyFooComponent",
+    "groupId": "org.apache.camel",
+    "artifactId": "myfoo-connector",
+    "version": "2.19.0-SNAPSHOT"
+  },
+  "componentProperties": {
+  },
+  "properties": {
+    "timerName": { "kind": "path", "displayName": "Timer Name", "group": "consumer", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The name of the timer" },
+    "period": { "kind": "parameter", "displayName": "Period", "group": "consumer", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "secret": false, "defaultValue": 5000, "description": "If greater than 0 generate periodic events every period milliseconds. The default value is 1000. You can also specify time values using units such as 60s (60 seconds) 5m30s (5 minutes and 30 seconds) and 1h (1 hour)." },
+    "repeatCount": { "kind": "parameter", "displayName": "Repeat Count", "group": "consumer", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "secret": false, "defaultValue": 0, "description": "Specifies a maximum limit of number of fires. So if you set it to 1 the timer will only fire once. If you set it to 5 it will only fire five times. A value of zero or negative means fire forever." }
+  }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/myfoo-connector/src/main/resources/camel-connector.json
----------------------------------------------------------------------
diff --git a/platforms/myfoo-connector/src/main/resources/camel-connector.json b/platforms/myfoo-connector/src/main/resources/camel-connector.json
new file mode 100644
index 0000000..116f48e
--- /dev/null
+++ b/platforms/myfoo-connector/src/main/resources/camel-connector.json
@@ -0,0 +1,21 @@
+{
+  "baseScheme": "timer",
+  "baseGroupId": "org.apache.camel",
+  "baseArtifactId": "camel-core",
+  "baseVersion": "2.19.0-SNAPSHOT",
+  "baseJavaType": "org.apache.camel.component.timer.TimerComponent",
+  "name": "MyFoo",
+  "scheme": "my-foo",
+  "javaType": "org.myfoo.connector.MyFooComponent",
+  "groupId": "org.myfoo",
+  "artifactId": "myfoo-connector",
+  "version": "2.19.0-SNAPSHOT",
+  "description": "Something cool",
+  "labels": [ "foo", "timer" ],
+  "pattern": "From",
+  "endpointOptions": [ "timerName", "period", "repeatCount" ],
+  "endpointValues": {
+    "fixedRate": true,
+    "period": 5000
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/8d4a41f8/platforms/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/pom.xml b/platforms/pom.xml
index 7aa34b9..245768c 100644
--- a/platforms/pom.xml
+++ b/platforms/pom.xml
@@ -35,8 +35,9 @@
     <module>commands</module>
     <module>karaf</module>
     <module>spring-boot</module>
-    <!-- dummy used for testing catalog -->
+    <!-- dummy/myfoo used for testing catalog -->
     <module>dummy-component</module>
+    <module>myfoo-connector</module>
     <!-- run catalog last -->
     <module>catalog</module>
     <module>catalog-provider-karaf</module>


[4/4] camel git commit: Fixed CS

Posted by da...@apache.org.
Fixed CS


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

Branch: refs/heads/master
Commit: a97db7cd5d0fae6455d2e1e6c994b7477a220fca
Parents: 8d4a41f
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Feb 20 14:21:25 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Feb 20 14:23:51 2017 +0100

----------------------------------------------------------------------
 .../apache/camel/catalog/nexus/BaseNexusRepository.java |  6 +++---
 .../catalog/nexus/ComponentCatalogNexusRepository.java  |  4 ++--
 .../org/apache/camel/catalog/nexus/ConnectorDto.java    | 12 ++++++------
 .../apache/camel/catalog/nexus/NexusArtifactDto.java    | 12 ++++++------
 .../nexus/LocalFileComponentCatalogNexusRepository.java |  6 +++---
 .../nexus/LocalFileConnectorNexusRepository.java        |  6 +++---
 .../nexus/LocalNexusComponentCatalogRepositoryTest.java |  6 +++---
 .../nexus/LocalNexusConnectorRepositoryTest.java        |  6 +++---
 8 files changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
index 8e7653e..6dd8347 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/BaseNexusRepository.java
@@ -33,13 +33,13 @@ import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathFactory;
 
-import org.apache.camel.catalog.CamelCatalog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public abstract class BaseNexusRepository {
 
     final Logger log = LoggerFactory.getLogger(getClass());

http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
index 03844b1..152b058 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ComponentCatalogNexusRepository.java
@@ -87,8 +87,8 @@ public class ComponentCatalogNexusRepository extends BaseNexusRepository {
     /**
      * Adds any discovered third party Camel components from the artifact.
      */
-    private void addCustomCamelComponentsFromArtifact(NexusArtifactDto dto, URL jarUrl ) {
-        try (URLClassLoader classLoader = new URLClassLoader(new URL[]{jarUrl});) {
+    private void addCustomCamelComponentsFromArtifact(NexusArtifactDto dto, URL jarUrl) {
+        try (URLClassLoader classLoader = new URLClassLoader(new URL[]{jarUrl})) {
             // is there any custom Camel components in this library?
             Properties properties = loadComponentProperties(classLoader);
             if (properties != null) {

http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java
index 1aa2b98..0c66ba8 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/ConnectorDto.java
@@ -74,12 +74,12 @@ public class ConnectorDto implements Serializable {
 
     @Override
     public String toString() {
-        return "ConnectorDto[" +
-            "groupId='" + nexusArtifactDto.getGroupId() + '\'' +
-            ", artifactId='" + nexusArtifactDto.getArtifactId() + '\'' +
-            ", version='" + nexusArtifactDto.getVersion() + '\'' +
-            ", name='" + name + '\'' +
-            ']';
+        return "ConnectorDto["
+            + "groupId='" + nexusArtifactDto.getGroupId() + '\''
+            + ", artifactId='" + nexusArtifactDto.getArtifactId() + '\''
+            + ", version='" + nexusArtifactDto.getVersion() + '\''
+            + ", name='" + name + '\''
+            + ']';
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusArtifactDto.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusArtifactDto.java b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusArtifactDto.java
index 21f11e8..5a65765 100644
--- a/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusArtifactDto.java
+++ b/platforms/catalog-nexus/src/main/java/org/apache/camel/catalog/nexus/NexusArtifactDto.java
@@ -101,11 +101,11 @@ public class NexusArtifactDto implements Serializable {
 
     @Override
     public String toString() {
-        return "NexusArtifactDto[" +
-            "groupId='" + groupId + '\'' +
-            ", artifactId='" + artifactId + '\'' +
-            ", version='" + version + '\'' +
-            ", artifactLink='" + artifactLink + '\'' +
-            ']';
+        return "NexusArtifactDto["
+            + "groupId='" + groupId + '\''
+            + ", artifactId='" + artifactId + '\''
+            + ", version='" + version + '\''
+            + ", artifactLink='" + artifactLink + '\''
+            + ']';
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
index 4327166..d9aa9c5 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileComponentCatalogNexusRepository.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
index 00d1c6a..aa0f93d 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalFileConnectorNexusRepository.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java
index 454bfdf..a7a36b0 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusComponentCatalogRepositoryTest.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

http://git-wip-us.apache.org/repos/asf/camel/blob/a97db7cd/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java
----------------------------------------------------------------------
diff --git a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java
index b415cfd..2bddf53 100644
--- a/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java
+++ b/platforms/catalog-nexus/src/test/java/org/apache/camel/catalog/nexus/LocalNexusConnectorRepositoryTest.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.