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 the dependency Tree for an artifacts
106 * <b>the List result has only one entry</b>
108 @Path("treeEntries/{g}/{a}/{v}")
110 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
111 @RedbackAuthorization(noPermission = true, noRestriction = true)
112 List<TreeEntry> getTreeEntries( @PathParam("g") String groupId, @PathParam("a") String artifactId,
113 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
114 throws ArchivaRestServiceException;
117 * List of artifacts using the artifact passed in parameter.
119 @Path("dependees/{g}/{a}/{v}")
121 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
122 @RedbackAuthorization(noPermission = true, noRestriction = true)
123 List<Artifact> getDependees( @PathParam("g") String groupId, @PathParam("a") String artifactId,
124 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
125 throws ArchivaRestServiceException;
127 @Path("metadatas/{g}/{a}/{v}")
129 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
130 @RedbackAuthorization(noPermission = true, noRestriction = true)
131 List<Entry> getMetadatas( @PathParam("g") String groupId, @PathParam("a") String artifactId,
132 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
133 throws ArchivaRestServiceException;
135 @Path("metadata/{g}/{a}/{v}/{key}/{value}")
137 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
138 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
139 Boolean addMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
140 @PathParam("v") String version, @PathParam("key") String key, @PathParam("value") String value,
141 @QueryParam("repositoryId") String repositoryId )
142 throws ArchivaRestServiceException;
144 @Path("metadata/{g}/{a}/{v}/{key}")
146 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
147 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
148 Boolean deleteMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
149 @PathParam("v") String version, @PathParam("key") String key,
150 @QueryParam("repositoryId") String repositoryId )
151 throws ArchivaRestServiceException;
153 @Path("importMetadata")
155 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
156 Boolean importMetadata( MetadataAddRequest metadataAddRequest, @QueryParam("repository") String repository )
157 throws ArchivaRestServiceException;
159 @Path("artifactContentEntries/{g}/{a}/{v}")
161 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
162 @RedbackAuthorization(noPermission = true, noRestriction = true)
163 List<ArtifactContentEntry> getArtifactContentEntries( @PathParam("g") String groupId,
164 @PathParam("a") String artifactId,
165 @PathParam("v") String version,
166 @QueryParam("c") String classifier,
167 @QueryParam("t") String type, @QueryParam("p") String path,
168 @QueryParam("repositoryId") String repositoryId )
169 throws ArchivaRestServiceException;
171 @Path("artifactDownloadInfos/{g}/{a}/{v}")
173 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
174 @RedbackAuthorization(noPermission = true, noRestriction = true)
175 List<Artifact> getArtifactDownloadInfos( @PathParam("g") String groupId, @PathParam("a") String artifactId,
176 @PathParam("v") String version,
177 @QueryParam("repositoryId") String repositoryId )
178 throws ArchivaRestServiceException;
181 * if path is empty content of the file is returned (for pom view)
183 @Path("artifactContentText/{g}/{a}/{v}")
185 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
186 @RedbackAuthorization(noPermission = true, noRestriction = true)
187 ArtifactContent getArtifactContentText( @PathParam("g") String groupId, @PathParam("a") String artifactId,
188 @PathParam("v") String version, @QueryParam("c") String classifier,
189 @QueryParam("t") String type, @QueryParam("p") String path,
190 @QueryParam("repositoryId") String repositoryId )
191 throws ArchivaRestServiceException;
194 * verify if an artifact is available locally if not download from proxies will be try
198 @Path("artifactAvailable/{g}/{a}/{v}")
200 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
201 @RedbackAuthorization(noPermission = true, noRestriction = true)
202 Boolean artifactAvailable( @PathParam("g") String groupId, @PathParam("a") String artifactId,
203 @PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
204 throws ArchivaRestServiceException;
207 * verify if an artifact is available locally if not download from proxies will be try
211 @Path( "artifactAvailable/{g}/{a}/{v}/{c}" )
213 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
214 @RedbackAuthorization( noPermission = true, noRestriction = true )
215 Boolean artifactAvailable( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
216 @PathParam( "v" ) String version, @PathParam( "c" ) String classifier,
217 @QueryParam( "repositoryId" ) String repositoryId )
218 throws ArchivaRestServiceException;
221 * return List of all artifacts from this repository
223 * @param repositoryId
225 * @throws ArchivaRestServiceException
228 @Path("artifacts/{r}")
230 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
231 @RedbackAuthorization(noPermission = true, noRestriction = true)
232 List<Artifact> getArtifacts( @PathParam("r") String repositoryId )
233 throws ArchivaRestServiceException;
236 * Return List of artifacts from this repository with project version level metadata key matching value. If
237 * repository is not provided the search runs in all repositories.
241 * @param repositoryId
243 * @throws ArchivaRestServiceException
246 @Path( "artifactsByProjectVersionMetadata/{key}/{value}" )
248 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
249 @RedbackAuthorization( noPermission = true, noRestriction = true )
250 List<Artifact> getArtifactsByProjectVersionMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
251 @QueryParam("repositoryId") String repositoryId )
252 throws ArchivaRestServiceException;
255 * Return List of artifacts from this repository with artifact metadata key matching value.
256 * If repository is not provided the search runs in all repositories.
260 * @param repositoryId
262 * @throws ArchivaRestServiceException
265 @Path( "artifactsByMetadata/{key}/{value}" )
267 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
268 @RedbackAuthorization( noPermission = true, noRestriction = true )
269 List<Artifact> getArtifactsByMetadata( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
270 @QueryParam("repositoryId") String repositoryId )
271 throws ArchivaRestServiceException;
274 * Return List of artifacts from this repository with property key matching value.
275 * If repository is not provided the search runs in all repositories.
279 * @param repositoryId
281 * @throws ArchivaRestServiceException
284 @Path( "artifactsByProperty/{key}/{value}" )
286 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
287 @RedbackAuthorization( noPermission = true, noRestriction = true )
288 List<Artifact> getArtifactsByProperty( @PathParam( "key" ) String key, @PathParam( "value" ) String value,
289 @QueryParam("repositoryId") String repositoryId )
290 throws ArchivaRestServiceException;
293 * Search artifacts with any property matching text. If repository is not provided the search runs in all
294 * repositories. If exact is true only the artifacts whose property match exactly are returned.
297 * @param repositoryId
300 * @throws ArchivaRestServiceException
303 @Path( "searchArtifacts/{text}" )
305 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
306 @RedbackAuthorization( noPermission = true, noRestriction = true )
307 List<Artifact> searchArtifacts( @PathParam( "text" ) String text,
308 @QueryParam( "repositoryId" ) String repositoryId,
309 @QueryParam( "exact" ) Boolean exact )
310 throws ArchivaRestServiceException;
313 * Search artifacts with the property specified by key matching text. If repository is not provided the search runs
314 * in all repositories. If exact is true only the artifacts whose property match exactly are returned.
318 * @param repositoryId
321 * @throws ArchivaRestServiceException
324 @Path( "searchArtifacts/{key}/{text}" )
326 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
327 @RedbackAuthorization( noPermission = true, noRestriction = true )
328 List<Artifact> searchArtifacts( @PathParam( "key" ) String key, @PathParam( "text" ) String text,
329 @QueryParam( "repositoryId" ) String repositoryId,
330 @QueryParam( "exact" ) Boolean exact )
331 throws ArchivaRestServiceException;