]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1490] REST services : fix design of search service
authorOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:03:08 +0000 (12:03 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:03:08 +0000 (12:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170133 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/SearchService.java

index 0100906b03d6af5fb67a90b1b867a2310539c01f..12537b35dc4fb5b3c208aafddcc2d9dd52f99cbd 100644 (file)
@@ -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<Artifact> quickSearch( String queryString )
-        throws Exception;
+    @Path( "quickSearch" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noPermission = true, noRestriction = true )
+    List<Artifact> quickSearch( @QueryParam( "queryString" ) String queryString )
+        throws ArchivaRestServiceException;
 
-    List<Artifact> getArtifactByChecksum( String checksum )
-        throws Exception;
+    @Path( "getArtifactByChecksum" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noPermission = true, noRestriction = true )
+    List<Artifact> getArtifactByChecksum( @QueryParam( "checksum" ) String checksum )
+        throws ArchivaRestServiceException;
 
-    List<Artifact> 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<Artifact> getArtifactVersions( @QueryParam( "groupId" ) String groupId,
+                                        @QueryParam( "artifactId" ) String artifactId )
+        throws ArchivaRestServiceException;
 
-    List<Dependency> 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<Dependency> getDependencies( @QueryParam( "groupId" ) String groupId,
+                                      @QueryParam( "artifactId" ) String artifactId,
+                                      @QueryParam( "version" ) String version )
+        throws ArchivaRestServiceException;
 
 }