diff --git a/plugins/scm-hg-plugin/src/main/java/sonia/scm/api/rest/resources/HgConfigResource.java b/plugins/scm-hg-plugin/src/main/java/sonia/scm/api/rest/resources/HgConfigResource.java index a8e06cd8e6..804faa2e48 100644 --- a/plugins/scm-hg-plugin/src/main/java/sonia/scm/api/rest/resources/HgConfigResource.java +++ b/plugins/scm-hg-plugin/src/main/java/sonia/scm/api/rest/resources/HgConfigResource.java @@ -55,11 +55,15 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; -import javax.ws.rs.core.GenericEntity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + /** * * @author Sebastian Sdorra @@ -134,13 +138,12 @@ public class HgConfigResource @GET @Path("installations/hg") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public GenericEntity> getHgInstallations() + public InstallationsResponse getHgInstallations() { List installations = HgInstallerFactory.createInstaller().getHgInstallations(); - return new GenericEntity>(installations) {} - ; + return new InstallationsResponse(installations); } /** @@ -152,13 +155,12 @@ public class HgConfigResource @GET @Path("installations/python") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public GenericEntity> getPythonInstallations() + public InstallationsResponse getPythonInstallations() { List installations = HgInstallerFactory.createInstaller().getPythonInstallations(); - return new GenericEntity>(installations) {} - ; + return new InstallationsResponse(installations); } //~--- set methods ---------------------------------------------------------- @@ -186,6 +188,71 @@ public class HgConfigResource return Response.created(uriInfo.getRequestUri()).build(); } + //~--- inner classes -------------------------------------------------------- + + /** + * Class description + * + * + * @version Enter version here..., 11/04/25 + * @author Enter your name here... + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlRootElement(name = "installations") + public static class InstallationsResponse + { + + /** + * Constructs ... + * + */ + public InstallationsResponse() {} + + /** + * Constructs ... + * + * + * @param paths + */ + public InstallationsResponse(List paths) + { + this.paths = paths; + } + + //~--- get methods -------------------------------------------------------- + + /** + * Method description + * + * + * @return + */ + public List getPaths() + { + return paths; + } + + //~--- set methods -------------------------------------------------------- + + /** + * Method description + * + * + * @param paths + */ + public void setPaths(List paths) + { + this.paths = paths; + } + + //~--- fields ------------------------------------------------------------- + + /** Field description */ + @XmlElement(name = "path") + private List paths; + } + + //~--- fields --------------------------------------------------------------- /** Field description */