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.ArtifactMetadata;
25 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
26 import org.apache.archiva.redback.authorization.RedbackAuthorization;
27 import org.apache.archiva.rest.api.model.ArtifactContent;
28 import org.apache.archiva.rest.api.model.ArtifactContentEntry;
29 import org.apache.archiva.rest.api.model.BrowseResult;
30 import org.apache.archiva.rest.api.model.Entry;
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.PUT;
36 import javax.ws.rs.Path;
37 import javax.ws.rs.PathParam;
38 import javax.ws.rs.Produces;
39 import javax.ws.rs.QueryParam;
40 import javax.ws.rs.core.MediaType;
41 import java.util.List;
44 * @author Olivier Lamy
47 @Path ("/browseService/")
48 public interface BrowseService
52 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
53 @RedbackAuthorization (noPermission = true, noRestriction = true)
54 BrowseResult getRootGroups( @QueryParam ("repositoryId") String repositoryId )
55 throws ArchivaRestServiceException;
57 @Path ("browseGroupId/{groupId}")
59 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
60 @RedbackAuthorization (noPermission = true, noRestriction = true)
61 BrowseResult browseGroupId( @PathParam ("groupId") String groupId,
62 @QueryParam ("repositoryId") String repositoryId )
63 throws ArchivaRestServiceException;
65 @Path ("versionsList/{g}/{a}")
67 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
68 @RedbackAuthorization (noPermission = true, noRestriction = true)
69 VersionsList getVersionsList( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
70 @QueryParam ("repositoryId") String repositoryId )
71 throws ArchivaRestServiceException;
73 @Path ("projectVersionMetadata/{g}/{a}")
75 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
76 @RedbackAuthorization (noPermission = true, noRestriction = true)
77 ProjectVersionMetadata getProjectVersionMetadata( @PathParam ("g") String groupId,
78 @PathParam ("a") String artifactId,
79 @QueryParam ("repositoryId") String repositoryId )
80 throws ArchivaRestServiceException;
82 @Path ("projectVersionMetadata/{g}/{a}/{v}")
84 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
85 @RedbackAuthorization (noPermission = true, noRestriction = true)
86 ProjectVersionMetadata getProjectMetadata( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
87 @PathParam ("v") String version,
88 @QueryParam ("repositoryId") String repositoryId )
89 throws ArchivaRestServiceException;
91 @Path ("userRepositories")
93 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
94 @RedbackAuthorization (noPermission = true, noRestriction = true)
96 * @return List of managed repositories current user can read
98 List<ManagedRepository> getUserRepositories()
99 throws ArchivaRestServiceException;
101 @Path ("treeEntries/{g}/{a}/{v}")
103 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
104 @RedbackAuthorization (noPermission = true, noRestriction = true)
106 * return the dependency Tree for an artifacts
107 * <b>the List result has only one entry</b>
109 List<TreeEntry> getTreeEntries( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
110 @PathParam ("v") String version, @QueryParam ("repositoryId") String repositoryId )
111 throws ArchivaRestServiceException;
113 @Path ("dependees/{g}/{a}/{v}")
115 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
116 @RedbackAuthorization (noPermission = true, noRestriction = true)
118 * List of artifacts using the artifact passed in parameter.
120 List<Artifact> getDependees( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
121 @PathParam ("v") String version, @QueryParam ("repositoryId") String repositoryId )
122 throws ArchivaRestServiceException;
124 @Path ("metadatas/{g}/{a}/{v}")
126 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
127 @RedbackAuthorization (noPermission = true, noRestriction = true)
128 List<Entry> getMetadatas( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
129 @PathParam ("v") String version, @QueryParam ("repositoryId") String repositoryId )
130 throws ArchivaRestServiceException;
132 @Path ("metadata/{g}/{a}/{v}/{key}/{value}")
134 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
135 @RedbackAuthorization (noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
136 Boolean addMetadata( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
137 @PathParam ("v") String version, @PathParam ("key") String key,
138 @PathParam ("value") String value, @QueryParam ("repositoryId") String repositoryId )
139 throws ArchivaRestServiceException;
141 @Path ("metadata/{g}/{a}/{v}/{key}")
143 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
144 @RedbackAuthorization (noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
145 Boolean deleteMetadata( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
146 @PathParam ("v") String version, @PathParam ("key") String key,
147 @QueryParam ("repositoryId") String repositoryId )
148 throws ArchivaRestServiceException;
150 @Path ("artifactContentEntries/{g}/{a}/{v}")
152 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
153 @RedbackAuthorization (noPermission = true, noRestriction = true)
154 List<ArtifactContentEntry> getArtifactContentEntries( @PathParam ("g") String groupId,
155 @PathParam ("a") String artifactId,
156 @PathParam ("v") String version,
157 @QueryParam ("c") String classifier,
158 @QueryParam ("t") String type, @QueryParam ("p") String path,
159 @QueryParam ("repositoryId") String repositoryId )
160 throws ArchivaRestServiceException;
162 @Path ("artifactDownloadInfos/{g}/{a}/{v}")
164 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
165 @RedbackAuthorization (noPermission = true, noRestriction = true)
166 List<Artifact> getArtifactDownloadInfos( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
167 @PathParam ("v") String version,
168 @QueryParam ("repositoryId") String repositoryId )
169 throws ArchivaRestServiceException;
171 @Path ("artifactContentText/{g}/{a}/{v}")
173 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
174 @RedbackAuthorization (noPermission = true, noRestriction = true)
176 * if path is empty content of the file is returned (for pom view)
178 ArtifactContent getArtifactContentText( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
179 @PathParam ("v") String version, @QueryParam ("c") String classifier,
180 @QueryParam ("t") String type, @QueryParam ("p") String path,
181 @QueryParam ("repositoryId") String repositoryId )
182 throws ArchivaRestServiceException;
184 @Path ("artifactAvailable/{g}/{a}/{v}")
186 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
187 @RedbackAuthorization (noPermission = true, noRestriction = true)
189 * verify if an artifact is available locally if not download from proxies will be try
192 Boolean artifactAvailable( @PathParam ("g") String groupId, @PathParam ("a") String artifactId,
193 @PathParam ("v") String version, @QueryParam ("repositoryId") String repositoryId )
194 throws ArchivaRestServiceException;
196 @Path ("artifacts/{r}")
198 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
199 @RedbackAuthorization (noPermission = true, noRestriction = true)
202 * return List of all artifacts from this repository
203 * @param repositoryId
205 * @throws ArchivaRestServiceException
208 List<Artifact> getArtifacts( @PathParam ( "r" ) String repositoryId )
209 throws ArchivaRestServiceException;