1package org.apache.archiva.rest.api.services;
23/*4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */212223import org.apache.archiva.maven2.model.Artifact;
24import org.apache.archiva.redback.authorization.RedbackAuthorization;
25import org.apache.archiva.rest.api.model.ChecksumSearch;
26import org.apache.archiva.rest.api.model.GroupIdList;
27import org.apache.archiva.rest.api.model.SearchRequest;
28import org.apache.archiva.rest.api.model.StringList;
2930import javax.ws.rs.GET;
31import javax.ws.rs.POST;
32import javax.ws.rs.Path;
33import javax.ws.rs.Produces;
34import javax.ws.rs.QueryParam;
35import javax.ws.rs.core.MediaType;
36import javax.ws.rs.core.Response;
37import java.util.List;
3839 @Path( "/searchService/" )
40publicinterfaceSearchService41 {
42/*43 * quick/general text search which returns a list of artifacts44 * query for an artifact based on a checksum45 * query for all available versions of an artifact, sorted in version significance order46 * query for an artifact's direct dependencies47 * <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 artifact50 */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 )
56throws ArchivaRestServiceException;
5758/**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 )
66throws ArchivaRestServiceException;
6768/**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 )
77throws ArchivaRestServiceException;
7879/**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 )
89throws ArchivaRestServiceException;
909192/**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 )
99GroupIdList getAllGroupIds( @QueryParam( "selectedRepos" ) List<String> selectedRepos )
100throws ArchivaRestServiceException;
101102/**103 * @since 1.4-M3104 */105 @Path( "observableRepoIds" )
106 @GET
107 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
108 @RedbackAuthorization( noPermission = true, noRestriction = true )
109StringList getObservablesRepoIds()
110throws ArchivaRestServiceException;
111112/*113 @Path( "getDependencies" )114 @GET115 @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 */122123124 @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 )
134throws ArchivaRestServiceException;
135136137/**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 )
146throws ArchivaRestServiceException;
147148149 }