]> source.dussan.org Git - archiva.git/blob
7a47163ba82f7e16c73d71bb66facba953193de0
[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.TreeEntry;
26 import org.apache.archiva.rest.api.model.VersionsList;
27 import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
28
29 import javax.ws.rs.DELETE;
30 import javax.ws.rs.GET;
31 import javax.ws.rs.PUT;
32 import javax.ws.rs.Path;
33 import javax.ws.rs.PathParam;
34 import javax.ws.rs.Produces;
35 import javax.ws.rs.QueryParam;
36 import javax.ws.rs.core.MediaType;
37 import java.util.List;
38 import java.util.Map;
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     List<ManagedRepository> getUserRepositories()
93         throws ArchivaRestServiceException;
94
95     @Path( "treeEntries/{g}/{a}/{v}" )
96     @GET
97     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
98     @RedbackAuthorization( noPermission = true, noRestriction = true )
99     List<TreeEntry> getTreeEntries( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
100                                     @PathParam( "v" ) String version,
101                                     @QueryParam( "repositoryId" ) String repositoryId )
102         throws ArchivaRestServiceException;
103
104     @Path( "dependees/{g}/{a}/{v}" )
105     @GET
106     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
107     @RedbackAuthorization( noPermission = true, noRestriction = true )
108     List<Artifact> getDependees( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
109                                  @PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
110         throws ArchivaRestServiceException;
111
112     @Path( "metadatas/{g}/{a}/{v}" )
113     @GET
114     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
115     @RedbackAuthorization( noPermission = true, noRestriction = true )
116     Map<String, String> getMetadatas( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
117                                       @PathParam( "v" ) String version,
118                                       @QueryParam( "repositoryId" ) String repositoryId )
119         throws ArchivaRestServiceException;
120
121     @Path( "metadata/{g}/{a}/{v}/{key}/{value}" )
122     @PUT
123     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
124     @RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
125     Boolean addMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
126                          @PathParam( "v" ) String version, @PathParam( "key" ) String key,
127                          @PathParam( "value" ) String value, @QueryParam( "repositoryId" ) String repositoryId )
128         throws ArchivaRestServiceException;
129
130     @Path( "metadata/{g}/{a}/{v}/{key}" )
131     @DELETE
132     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
133     @RedbackAuthorization( noPermission = false, noRestriction = false, permissions = "archiva-add-metadata" )
134     Boolean deleteMetadata( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
135                             @PathParam( "v" ) String version, @PathParam( "key" ) String key,
136                             @QueryParam( "repositoryId" ) String repositoryId )
137         throws ArchivaRestServiceException;
138 }