1 package org.apache.archiva.rest.api.services;
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
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;
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;
39 @Path( "/searchService/" )
40 public interface SearchService
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
51 @Path( "quickSearch" )
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;
59 * <b>if not repositories in SearchRequest: search will be apply on all repositories the current user has karma</b>
61 @Path( "quickSearchWithRepositories" )
63 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
64 @RedbackAuthorization( noPermission = true, noRestriction = true )
65 List<Artifact> quickSearchWithRepositories( SearchRequest searchRequest )
66 throws ArchivaRestServiceException;
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>
72 @Path( "searchArtifacts" )
74 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
75 @RedbackAuthorization( noPermission = true, noRestriction = true )
76 List<Artifact> searchArtifacts( SearchRequest searchRequest )
77 throws ArchivaRestServiceException;
80 * <b>search will be apply on all repositories the current user has karma</b>
82 @Path( "getArtifactVersions" )
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;
93 * <b>this method applies on Maven Indexer lucene index, so datas not yet indexed won't be available</b>
95 @Path( "getAllGroupIds" )
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;
105 @Path( "observableRepoIds" )
107 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
108 @RedbackAuthorization( noPermission = true, noRestriction = true )
109 StringList getObservablesRepoIds()
110 throws ArchivaRestServiceException;
113 @Path( "getDependencies" )
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;
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;
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>
141 @Path( "artifactsByChecksum" )
143 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
144 @RedbackAuthorization( noPermission = true, noRestriction = true )
145 List<Artifact> getArtifactByChecksum( ChecksumSearch checksumSearch )
146 throws ArchivaRestServiceException;