camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/4] camel git commit: CAMEL-10898: camel-catalog - Allow to add custom component/connector by download JAR via maven
Date Mon, 27 Feb 2017 13:07:57 GMT
CAMEL-10898: camel-catalog - Allow to add custom component/connector by download JAR via maven


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

Branch: refs/heads/master
Commit: c9e4817905ebd4d3ba985873845eff550104fdd0
Parents: 1df8a2a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Feb 27 13:56:27 2017 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Feb 27 14:07:45 2017 +0100

----------------------------------------------------------------------
 platforms/camel-catalog-rest/pom.xml            |  4 ++++
 .../camel/catalog/rest/CamelCatalogRest.java    | 22 ++++++++++++++++++++
 .../catalog/rest/CamelConnectorCatalogRest.java | 22 ++++++++++++++++++++
 3 files changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c9e48179/platforms/camel-catalog-rest/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-rest/pom.xml b/platforms/camel-catalog-rest/pom.xml
index 300ed6c..b84a0ad 100644
--- a/platforms/camel-catalog-rest/pom.xml
+++ b/platforms/camel-catalog-rest/pom.xml
@@ -40,6 +40,10 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-catalog-connector</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-catalog-maven</artifactId>
+    </dependency>
 
     <!-- REST api -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/camel/blob/c9e48179/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelCatalogRest.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelCatalogRest.java
b/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelCatalogRest.java
index d47ce27..5690279 100644
--- a/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelCatalogRest.java
+++ b/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelCatalogRest.java
@@ -19,6 +19,7 @@ package org.apache.camel.catalog.rest;
 import java.util.List;
 import java.util.Set;
 import javax.ws.rs.GET;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
@@ -28,6 +29,8 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.apache.camel.catalog.CamelCatalog;
 import org.apache.camel.catalog.DefaultCamelCatalog;
+import org.apache.camel.catalog.maven.DefaultMavenArtifactProvider;
+import org.apache.camel.catalog.maven.MavenArtifactProvider;
 
 /**
  * A REST based {@link CamelCatalog} service as a JAX-RS resource class.
@@ -37,6 +40,7 @@ import org.apache.camel.catalog.DefaultCamelCatalog;
 public class CamelCatalogRest {
 
     private CamelCatalog catalog = new DefaultCamelCatalog(true);
+    private MavenArtifactProvider maven = new DefaultMavenArtifactProvider();
 
     public CamelCatalog getCatalog() {
         return catalog;
@@ -284,4 +288,22 @@ public class CamelCatalogRest {
         return catalog.summaryAsJson();
     }
 
+    @POST
+    @Path("/addMavenRepository/{name}/{url}")
+    @ApiOperation(value = "Adds a third party Maven repository to use for downloading Maven
artifacts")
+    public void addMavenRepository(@ApiParam("The name of the Maven repository") @PathParam("name")
String name,
+                                   @ApiParam("The URL of the Maven repository") @PathParam("url")
String url) {
+        maven.addMavenRepository(name, url);
+    }
+
+    @POST
+    @Path("/addComponentFromMavenArtifact/{groupId}/{artifactId}/{version}")
+    @Produces("text/plain")
+    @ApiOperation(value = "Downloads the Maven artifact and scan for custom Camel components
which will be added to the catalog")
+    public boolean addComponentFromMavenArtifact(@ApiParam("The Maven groupId") @PathParam("groupId")
String groupId,
+                                                 @ApiParam("The Maven artifactId") @PathParam("artifactId")
String artifactId,
+                                                 @ApiParam("The Maven version") @PathParam("version")
String version) {
+        return maven.addArtifactToCatalog(catalog, null, groupId, artifactId, version);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c9e48179/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelConnectorCatalogRest.java
----------------------------------------------------------------------
diff --git a/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelConnectorCatalogRest.java
b/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelConnectorCatalogRest.java
index afe2445..60b2455 100644
--- a/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelConnectorCatalogRest.java
+++ b/platforms/camel-catalog-rest/src/main/java/org/apache/camel/catalog/rest/CamelConnectorCatalogRest.java
@@ -18,6 +18,7 @@ package org.apache.camel.catalog.rest;
 
 import java.util.List;
 import javax.ws.rs.GET;
+import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
@@ -29,6 +30,8 @@ import io.swagger.annotations.ApiParam;
 import org.apache.camel.catalog.connector.CamelConnectorCatalog;
 import org.apache.camel.catalog.connector.ConnectorDto;
 import org.apache.camel.catalog.connector.DefaultCamelConnectorCatalog;
+import org.apache.camel.catalog.maven.DefaultMavenArtifactProvider;
+import org.apache.camel.catalog.maven.MavenArtifactProvider;
 
 /**
  * A REST based {@link CamelConnectorCatalog} service as a JAX-RS resource class.
@@ -38,6 +41,7 @@ import org.apache.camel.catalog.connector.DefaultCamelConnectorCatalog;
 public class CamelConnectorCatalogRest {
 
     private CamelConnectorCatalog catalog = new DefaultCamelConnectorCatalog();
+    private MavenArtifactProvider maven = new DefaultMavenArtifactProvider();
 
     public CamelConnectorCatalog getCatalog() {
         return catalog;
@@ -96,4 +100,22 @@ public class CamelConnectorCatalogRest {
         return catalog.connectorSchemaJSon(groupId, artifactId, version);
     }
 
+    @POST
+    @Path("/addMavenRepository/{name}/{url}")
+    @ApiOperation(value = "Adds a third party Maven repository to use for downloading Maven
artifacts")
+    public void addMavenRepository(@ApiParam("The name of the Maven repository") @PathParam("name")
String name,
+                                   @ApiParam("The URL of the Maven repository") @PathParam("url")
String url) {
+        maven.addMavenRepository(name, url);
+    }
+
+    @POST
+    @Path("/addConnectorFromMavenArtifact/{groupId}/{artifactId}/{version}")
+    @Produces("text/plain")
+    @ApiOperation(value = "Downloads the Maven artifact and scan for custom Camel connectors
which will be added to the catalog")
+    public boolean addConnectorFromMavenArtifact(@ApiParam("The Maven groupId") @PathParam("groupId")
String groupId,
+                                                 @ApiParam("The Maven artifactId") @PathParam("artifactId")
String artifactId,
+                                                 @ApiParam("The Maven version") @PathParam("version")
String version) {
+        return maven.addArtifactToCatalog(null, catalog, groupId, artifactId, version);
+    }
+
 }


Mime
View raw message