1 package org.apache.archiva.rest.api.services;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import org.apache.archiva.admin.model.beans.ManagedRepository;
22 import org.apache.archiva.maven2.model.Artifact;
23 import org.apache.archiva.maven2.model.TreeEntry;
24 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
25 import org.apache.archiva.redback.authorization.RedbackAuthorization;
26 import org.apache.archiva.rest.api.model.ArtifactContent;
27 import org.apache.archiva.rest.api.model.ArtifactContentEntry;
28 import org.apache.archiva.rest.api.model.BrowseResult;
29 import org.apache.archiva.rest.api.model.Entry;
30 import org.apache.archiva.rest.api.model.MetadataAddRequest;
31 import org.apache.archiva.rest.api.model.VersionsList;
33 import javax.ws.rs.DELETE;
34 import javax.ws.rs.GET;
35 import javax.ws.rs.POST;
36 import javax.ws.rs.PUT;
37 import javax.ws.rs.Path;
38 import javax.ws.rs.PathParam;
39 import javax.ws.rs.Produces;
40 import javax.ws.rs.QueryParam;
41 import javax.ws.rs.core.MediaType;
42 import java.util.List;
45 * @author Olivier Lamy
48 @Path("/browseService/")
49 public interface BrowseService
53 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
54 @RedbackAuthorization(noPermission = true, noRestriction = true)
55 BrowseResult getRootGroups( @QueryParam("repositoryId") String repositoryId )
56 throws ArchivaRestServiceException;
59 * @param groupId groupId to browse
60 * @param repositoryId optionnal (repository to browse if <code>null</code> all available user repositories are used)
62 @Path("browseGroupId/{groupId}")
64 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
65 @RedbackAuthorization(noPermission = true, noRestriction = true)
66 BrowseResult browseGroupId( @PathParam("groupId") String groupId, @QueryParam("repositoryId") String repositoryId )
67 throws ArchivaRestServiceException;
69 @Path("versionsList/{g}/{a}")
71 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
72 @RedbackAuthorization(noPermission = true, noRestriction = true)
73 VersionsList getVersionsList( @PathParam("g") String groupId, @PathParam("a") String artifactId,
74 @QueryParam("repositoryId") String repositoryId )
75 throws ArchivaRestServiceException;
77 @Path("projectVersionMetadata/{g}/{a}")
79 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
80 @RedbackAuthorization(noPermission = true, noRestriction = true)
81 ProjectVersionMetadata getProjectVersionMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
82 @QueryParam("repositoryId") String repositoryId )
83 throws ArchivaRestServiceException;
85 @Path("projectVersionMetadata/{g}/{a}/{v}")
87 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
88 @RedbackAuthorization(noPermission = true, noRestriction = true)
89 ProjectVersionMetadata getProjectMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
90 @PathParam("v") String version,
91 @QueryParam("repositoryId") String repositoryId )
92 throws ArchivaRestServiceException;
95 * @return List of managed repositories current user can read
97 @Path("userRepositories")
99 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
100 @RedbackAuthorization(noPermission = true, noRestriction = true)
101 List<ManagedRepository> getUserRepositories()
102 throws ArchivaRestServiceException;
105 * @return List of repositories current user can manage
107 @Path("userManagableRepositories")
109 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
110 @RedbackAuthorization(noPermission = true, noRestriction = true)
111 List<ManagedRepository> getUserManagableRepositories()
112 throws ArchivaRestServiceException;
115 * return the dependency Tree for an artifacts
116 * <b>the List result has only one entry</b>
118 @Path("treeEntries/{g}/{a}/{v}")
120 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
121 @RedbackAuthorization(noPermission = true, noRestriction = true)
122 List<TreeEntry> getTreeEntries( @PathParam("g") String groupId, @PathParam("a") String artifactId,
123 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
124 throws ArchivaRestServiceException;
127 * List of artifacts using the artifact passed in parameter.
129 @Path("dependees/{g}/{a}/{v}")
131 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
132 @RedbackAuthorization(noPermission = true, noRestriction = true)
133 List<Artifact> getDependees( @PathParam("g") String groupId, @PathParam("a") String artifactId,
134 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
135 throws ArchivaRestServiceException;
137 @Path("metadatas/{g}/{a}/{v}")
139 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
140 @RedbackAuthorization(noPermission = true, noRestriction = true)
141 List<Entry> getMetadatas( @PathParam("g") String groupId, @PathParam("a") String artifactId,
142 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
143 throws ArchivaRestServiceException;
145 @Path("metadata/{g}/{a}/{v}/{key}/{value}")
147 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
148 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
149 Boolean addMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
150 @PathParam("v") String version, @PathParam("key") String key, @PathParam("value") String value,
151 @QueryParam("repositoryId") String repositoryId )
152 throws ArchivaRestServiceException;
154 @Path("metadata/{g}/{a}/{v}/{key}")
156 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
157 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
158 Boolean deleteMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
159 @PathParam("v") String version, @PathParam("key") String key,
160 @QueryParam("repositoryId") String repositoryId )
161 throws ArchivaRestServiceException;
163 @Path("importMetadata")
165 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
166 Boolean importMetadata( MetadataAddRequest metadataAddRequest, @QueryParam("repository") String repository )
167 throws ArchivaRestServiceException;
169 @Path("artifactContentEntries/{g}/{a}/{v}")
171 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
172 @RedbackAuthorization(noPermission = true, noRestriction = true)
173 List<ArtifactContentEntry> getArtifactContentEntries( @PathParam("g") String groupId,
174 @PathParam("a") String artifactId,
175 @PathParam("v") String version,
176 @QueryParam("c") String classifier,
177 @QueryParam("t") String type, @QueryParam("p") String path,
178 @QueryParam("repositoryId") String repositoryId )
179 throws ArchivaRestServiceException;
181 @Path("artifactDownloadInfos/{g}/{a}/{v}")
183 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
184 @RedbackAuthorization(noPermission = true, noRestriction = true)
185 List<Artifact> getArtifactDownloadInfos( @PathParam("g") String groupId, @PathParam("a") String artifactId,
186 @PathParam("v") String version,
187 @QueryParam("repositoryId") String repositoryId )
188 throws ArchivaRestServiceException;
191 * if path is empty content of the file is returned (for pom view)
193 @Path("artifactContentText/{g}/{a}/{v}")
195 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
196 @RedbackAuthorization(noPermission = true, noRestriction = true)
197 ArtifactContent getArtifactContentText( @PathParam("g") String groupId, @PathParam("a") String artifactId,
198 @PathParam("v") String version, @QueryParam("c") String classifier,
199 @QueryParam("t") String type, @QueryParam("p") String path,
200 @QueryParam("repositoryId") String repositoryId )
201 throws ArchivaRestServiceException;
204 * verify if an artifact is available locally if not download from proxies will be try
208 @Path("artifactAvailable/{g}/{a}/{v}")
210 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
211 @RedbackAuthorization(noPermission = true, noRestriction = true)
212 Boolean artifactAvailable( @PathParam("g") String groupId, @PathParam("a") String artifactId,
213 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
214 throws ArchivaRestServiceException;
217 * verify if an artifact is available locally if not download from proxies will be try
221 @Path( "artifactAvailable/{g}/{a}/{v}/{c}" )
223 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
224 @RedbackAuthorization( noPermission = true, noRestriction = true )
225 Boolean artifactAvailable( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
226 @PathParam( "v" ) String version, @PathParam( "c" ) String classifier,
227 @QueryParam( "repositoryId" ) String repositoryId )
228 throws ArchivaRestServiceException;
231 * return List of all artifacts from this repository
233 * @param repositoryId
235 * @throws ArchivaRestServiceException
238 @Path("artifacts/{r}")
240 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
241 @RedbackAuthorization(noPermission = true, noRestriction = true)
242 List<Artifact> getArtifacts( @PathParam("r") String repositoryId )
243 throws ArchivaRestServiceException;
246 * Return List of artifacts from this repository with project version level metadata key matching value. If
247 * repository is not provided the search runs in all repositories.
251 * @param repositoryId
253 * @throws ArchivaRestServiceException
256 @Path( "artifactsByProjectVersionMetadata/{key}/{value}" )
258 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
259 @RedbackAuthorization( noPermission = true, noRestriction = true )
260 List<Artifact> getArtifactsByProjectVersionMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
261 @QueryParam("repositoryId") String repositoryId )
262 throws ArchivaRestServiceException;
265 * Return List of artifacts from this repository with artifact metadata key matching value.
266 * If repository is not provided the search runs in all repositories.
270 * @param repositoryId
272 * @throws ArchivaRestServiceException
275 @Path( "artifactsByMetadata/{key}/{value}" )
277 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
278 @RedbackAuthorization( noPermission = true, noRestriction = true )
279 List<Artifact> getArtifactsByMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
280 @QueryParam("repositoryId") String repositoryId )
281 throws ArchivaRestServiceException;
284 * Return List of artifacts from this repository with property key matching value.
285 * If repository is not provided the search runs in all repositories.
289 * @param repositoryId
291 * @throws ArchivaRestServiceException
294 @Path( "artifactsByProperty/{key}/{value}" )
296 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
297 @RedbackAuthorization( noPermission = true, noRestriction = true )
298 List<Artifact> getArtifactsByProperty( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
299 @QueryParam("repositoryId") String repositoryId )
300 throws ArchivaRestServiceException;
303 * Search artifacts with any property matching text. If repository is not provided the search runs in all
304 * repositories. If exact is true only the artifacts whose property match exactly are returned.
307 * @param repositoryId
310 * @throws ArchivaRestServiceException
313 @Path( "searchArtifacts/{text}" )
315 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
316 @RedbackAuthorization( noPermission = true, noRestriction = true )
317 List<Artifact> searchArtifacts( @PathParam( "text" ) String text,
318 @QueryParam( "repositoryId" ) String repositoryId,
319 @QueryParam( "exact" ) Boolean exact )
320 throws ArchivaRestServiceException;
323 * Search artifacts with the property specified by key matching text. If repository is not provided the search runs
324 * in all repositories. If exact is true only the artifacts whose property match exactly are returned.
328 * @param repositoryId
331 * @throws ArchivaRestServiceException
334 @Path( "searchArtifacts/{key}/{text}" )
336 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
337 @RedbackAuthorization( noPermission = true, noRestriction = true )
338 List<Artifact> searchArtifacts( @PathParam( "key" ) String key, @PathParam( "text" ) String text,
339 @QueryParam( "repositoryId" ) String repositoryId,
340 @QueryParam( "exact" ) Boolean exact )
341 throws ArchivaRestServiceException;