[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16253195#comment-16253195
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

jbonofre closed pull request #6: [KARAF-3827] - Fix Cave rest service doesn't 
retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/server/rest/pom.xml b/server/rest/pom.xml
index b78a3d9..414189e 100644
--- a/server/rest/pom.xml
+++ b/server/rest/pom.xml
@@ -47,6 +47,10 @@
 org.apache.cxf
 cxf-rt-frontend-jaxrs
 
+
+org.apache.karaf
+org.apache.karaf.util
+
 
 
 
@@ -61,6 +65,9 @@
 
 
 
${project.artifactId}
+
+org.apache.karaf.util
+
 
 
 
diff --git 
a/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Repository.java 
b/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Repository.java
index 8e1a38a..aca0b5e 100644
--- 
a/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Repository.java
+++ 
b/server/rest/src/main/java/org/apache/karaf/cave/server/rest/Repository.java
@@ -16,21 +16,145 @@
  */
 package org.apache.karaf.cave.server.rest;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
 
 import org.apache.karaf.cave.server.api.CaveRepository;
+import org.apache.karaf.util.XmlUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 @XmlRootElement(name = "cave-repository")
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Repository", propOrder = {"name", "increment", "location", 
"resources"})
 public class Repository {
 
-private final CaveRepository repository;
-
+@XmlElement(name = "name")
+private String name;
+@XmlElement(name = "increment")
+private long increment;
+@XmlElement(name = "location")
+private String location;
+@XmlElement(name = "resources")
+private List resources;
+
 public Repository() {
-repository = null;
+// require for JABX IllegalAnnotationExceptions
 }
 
 public Repository(CaveRepository repository) {
-this.repository = repository;
+this.name = repository.getName();
+this.increment = repository.getIncrement();
+this.location = repository.getLocation();
+
+try {
+Document doc = 
XmlUtils.parse(repository.getRepositoryXml().toExternalForm());
+
+// get all resource elements
+NodeList resourceList = doc.getElementsByTagName("resource");
+
+if (resourceList.getLength() > 0) {
+this.resources = new ArrayList<>();
+}
+
+// read resource
+for (int vI = 0; vI < resourceList.getLength(); vI++) {
+
+Element nodeResource = (Element) resourceList.item(vI);
+Resource resource = new Resource();
+
+NodeList capabilityList = 
nodeResource.getElementsByTagName("capability");
+
+// read capability
+for (int vInt = 0; vInt < capabilityList.getLength(); vInt++) {
+
+Element capability = (Element) capabilityList.item(vInt);
+
+if (capability.hasAttribute("namespace")) {
+
+Element attribute = (Element) 
capability.getFirstChild();
+
+while (attribute != null) {
+
+if 
(capability.getAttribute("namespace").equals("osgi.identity")) {
+
+switch (attribute.getAttribute("name")) {
+case "osgi.identity":
+
resource.setIdentity(attribute.getAttribute("value"));
+break;
+case "type":
+
resource.setType(attribute.getAttribute("value"));
+break;
+case "version":
+
resource.setVersion(attribute.getAttribute("value"));
+break;
+default:
+break;
+  

[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-15 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16253191#comment-16253191
 ] 

ASF subversion and git services commented on KARAF-3827:


Commit eb0e8ac82cc2c5966c246621b36161136f1a141a in karaf-cave's branch 
refs/heads/master from [~jbonofre]
[ https://gitbox.apache.org/repos/asf?p=karaf-cave.git;h=eb0e8ac ]

[KARAF-3827] This closes #6


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16253180#comment-16253180
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

jbonofre commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r151072345
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Service.java
 ##
 @@ -47,9 +48,9 @@ public Service(CaveRepositoryService service) {
  * @throws Exception in case of creation failure.
  */
 @POST
-@Consumes("application/xml")
-@Produces("application/xml")
-public Repository create(String name, boolean scan) throws Exception {
+@Path("/repositories")
+@Produces("application/json")
 
 Review comment:
   OK, so it uses JABX -> JSON converter. That's fine as soon as we support 
both. Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-15 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16253179#comment-16253179
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

jbonofre commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r151072158
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Repository.java
 ##
 @@ -16,21 +16,145 @@
  */
 package org.apache.karaf.cave.server.rest;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
 
 import org.apache.karaf.cave.server.api.CaveRepository;
+import org.apache.karaf.util.XmlUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 @XmlRootElement(name = "cave-repository")
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Repository", propOrder = {"name", "increment", "location", 
"resources"})
 public class Repository {
 
-private final CaveRepository repository;
 
 Review comment:
   Got it now. Thanks !


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16253027#comment-16253027
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

fpapon commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r151044250
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Service.java
 ##
 @@ -47,9 +48,9 @@ public Service(CaveRepositoryService service) {
  * @throws Exception in case of creation failure.
  */
 @POST
-@Consumes("application/xml")
-@Produces("application/xml")
-public Repository create(String name, boolean scan) throws Exception {
+@Path("/repositories")
+@Produces("application/json")
 
 Review comment:
   We need to add a JSONProvider to the Servlet implementing 
CFXNonSpringServlet :
   ```
   String alias = getString("cave.rest.alias", "/cave/rest");
   Hashtable config = new Hashtable<>();
   if (getConfiguration() != null) {
   for (Enumeration e = getConfiguration().keys(); 
e.hasMoreElements();) {
   String key = e.nextElement();
   String val = getConfiguration().get(key).toString();
   config.put(key, val);
   }
   }
   this.alias = alias;
   this.servlet = new CaveRestServlet(service);
   this.httpService.registerServlet(this.alias, this.servlet, config, 
null);
   ```
   I've already done this with blueprint but not in a java way, I can try to do 
it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16252977#comment-16252977
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

fpapon commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r151038420
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Service.java
 ##
 @@ -47,9 +48,9 @@ public Service(CaveRepositoryService service) {
  * @throws Exception in case of creation failure.
  */
 @POST
-@Consumes("application/xml")
-@Produces("application/xml")
-public Repository create(String name, boolean scan) throws Exception {
+@Path("/repositories")
+@Produces("application/json")
 
 Review comment:
   If I remove JABX annotations, I've got this error :
   ```
   No message body writer has been found for class 
[Lorg.apache.karaf.cave.server.rest.Repository;, ContentType: application/json
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16252975#comment-16252975
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

fpapon commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r151038420
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Service.java
 ##
 @@ -47,9 +48,9 @@ public Service(CaveRepositoryService service) {
  * @throws Exception in case of creation failure.
  */
 @POST
-@Consumes("application/xml")
-@Produces("application/xml")
-public Repository create(String name, boolean scan) throws Exception {
+@Path("/repositories")
+@Produces("application/json")
 
 Review comment:
   If I remove JABX annotations, I've got this error :
   
   No message body writer has been found for class 
[Lorg.apache.karaf.cave.server.rest.Repository;, ContentType: application/json


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16252141#comment-16252141
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

fpapon commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r150956092
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Service.java
 ##
 @@ -47,9 +48,9 @@ public Service(CaveRepositoryService service) {
  * @throws Exception in case of creation failure.
  */
 @POST
-@Consumes("application/xml")
-@Produces("application/xml")
-public Repository create(String name, boolean scan) throws Exception {
+@Path("/repositories")
+@Produces("application/json")
 
 Review comment:
   I use annotation with JAXB to define and force attribute name in the json 
output like "cave-repository" :
   ```
   @XmlRootElement(name = "cave-repository")
   @XmlAccessorType(XmlAccessType.NONE)
   @XmlType(name = "Repository", propOrder = {"name", "increment", "location", 
"resources"})
   public class Repository {
   ...
   ```
   It's not mandatory but I wouldn't change existing object name return but we 
can change it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16252139#comment-16252139
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

fpapon commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r150956092
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Service.java
 ##
 @@ -47,9 +48,9 @@ public Service(CaveRepositoryService service) {
  * @throws Exception in case of creation failure.
  */
 @POST
-@Consumes("application/xml")
-@Produces("application/xml")
-public Repository create(String name, boolean scan) throws Exception {
+@Path("/repositories")
+@Produces("application/json")
 
 Review comment:
   I use annotation with JAXB to define and force attribute name in the json 
output like "cave-repositories" :
   ```
   @XmlRootElement(name = "cave-repository")
   @XmlAccessorType(XmlAccessType.NONE)
   @XmlType(name = "Repository", propOrder = {"name", "increment", "location", 
"resources"})
   public class Repository {
   ...
   ```
   It's not mandatory but I wouldn't change existing object name return but we 
can change it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16252134#comment-16252134
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

fpapon commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r150954730
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Repository.java
 ##
 @@ -16,21 +16,145 @@
  */
 package org.apache.karaf.cave.server.rest;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
 
 import org.apache.karaf.cave.server.api.CaveRepository;
+import org.apache.karaf.util.XmlUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 @XmlRootElement(name = "cave-repository")
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Repository", propOrder = {"name", "increment", "location", 
"resources"})
 public class Repository {
 
-private final CaveRepository repository;
 
 Review comment:
   I don't change the implementation of the method in the Service class :
   ```
   public Repository getRepository(@PathParam("name") String name) {
   CaveRepository repository = service.getRepository(name);
   if (repository != null) {
   return new Repository(repository);
   } else {
   return null;
   }
   }
   ```
   repository service is passed in the constructor and used directly the 
retreive repository data :
   ```
   public Repository(CaveRepository repository) {
   this.name = repository.getName();
   this.increment = repository.getIncrement();
   this.location = repository.getLocation();
   
   try {
   Document doc = 
XmlUtils.parse(repository.getRepositoryXml().toExternalForm());
   ...
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16251443#comment-16251443
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

jbonofre commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r150844555
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Service.java
 ##
 @@ -47,9 +48,9 @@ public Service(CaveRepositoryService service) {
  * @throws Exception in case of creation failure.
  */
 @POST
-@Consumes("application/xml")
-@Produces("application/xml")
-public Repository create(String name, boolean scan) throws Exception {
+@Path("/repositories")
+@Produces("application/json")
 
 Review comment:
   We annotation with JAXB but we provide json output. Thoughts ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-11-14 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16251444#comment-16251444
 ] 

ASF GitHub Bot commented on KARAF-3827:
---

jbonofre commented on a change in pull request #6: [KARAF-3827] - Fix Cave rest 
service doesn't retrieve the repositories
URL: https://github.com/apache/karaf-cave/pull/6#discussion_r150844378
 
 

 ##
 File path: 
server/rest/src/main/java/org/apache/karaf/cave/server/rest/Repository.java
 ##
 @@ -16,21 +16,145 @@
  */
 package org.apache.karaf.cave.server.rest;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
 
 import org.apache.karaf.cave.server.api.CaveRepository;
+import org.apache.karaf.util.XmlUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 @XmlRootElement(name = "cave-repository")
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlType(name = "Repository", propOrder = {"name", "increment", "location", 
"resources"})
 public class Repository {
 
-private final CaveRepository repository;
 
 Review comment:
   How do you access the actual `CaveRepository` now (I don't find the 
location) ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (KARAF-3827) Cave rest service doesn't retrieve the repositories

2017-10-10 Thread Francois Papon (JIRA)

[ 
https://issues.apache.org/jira/browse/KARAF-3827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16199003#comment-16199003
 ] 

Francois Papon commented on KARAF-3827:
---

Hi JB,

I worked on this issue and fixed it. I also try to return JSON object instead 
of XML. It's mandatory for this service to return XML or could we have JSON 
response ?

> Cave rest service doesn't retrieve the repositories
> ---
>
> Key: KARAF-3827
> URL: https://issues.apache.org/jira/browse/KARAF-3827
> Project: Karaf
>  Issue Type: Bug
>  Components: cave-rest
>Reporter: Jean-Baptiste Onofré
>Assignee: Jean-Baptiste Onofré
> Fix For: cave-4.0.1
>
>
> Even if a repository exists:
> {code}
> karaf@root()> cave:repositories 
> Name  | Location
> -
> my-repository | /home/jbonofre/bin/apache-karaf-4.0.0/data/cave/my-repository
> {code}
> accessing the Cave REST API on:
> {code}
> http://localhost:8181/cave/rest/repositories
> {code}
> just give:
> {code}
> 
> 
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)