This project has retired. For details please refer to its Attic page.
SearchService xref
View Javadoc
1   package org.apache.archiva.rest.api.services;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  
23  import org.apache.archiva.maven2.model.Artifact;
24  import org.apache.archiva.redback.authorization.RedbackAuthorization;
25  import org.apache.archiva.rest.api.model.ChecksumSearch;
26  import org.apache.archiva.rest.api.model.GroupIdList;
27  import org.apache.archiva.rest.api.model.SearchRequest;
28  import org.apache.archiva.rest.api.model.StringList;
29  
30  import javax.ws.rs.GET;
31  import javax.ws.rs.POST;
32  import javax.ws.rs.Path;
33  import javax.ws.rs.Produces;
34  import javax.ws.rs.QueryParam;
35  import javax.ws.rs.core.MediaType;
36  import javax.ws.rs.core.Response;
37  import java.util.List;
38  
39  @Path( "/searchService/" )
40  public interface SearchService
41  {
42      /*
43      * quick/general text search which returns a list of artifacts
44      * query for an artifact based on a checksum
45      * query for all available versions of an artifact, sorted in version significance order
46      * query for an artifact's direct dependencies
47      * <b>search will be apply on all repositories the current user has karma</b>
48      * TODO query for an artifact's dependency tree (as with mvn dependency:tree - no duplicates should be included)
49      * TODO query for all artifacts that depend on a given artifact
50      */
51      @Path( "quickSearch" )
52      @GET
53      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
54      @RedbackAuthorization( noPermission = true, noRestriction = true )
55      List<Artifact> quickSearch( @QueryParam( "queryString" ) String queryString )
56          throws ArchivaRestServiceException;
57  
58      /**
59       * <b>if not repositories in SearchRequest: search will be apply on all repositories the current user has karma</b>
60       */
61      @Path( "quickSearchWithRepositories" )
62      @POST
63      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
64      @RedbackAuthorization( noPermission = true, noRestriction = true )
65      List<Artifact> quickSearchWithRepositories( SearchRequest searchRequest )
66          throws ArchivaRestServiceException;
67  
68      /**
69       * If searchRequest contains repositories, the search will be done only on those repositories.
70       * <b>if no repositories, the search will be apply on all repositories the current user has karma</b>
71       */
72      @Path( "searchArtifacts" )
73      @POST
74      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
75      @RedbackAuthorization( noPermission = true, noRestriction = true )
76      List<Artifact> searchArtifacts( SearchRequest searchRequest )
77          throws ArchivaRestServiceException;
78  
79      /**
80       * <b>search will be apply on all repositories the current user has karma</b>
81       */
82      @Path( "getArtifactVersions" )
83      @GET
84      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
85      @RedbackAuthorization( noPermission = true, noRestriction = true )
86      List<Artifact> getArtifactVersions( @QueryParam( "groupId" ) String groupId, //
87                                          @QueryParam( "artifactId" ) String artifactId, //
88                                          @QueryParam( "packaging" ) String packaging )
89          throws ArchivaRestServiceException;
90  
91  
92      /**
93       * <b>this method applies on Maven Indexer lucene index, so datas not yet indexed won't be available</b>
94       */
95      @Path( "getAllGroupIds" )
96      @GET
97      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
98      @RedbackAuthorization( noPermission = true, noRestriction = false )
99      GroupIdList getAllGroupIds( @QueryParam( "selectedRepos" ) List<String> selectedRepos )
100         throws ArchivaRestServiceException;
101 
102     /**
103      * @since 1.4-M3
104      */
105     @Path( "observableRepoIds" )
106     @GET
107     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
108     @RedbackAuthorization( noPermission = true, noRestriction = true )
109     StringList getObservablesRepoIds()
110         throws ArchivaRestServiceException;
111 
112     /*
113     @Path( "getDependencies" )
114     @GET
115     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
116     @RedbackAuthorization( noPermission = true, noRestriction = true )
117     List<Dependency> getDependencies( @QueryParam( "groupId" ) String groupId,
118                                       @QueryParam( "artifactId" ) String artifactId,
119                                       @QueryParam( "version" ) String version )
120         throws ArchivaRestServiceException;
121     */
122 
123 
124     @GET
125     @Path( "/artifact" )
126     @Produces( "text/html" )
127     @RedbackAuthorization( noPermission = true, noRestriction = true )
128     Response redirectToArtifactFile( @QueryParam( "r" ) String repositoryId, //
129                                      @QueryParam( "g" ) String groupId, //
130                                      @QueryParam( "a" ) String artifactId, //
131                                      @QueryParam( "v" ) String version, //
132                                      @QueryParam( "p" ) String packaging, //
133                                      @QueryParam( "c" ) String classifier )
134         throws ArchivaRestServiceException;
135 
136 
137     /**
138      * If searchRequest contains repositories, the search will be done only on those repositories.
139      * <b>if no repositories, the search will be apply on all repositories the current user has karma</b>
140      */
141     @Path( "artifactsByChecksum" )
142     @POST
143     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
144     @RedbackAuthorization( noPermission = true, noRestriction = true )
145     List<Artifact> getArtifactByChecksum( ChecksumSearch checksumSearch )
146         throws ArchivaRestServiceException;
147 
148 
149 }