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