]> source.dussan.org Git - archiva.git/blob
539a4f13577d9da3ab7d52ffa19adf352fff33b5
[archiva.git] /
1 package org.apache.archiva.rest.api.services;
2 /*
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
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
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
18  * under the License.
19  */
20
21 import org.apache.archiva.admin.model.beans.ManagedRepository;
22 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
23 import org.apache.archiva.redback.authorization.RedbackAuthorization;
24 import org.apache.archiva.rest.api.model.Artifact;
25 import org.apache.archiva.rest.api.model.ArtifactContent;
26 import org.apache.archiva.rest.api.model.ArtifactContentEntry;
27 import org.apache.archiva.rest.api.model.BrowseResult;
28 import org.apache.archiva.rest.api.model.Entry;
29 import org.apache.archiva.rest.api.model.TreeEntry;
30 import org.apache.archiva.rest.api.model.VersionsList;
31
32 import javax.ws.rs.DELETE;
33 import javax.ws.rs.GET;
34 import javax.ws.rs.PUT;
35 import javax.ws.rs.Path;
36 import javax.ws.rs.PathParam;
37 import javax.ws.rs.Produces;
38 import javax.ws.rs.QueryParam;
39 import javax.ws.rs.core.MediaType;
40 import java.util.List;
41
42 /**
43  * @author Olivier Lamy
44  * @since 1.4-M3
45  */
46 @Path( "/browseService/" )
47 public interface BrowseService
48 {
49     @Path( "rootGroups" )
50     @GET
51     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
52     @RedbackAuthorization( noPermission = true, noRestriction = true )
53     BrowseResult getRootGroups( @QueryParam( "repositoryId" ) String repositoryId )
54         throws ArchivaRestServiceException;
55
56     @Path( "browseGroupId/{groupId}" )
57     @GET
58     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
59     @RedbackAuthorization( noPermission = true, noRestriction = true )
60     BrowseResult browseGroupId( @PathParam( "groupId" ) String groupId,
61                                 @QueryParam( "repositoryId" ) String repositoryId )
62         throws ArchivaRestServiceException;
63
64     @Path( "versionsList/{g}/{a}" )
65     @GET
66     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
67     @RedbackAuthorization( noPermission = true, noRestriction = true )
68     VersionsList getVersionsList( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
69                                   @QueryParam( "repositoryId" ) String repositoryId )
70         throws ArchivaRestServiceException;
71
72     @Path( "projectVersionMetadata/{g}/{a}" )
73     @GET
74     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
75     @RedbackAuthorization( noPermission = true, noRestriction = true )
76     ProjectVersionMetadata getProjectVersionMetadata( @PathParam( "g" ) String groupId,
77                                                       @PathParam( "a" ) String artifactId,
78                                                       @QueryParam( "repositoryId" ) String repositoryId )
79         throws ArchivaRestServiceException;
80
81     @Path( "projectVersionMetadata/{g}/{a}/{v}" )
82     @GET
83     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
84     @RedbackAuthorization( noPermission = true, noRestriction = true )
85     ProjectVersionMetadata getProjectMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
86                                                @PathParam( "v" ) String version,
87                                                @QueryParam( "repositoryId" ) String repositoryId )
88         throws ArchivaRestServiceException;
89
90     @Path( "userRepositories" )
91     @GET
92     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
93     @RedbackAuthorization( noPermission = true, noRestriction = true )
94     /**
95      * @return List of managed repositories current user can read
96      */
97     List<ManagedRepository> getUserRepositories()
98         throws ArchivaRestServiceException;
99
100     @Path( "treeEntries/{g}/{a}/{v}" )
101     @GET
102     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
103     @RedbackAuthorization( noPermission = true, noRestriction = true )
104     /**
105      * return the dependency Tree for an artifacts
106      * <b>the List result has only one entry</b>
107      */
108     List<TreeEntry> getTreeEntries( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
109                                     @PathParam( "v" ) String version,
110                                     @QueryParam( "repositoryId" ) String repositoryId )
111         throws ArchivaRestServiceException;
112
113     @Path( "dependees/{g}/{a}/{v}" )
114     @GET
115     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
116     @RedbackAuthorization( noPermission = true, noRestriction = true )
117     /**
118      * List of artifacts using the artifact passed in parameter.
119      */
120     List<Artifact> getDependees( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
121                                  @PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
122         throws ArchivaRestServiceException;
123
124     @Path( "metadatas/{g}/{a}/{v}" )
125     @GET
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;
131
132     @Path( "metadata/{g}/{a}/{v}/{key}/{value}" )
133     @PUT
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;
140
141     @Path( "metadata/{g}/{a}/{v}/{key}" )
142     @DELETE
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;
149
150     @Path( "artifactContentEntries/{g}/{a}/{v}" )
151     @GET
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,
159                                                           @QueryParam( "p" ) String path,
160                                                           @QueryParam( "repositoryId" ) String repositoryId )
161         throws ArchivaRestServiceException;
162
163     @Path( "artifactDownloadInfos/{g}/{a}/{v}" )
164     @GET
165     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
166     @RedbackAuthorization( noPermission = true, noRestriction = true )
167     List<Artifact> getArtifactDownloadInfos( @PathParam( "g" ) String groupId,
168                                                          @PathParam( "a" ) String artifactId,
169                                                          @PathParam( "v" ) String version,
170                                                          @QueryParam( "repositoryId" ) String repositoryId )
171         throws ArchivaRestServiceException;
172
173     @Path( "artifactContentText/{g}/{a}/{v}" )
174     @GET
175     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
176     @RedbackAuthorization( noPermission = true, noRestriction = true )
177     /**
178      * if path is empty content of the file is returned (for pom view)
179      */
180     ArtifactContent getArtifactContentText( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
181                                             @PathParam( "v" ) String version, @QueryParam( "c" ) String classifier,
182                                             @QueryParam( "t" ) String type, @QueryParam( "p" ) String path,
183                                             @QueryParam( "repositoryId" ) String repositoryId )
184         throws ArchivaRestServiceException;
185 }