From 5c067f2a4deaa775213a3b5c2ca44ce62f4ba914 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 13 Sep 2011 12:03:08 +0000 Subject: [PATCH] [MRM-1490] REST services : fix design of search service git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170133 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/api/services/SearchService.java | 40 +++++++++++++++---- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java index 0100906b0..12537b35d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java @@ -22,8 +22,13 @@ package org.apache.archiva.rest.api.services; import org.apache.archiva.rest.api.model.Artifact; import org.apache.archiva.rest.api.model.Dependency; +import org.codehaus.plexus.redback.authorization.RedbackAuthorization; +import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; import java.util.List; @Path( "/searchService/" ) @@ -38,16 +43,35 @@ public interface SearchService * TODO query for all artifacts that depend on a given artifact */ - List quickSearch( String queryString ) - throws Exception; + @Path( "quickSearch" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List quickSearch( @QueryParam( "queryString" ) String queryString ) + throws ArchivaRestServiceException; - List getArtifactByChecksum( String checksum ) - throws Exception; + @Path( "getArtifactByChecksum" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List getArtifactByChecksum( @QueryParam( "checksum" ) String checksum ) + throws ArchivaRestServiceException; - List getArtifactVersions( String groupId, String artifactId ) - throws Exception; + @Path( "getArtifactVersions" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List getArtifactVersions( @QueryParam( "groupId" ) String groupId, + @QueryParam( "artifactId" ) String artifactId ) + throws ArchivaRestServiceException; - List getDependencies( String groupId, String artifactId, String version ) - throws Exception; + @Path( "getDependencies" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) + @RedbackAuthorization( noPermission = true, noRestriction = true ) + List getDependencies( @QueryParam( "groupId" ) String groupId, + @QueryParam( "artifactId" ) String artifactId, + @QueryParam( "version" ) String version ) + throws ArchivaRestServiceException; } -- 2.39.5