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.DefaultValue;
31import javax.ws.rs.GET;
32import javax.ws.rs.POST;
33import javax.ws.rs.Path;
34import javax.ws.rs.Produces;
35import javax.ws.rs.QueryParam;
36import javax.ws.rs.core.MediaType;
37import javax.ws.rs.core.Response;
38import java.util.List;
3940 @Path( "/searchService/" )
41publicinterfaceSearchService42 {
43/*44 * quick/general text search which returns a list of artifacts45 * query for an artifact based on a checksum46 * query for all available versions of an artifact, sorted in version significance order47 * query for an artifact's direct dependencies48 * <b>search will be apply on all repositories the current user has karma</b>49 * TODO query for an artifact's dependency tree (as with mvn dependency:tree - no duplicates should be included)50 * TODO query for all artifacts that depend on a given artifact51 */52 @Path( "quickSearch" )
53 @GET
54 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
55 @RedbackAuthorization( noPermission = true, noRestriction = true )
56 List<Artifact> quickSearch( @QueryParam( "queryString" ) String queryString )
57throws ArchivaRestServiceException;
5859/**60 * <b>if not repositories in SearchRequest: search will be apply on all repositories the current user has karma</b>61 */62 @Path( "quickSearchWithRepositories" )
63 @POST
64 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
65 @RedbackAuthorization( noPermission = true, noRestriction = true )
66 List<Artifact> quickSearchWithRepositories( SearchRequest searchRequest )
67throws ArchivaRestServiceException;
6869/**70 * If searchRequest contains repositories, the search will be done only on those repositories.71 * <b>if no repositories, the search will be apply on all repositories the current user has karma</b>72 */73 @Path( "searchArtifacts" )
74 @POST
75 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
76 @RedbackAuthorization( noPermission = true, noRestriction = true )
77 List<Artifact> searchArtifacts( SearchRequest searchRequest )
78throws ArchivaRestServiceException;
7980/**81 * <b>search will be apply on all repositories the current user has karma</b>82 */83 @Path( "getArtifactVersions" )
84 @GET
85 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
86 @RedbackAuthorization( noPermission = true, noRestriction = true )
87 List<Artifact> getArtifactVersions( @QueryParam( "groupId" ) String groupId, //88 @QueryParam( "artifactId" ) String artifactId, //89 @QueryParam( "packaging" ) String packaging )
90throws ArchivaRestServiceException;
919293/**94 * <b>this method applies on Maven Indexer lucene index, so datas not yet indexed won't be available</b>95 */96 @Path( "getAllGroupIds" )
97 @GET
98 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
99 @RedbackAuthorization( noPermission = true, noRestriction = false )
100GroupIdList getAllGroupIds( @QueryParam( "selectedRepos" ) List<String> selectedRepos )
101throws ArchivaRestServiceException;
102103/**104 * @since 1.4-M3105 */106 @Path( "observableRepoIds" )
107 @GET
108 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
109 @RedbackAuthorization( noPermission = true, noRestriction = true )
110StringList getObservablesRepoIds()
111throws ArchivaRestServiceException;
112113/*114 @Path( "getDependencies" )115 @GET116 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )117 @RedbackAuthorization( noPermission = true, noRestriction = true )118 List<Dependency> getDependencies( @QueryParam( "groupId" ) String groupId,119 @QueryParam( "artifactId" ) String artifactId,120 @QueryParam( "version" ) String version )121 throws ArchivaRestServiceException;122 */123124/**125 * Returns a redirect to a artifact file, that matches given search parameter126 * @param repositoryId The repository id (optional)127 * @param groupId The search pattern for the group id of the artifact (required)128 * @param artifactId The search pattern for the artifact id of the artifact (required)129 * @param version The search pattern for the version of the artifact (required)130 * LATEST returns the latest version of the artifact.131 * @param packaging the packaging132 * @param classifier the artifact classifier133 * @param literalVersion true, if the version string should be treated literally, which means134 * LATEST search for versions with LATEST in the version string.135 * false, is default and treats v=LATEST special136 * @return the redirect response, if a artifact was found137 * @throws ArchivaRestServiceException138 */139 @GET
140 @Path( "/artifact" )
141 @Produces( "text/html" )
142 @RedbackAuthorization( noPermission = true, noRestriction = true )
143 Response redirectToArtifactFile( @QueryParam( "r" ) String repositoryId, //144 @QueryParam( "g" ) String groupId, //145 @QueryParam( "a" ) String artifactId, //146 @QueryParam( "v" ) String version, //147 @QueryParam( "p" ) String packaging, //148 @QueryParam( "c" ) String classifier,
149 @DefaultValue( "false" )
150 @QueryParam( "literalVersion" ) Boolean literalVersion)
151throws ArchivaRestServiceException;
152153154/**155 * If searchRequest contains repositories, the search will be done only on those repositories.156 * <b>if no repositories, the search will be apply on all repositories the current user has karma</b>157 */158 @Path( "artifactsByChecksum" )
159 @POST
160 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
161 @RedbackAuthorization( noPermission = true, noRestriction = true )
162 List<Artifact> getArtifactByChecksum( ChecksumSearch checksumSearch )
163throws ArchivaRestServiceException;
164165166 }