]> source.dussan.org Git - archiva.git/blob
a0d9275b1133d08d367d748d3aa505e370a2f902
[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.rest.api.model.Artifact;
24 import org.apache.archiva.rest.api.model.ArtifactContentEntry;
25 import org.apache.archiva.rest.api.model.BrowseResult;
26 import org.apache.archiva.rest.api.model.Entry;
27 import org.apache.archiva.rest.api.model.TreeEntry;
28 import org.apache.archiva.rest.api.model.VersionsList;
29 import org.apache.archiva.redback.authorization.RedbackAuthorization;
30
31 import javax.ws.rs.DELETE;
32 import javax.ws.rs.GET;
33 import javax.ws.rs.PUT;
34 import javax.ws.rs.Path;
35 import javax.ws.rs.PathParam;
36 import javax.ws.rs.Produces;
37 import javax.ws.rs.QueryParam;
38 import javax.ws.rs.core.MediaType;
39 import java.util.List;
40
41 /**
42  * @author Olivier Lamy
43  * @since 1.4-M3
44  */
45 @Path( "/browseService/" )
46 public interface BrowseService
47 {
48     @Path( "rootGroups" )
49     @GET
50     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
51     @RedbackAuthorization( noPermission = true, noRestriction = true )
52     BrowseResult getRootGroups( @QueryParam( "repositoryId" ) String repositoryId )
53         throws ArchivaRestServiceException;
54
55     @Path( "browseGroupId/{groupId}" )
56     @GET
57     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
58     @RedbackAuthorization( noPermission = true, noRestriction = true )
59     BrowseResult browseGroupId( @PathParam( "groupId" ) String groupId,
60                                 @QueryParam( "repositoryId" ) String repositoryId )
61         throws ArchivaRestServiceException;
62
63     @Path( "versionsList/{g}/{a}" )
64     @GET
65     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
66     @RedbackAuthorization( noPermission = true, noRestriction = true )
67     VersionsList getVersionsList( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
68                                   @QueryParam( "repositoryId" ) String repositoryId )
69         throws ArchivaRestServiceException;
70
71     @Path( "projectVersionMetadata/{g}/{a}" )
72     @GET
73     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
74     @RedbackAuthorization( noPermission = true, noRestriction = true )
75     ProjectVersionMetadata getProjectVersionMetadata( @PathParam( "g" ) String groupId,
76                                                       @PathParam( "a" ) String artifactId,
77                                                       @QueryParam( "repositoryId" ) String repositoryId )
78         throws ArchivaRestServiceException;
79
80     @Path( "projectVersionMetadata/{g}/{a}/{v}" )
81     @GET
82     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
83     @RedbackAuthorization( noPermission = true, noRestriction = true )
84     ProjectVersionMetadata getProjectMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
85                                                @PathParam( "v" ) String version,
86                                                @QueryParam( "repositoryId" ) String repositoryId )
87         throws ArchivaRestServiceException;
88
89     @Path( "userRepositories" )
90     @GET
91     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
92     @RedbackAuthorization( noPermission = true, noRestriction = true )
93     /**
94      * @return List of managed repositories current user can read
95      */
96     List<ManagedRepository> getUserRepositories()
97         throws ArchivaRestServiceException;
98
99     @Path( "treeEntries/{g}/{a}/{v}" )
100     @GET
101     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
102     @RedbackAuthorization( noPermission = true, noRestriction = true )
103     /**
104      * return the dependency Tree for an artifacts
105      * <b>the List result has only one entry</b>
106      */
107     List<TreeEntry> getTreeEntries( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
108                                     @PathParam( "v" ) String version,
109                                     @QueryParam( "repositoryId" ) String repositoryId )
110         throws ArchivaRestServiceException;
111
112     @Path( "dependees/{g}/{a}/{v}" )
113     @GET
114     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
115     @RedbackAuthorization( noPermission = true, noRestriction = true )
116     /**
117      * List of artifacts using the artifact passed in parameter.
118      */
119     List<Artifact> getDependees( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
120                                  @PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
121         throws ArchivaRestServiceException;
122
123     @Path( "metadatas/{g}/{a}/{v}" )
124     @GET
125     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
126     @RedbackAuthorization( noPermission = true, noRestriction = true )
127     List<Entry> getMetadatas( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
128                               @PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
129         throws ArchivaRestServiceException;
130
131     @Path( "metadata/{g}/{a}/{v}/{key}/{value}" )
132     @PUT
133     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
134     @RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
135     Boolean addMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
136                          @PathParam( "v" ) String version, @PathParam( "key" ) String key,
137                          @PathParam( "value" ) String value, @QueryParam( "repositoryId" ) String repositoryId )
138         throws ArchivaRestServiceException;
139
140     @Path( "metadata/{g}/{a}/{v}/{key}" )
141     @DELETE
142     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
143     @RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
144     Boolean deleteMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
145                             @PathParam( "v" ) String version, @PathParam( "key" ) String key,
146                             @QueryParam( "repositoryId" ) String repositoryId )
147         throws ArchivaRestServiceException;
148
149     @Path( "artifactContentEntries/{g}/{a}/{v}" )
150     @GET
151     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
152     @RedbackAuthorization( noPermission = true, noRestriction = true )
153     List<ArtifactContentEntry> getArtifactContentEntries( @PathParam( "g" ) String groupId,
154                                                           @PathParam( "a" ) String artifactId,
155                                                           @PathParam( "v" ) String version,
156                                                           @QueryParam( "c" ) String classifier,
157                                                           @QueryParam( "t" ) String type,
158                                                           @QueryParam( "p" ) String path,
159                                                           @QueryParam( "repositoryId" ) String repositoryId )
160         throws ArchivaRestServiceException;
161 }