001package org.apache.archiva.rest.api.services; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 023import org.apache.archiva.maven2.model.Artifact; 024import org.apache.archiva.redback.authorization.RedbackAuthorization; 025import org.apache.archiva.rest.api.model.ChecksumSearch; 026import org.apache.archiva.rest.api.model.GroupIdList; 027import org.apache.archiva.rest.api.model.SearchRequest; 028import org.apache.archiva.rest.api.model.StringList; 029 030import javax.ws.rs.GET; 031import javax.ws.rs.POST; 032import javax.ws.rs.Path; 033import javax.ws.rs.Produces; 034import javax.ws.rs.QueryParam; 035import javax.ws.rs.core.MediaType; 036import javax.ws.rs.core.Response; 037import java.util.List; 038 039@Path( "/searchService/" ) 040public interface SearchService 041{ 042 /* 043 * quick/general text search which returns a list of artifacts 044 * query for an artifact based on a checksum 045 * query for all available versions of an artifact, sorted in version significance order 046 * query for an artifact's direct dependencies 047 * <b>search will be apply on all repositories the current user has karma</b> 048 * TODO query for an artifact's dependency tree (as with mvn dependency:tree - no duplicates should be included) 049 * TODO query for all artifacts that depend on a given artifact 050 */ 051 @Path( "quickSearch" ) 052 @GET 053 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 054 @RedbackAuthorization( noPermission = true, noRestriction = true ) 055 List<Artifact> quickSearch( @QueryParam( "queryString" ) String queryString ) 056 throws ArchivaRestServiceException; 057 058 /** 059 * <b>if not repositories in SearchRequest: search will be apply on all repositories the current user has karma</b> 060 */ 061 @Path( "quickSearchWithRepositories" ) 062 @POST 063 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 064 @RedbackAuthorization( noPermission = true, noRestriction = true ) 065 List<Artifact> quickSearchWithRepositories( SearchRequest searchRequest ) 066 throws ArchivaRestServiceException; 067 068 /** 069 * If searchRequest contains repositories, the search will be done only on those repositories. 070 * <b>if no repositories, the search will be apply on all repositories the current user has karma</b> 071 */ 072 @Path( "searchArtifacts" ) 073 @POST 074 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 075 @RedbackAuthorization( noPermission = true, noRestriction = true ) 076 List<Artifact> searchArtifacts( SearchRequest searchRequest ) 077 throws ArchivaRestServiceException; 078 079 /** 080 * <b>search will be apply on all repositories the current user has karma</b> 081 */ 082 @Path( "getArtifactVersions" ) 083 @GET 084 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 085 @RedbackAuthorization( noPermission = true, noRestriction = true ) 086 List<Artifact> getArtifactVersions( @QueryParam( "groupId" ) String groupId, // 087 @QueryParam( "artifactId" ) String artifactId, // 088 @QueryParam( "packaging" ) String packaging ) 089 throws ArchivaRestServiceException; 090 091 092 /** 093 * <b>this method applies on Maven Indexer lucene index, so datas not yet indexed won't be available</b> 094 */ 095 @Path( "getAllGroupIds" ) 096 @GET 097 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 098 @RedbackAuthorization( noPermission = true, noRestriction = false ) 099 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}