You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2017/12/20 13:18:49 UTC
[karaf-cave] branch master updated: Move request classes as inner
class for Deployer REST service.
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/karaf-cave.git
The following commit(s) were added to refs/heads/master by this push:
new 95b3892 Move request classes as inner class for Deployer REST service.
95b3892 is described below
commit 95b389268cf9a493ac04c022d82b7d4127e64a35
Author: Jean-Baptiste Onofré <jb...@nanthrax.net>
AuthorDate: Wed Dec 20 14:18:20 2017 +0100
Move request classes as inner class for Deployer REST service.
---
.../karaf/cave/deployer/rest/DeployRequest.java | 67 -------
.../karaf/cave/deployer/rest/DeployerRest.java | 210 ++++++++++++++++++++-
.../cave/deployer/rest/FeatureAssembleRequest.java | 106 -----------
.../cave/deployer/rest/KarExplodeRequest.java | 40 ----
.../karaf/cave/deployer/rest/UploadRequest.java | 67 -------
.../karaf/cave/deployer/rest/DeployerRestTest.java | 4 +-
6 files changed, 208 insertions(+), 286 deletions(-)
diff --git a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/DeployRequest.java b/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/DeployRequest.java
deleted file mode 100644
index d98038a..0000000
--- a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/DeployRequest.java
+++ /dev/null
@@ -1,67 +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.karaf.cave.deployer.rest;
-
-public class DeployRequest {
-
- private String artifactUrl;
- private String jmxUrl;
- private String karafName;
- private String user;
- private String password;
-
- public String getArtifactUrl() {
- return artifactUrl;
- }
-
- public void setArtifactUrl(String artifactUrl) {
- this.artifactUrl = artifactUrl;
- }
-
- public String getJmxUrl() {
- return jmxUrl;
- }
-
- public void setJmxUrl(String jmxUrl) {
- this.jmxUrl = jmxUrl;
- }
-
- public String getKarafName() {
- return karafName;
- }
-
- public void setKarafName(String karafName) {
- this.karafName = karafName;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
-}
diff --git a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/DeployerRest.java b/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/DeployerRest.java
index 00b2ac7..e271d09 100644
--- a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/DeployerRest.java
+++ b/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/DeployerRest.java
@@ -27,6 +27,29 @@ public class DeployerRest {
private Deployer deployer;
+ public static class KarExplodeRequest {
+
+ private String artifactUrl;
+ private String repositoryUrl;
+
+ public String getArtifactUrl() {
+ return artifactUrl;
+ }
+
+ public void setArtifactUrl(String artifactUrl) {
+ this.artifactUrl = artifactUrl;
+ }
+
+ public String getRepositoryUrl() {
+ return repositoryUrl;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ }
+
@Path("/artifact/explode")
@Consumes("application/json")
@POST
@@ -34,11 +57,83 @@ public class DeployerRest {
deployer.explode(request.getArtifactUrl(), request.getRepositoryUrl());
}
+ public static class ExtractRequest {
+
+ private String artifactUrl;
+ private String directory;
+
+ public String getArtifactUrl() {
+ return artifactUrl;
+ }
+
+ public void setArtifactUrl(String artifactUrl) {
+ this.artifactUrl = artifactUrl;
+ }
+
+ public String getDirectory() {
+ return directory;
+ }
+
+ public void setDirectory(String directory) {
+ this.directory = directory;
+ }
+ }
+
@Path("/artifact/extract")
@Consumes("application/json")
@POST
- public void extract(String artifactUrl, String directory) throws Exception {
- deployer.extract(artifactUrl, directory);
+ public void extract(ExtractRequest request) throws Exception {
+ deployer.extract(request.getArtifactUrl(), request.getDirectory());
+ }
+
+ public static class UploadRequest {
+
+ private String groupId;
+ private String artifactId;
+ private String version;
+ private String artifactUrl;
+ private String repositoryUrl;
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId() {
+ return artifactId;
+ }
+
+ public void setArtifactId(String artifactId) {
+ this.artifactId = artifactId;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getArtifactUrl() {
+ return artifactUrl;
+ }
+
+ public void setArtifactUrl(String artifactUrl) {
+ this.artifactUrl = artifactUrl;
+ }
+
+ public String getRepositoryUrl() {
+ return repositoryUrl;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
}
@Path("/artifact/upload")
@@ -52,11 +147,33 @@ public class DeployerRest {
request.getRepositoryUrl());
}
+ public static class DownloadRequest {
+
+ private String artifactUrl;
+ private String localPath;
+
+ public String getArtifactUrl() {
+ return artifactUrl;
+ }
+
+ public void setArtifactUrl(String artifactUrl) {
+ this.artifactUrl = artifactUrl;
+ }
+
+ public String getLocalPath() {
+ return localPath;
+ }
+
+ public void setLocalPath(String localPath) {
+ this.localPath = localPath;
+ }
+ }
+
@Path("/artifact/download")
@Consumes("application/json")
@POST
- public void download(String artifactUrl, String localPath) throws Exception {
- deployer.download(artifactUrl, localPath);
+ public void download(DownloadRequest request) throws Exception {
+ deployer.download(request.getArtifactUrl(), request.getLocalPath());
}
@Path("/{connection}/bundle/{url}")
@@ -108,6 +225,91 @@ public class DeployerRest {
return deployer.kars(connection);
}
+ public static class FeatureAssembleRequest {
+
+ private String groupId;
+ private String artifactId;
+ private String version;
+ private String feature;
+ private String repositoryUrl;
+ private List<String> featureRepositories;
+ private List<String> features;
+ private List<String> bundles;
+ private List<Config> configs;
+
+ public String getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(String groupId) {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId() {
+ return artifactId;
+ }
+
+ public void setArtifactId(String artifactId) {
+ this.artifactId = artifactId;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getFeature() {
+ return feature;
+ }
+
+ public void setFeature(String feature) {
+ this.feature = feature;
+ }
+
+ public String getRepositoryUrl() {
+ return repositoryUrl;
+ }
+
+ public void setRepositoryUrl(String repositoryUrl) {
+ this.repositoryUrl = repositoryUrl;
+ }
+
+ public List<String> getFeatureRepositories() {
+ return featureRepositories;
+ }
+
+ public void setFeatureRepositories(List<String> featureRepositories) {
+ this.featureRepositories = featureRepositories;
+ }
+
+ public List<String> getFeatures() {
+ return features;
+ }
+
+ public void setFeatures(List<String> features) {
+ this.features = features;
+ }
+
+ public List<String> getBundles() {
+ return bundles;
+ }
+
+ public void setBundles(List<String> bundles) {
+ this.bundles = bundles;
+ }
+ public List<Config> getConfigs() {
+ return configs;
+ }
+
+ public void setConfigs(List<Config> configs) {
+ this.configs = configs;
+ }
+
+ }
+
@Path("/feature/assemble")
@Consumes("application/json")
@POST
diff --git a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/FeatureAssembleRequest.java b/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/FeatureAssembleRequest.java
deleted file mode 100644
index 41fd96d..0000000
--- a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/FeatureAssembleRequest.java
+++ /dev/null
@@ -1,106 +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.karaf.cave.deployer.rest;
-
-import org.apache.karaf.cave.deployer.api.Config;
-
-import java.util.List;
-
-public class FeatureAssembleRequest {
-
- private String groupId;
- private String artifactId;
- private String version;
- private String feature;
- private String repositoryUrl;
- private List<String> featureRepositories;
- private List<String> features;
- private List<String> bundles;
- private List<Config> configs;
-
- public String getGroupId() {
- return groupId;
- }
-
- public void setGroupId(String groupId) {
- this.groupId = groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getFeature() {
- return feature;
- }
-
- public void setFeature(String feature) {
- this.feature = feature;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
- public List<String> getFeatureRepositories() {
- return featureRepositories;
- }
-
- public void setFeatureRepositories(List<String> featureRepositories) {
- this.featureRepositories = featureRepositories;
- }
-
- public List<String> getFeatures() {
- return features;
- }
-
- public void setFeatures(List<String> features) {
- this.features = features;
- }
-
- public List<String> getBundles() {
- return bundles;
- }
-
- public void setBundles(List<String> bundles) {
- this.bundles = bundles;
- }
- public List<Config> getConfigs() {
- return configs;
- }
-
- public void setConfigs(List<Config> configs) {
- this.configs = configs;
- }
-
-}
diff --git a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/KarExplodeRequest.java b/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/KarExplodeRequest.java
deleted file mode 100644
index 28d5568..0000000
--- a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/KarExplodeRequest.java
+++ /dev/null
@@ -1,40 +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.karaf.cave.deployer.rest;
-
-public class KarExplodeRequest {
-
- private String artifactUrl;
- private String repositoryUrl;
-
- public String getArtifactUrl() {
- return artifactUrl;
- }
-
- public void setArtifactUrl(String artifactUrl) {
- this.artifactUrl = artifactUrl;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
-}
diff --git a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/UploadRequest.java b/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/UploadRequest.java
deleted file mode 100644
index b128001..0000000
--- a/deployer/rest/src/main/java/org/apache/karaf/cave/deployer/rest/UploadRequest.java
+++ /dev/null
@@ -1,67 +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.karaf.cave.deployer.rest;
-
-public class UploadRequest {
-
- private String groupId;
- private String artifactId;
- private String version;
- private String artifactUrl;
- private String repositoryUrl;
-
- public String getGroupId() {
- return groupId;
- }
-
- public void setGroupId(String groupId) {
- this.groupId = groupId;
- }
-
- public String getArtifactId() {
- return artifactId;
- }
-
- public void setArtifactId(String artifactId) {
- this.artifactId = artifactId;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getArtifactUrl() {
- return artifactUrl;
- }
-
- public void setArtifactUrl(String artifactUrl) {
- this.artifactUrl = artifactUrl;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public void setRepositoryUrl(String repositoryUrl) {
- this.repositoryUrl = repositoryUrl;
- }
-
-}
diff --git a/deployer/rest/src/test/java/org/apache/karaf/cave/deployer/rest/DeployerRestTest.java b/deployer/rest/src/test/java/org/apache/karaf/cave/deployer/rest/DeployerRestTest.java
index 7d05e1e..59262a9 100644
--- a/deployer/rest/src/test/java/org/apache/karaf/cave/deployer/rest/DeployerRestTest.java
+++ b/deployer/rest/src/test/java/org/apache/karaf/cave/deployer/rest/DeployerRestTest.java
@@ -44,7 +44,7 @@ public class DeployerRestTest {
System.out.println("\t- The kar is uploaded on Maven repo (using mvn deploy:deploy-file or API");
System.out.println("\t- The kar is exploded on the Maven repo");
- UploadRequest uploadRequest = new UploadRequest();
+ DeployerRest.UploadRequest uploadRequest = new DeployerRest.UploadRequest();
uploadRequest.setRepositoryUrl("file:target/test/repository");
uploadRequest.setArtifactUrl("file:src/test/resources/test.kar");
uploadRequest.setGroupId("kar-test");
@@ -52,7 +52,7 @@ public class DeployerRestTest {
uploadRequest.setVersion("1.0-SNAPSHOT");
rest.upload(uploadRequest);
- KarExplodeRequest karExplodeRequest = new KarExplodeRequest();
+ DeployerRest.KarExplodeRequest karExplodeRequest = new DeployerRest.KarExplodeRequest();
// TODO: the artifact URL should be the one on Maven repository
// To simplify we use test resources location directly
karExplodeRequest.setArtifactUrl("file:src/test/resources/test.kar");
--
To stop receiving notification emails like this one, please contact
['"commits@karaf.apache.org" <co...@karaf.apache.org>'].