1 package org.apache.archiva.rest.api.services;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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;
32
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;
43
44
45
46
47
48 @Path("/browseService/")
49 public interface BrowseService
50 {
51 @Path("rootGroups")
52 @GET
53 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
54 @RedbackAuthorization(noPermission = true, noRestriction = true)
55 BrowseResult getRootGroups( @QueryParam("repositoryId") String repositoryId )
56 throws ArchivaRestServiceException;
57
58
59
60
61
62 @Path("browseGroupId/{groupId}")
63 @GET
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;
68
69 @Path("versionsList/{g}/{a}")
70 @GET
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;
76
77 @Path("projectVersionMetadata/{g}/{a}")
78 @GET
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;
84
85 @Path("projectVersionMetadata/{g}/{a}/{v}")
86 @GET
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;
93
94
95
96
97 @Path("userRepositories")
98 @GET
99 @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
100 @RedbackAuthorization(noPermission = true, noRestriction = true)
101 List<ManagedRepository> getUserRepositories()
102 throws ArchivaRestServiceException;
103
104
105
106
107
108 @Path("treeEntries/{g}/{a}/{v}")
109 @GET
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;
115
116
117
118
119 @Path("dependees/{g}/{a}/{v}")
120 @GET
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;
126
127 @Path("metadatas/{g}/{a}/{v}")
128 @GET
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;
134
135 @Path("metadata/{g}/{a}/{v}/{key}/{value}")
136 @PUT
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;
143
144 @Path("metadata/{g}/{a}/{v}/{key}")
145 @DELETE
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;
152
153 @Path("importMetadata")
154 @POST
155 @RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
156 Boolean importMetadata( MetadataAddRequest metadataAddRequest, @QueryParam("repository") String repository )
157 throws ArchivaRestServiceException;
158
159 @Path("artifactContentEntries/{g}/{a}/{v}")
160 @GET
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;
170
171 @Path("artifactDownloadInfos/{g}/{a}/{v}")
172 @GET
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;
179
180
181
182
183 @Path("artifactContentText/{g}/{a}/{v}")
184 @GET
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;
192
193
194
195
196
197
198 @Path("artifactAvailable/{g}/{a}/{v}")
199 @GET
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;
205
206
207
208
209
210
211 @Path( "artifactAvailable/{g}/{a}/{v}/{c}" )
212 @GET
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;
219
220
221
222
223
224
225
226
227
228 @Path("artifacts/{r}")
229 @GET
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;
234 }