1 package org.apache.archiva.rest.api.services;
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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
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;
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;
43 * @author Olivier Lamy
46 @Path( "/browseService/" )
47 public interface BrowseService
51 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
52 @RedbackAuthorization( noPermission = true, noRestriction = true )
53 BrowseResult getRootGroups( @QueryParam( "repositoryId" ) String repositoryId )
54 throws ArchivaRestServiceException;
56 @Path( "browseGroupId/{groupId}" )
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;
64 @Path( "versionsList/{g}/{a}" )
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;
72 @Path( "projectVersionMetadata/{g}/{a}" )
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;
81 @Path( "projectVersionMetadata/{g}/{a}/{v}" )
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;
90 @Path( "userRepositories" )
92 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
93 @RedbackAuthorization( noPermission = true, noRestriction = true )
95 * @return List of managed repositories current user can read
97 List<ManagedRepository> getUserRepositories()
98 throws ArchivaRestServiceException;
100 @Path( "treeEntries/{g}/{a}/{v}" )
102 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
103 @RedbackAuthorization( noPermission = true, noRestriction = true )
105 * return the dependency Tree for an artifacts
106 * <b>the List result has only one entry</b>
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;
113 @Path( "dependees/{g}/{a}/{v}" )
115 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
116 @RedbackAuthorization( noPermission = true, noRestriction = true )
118 * List of artifacts using the artifact passed in parameter.
120 List<Artifact> getDependees( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
121 @PathParam( "v" ) String version, @QueryParam( "repositoryId" ) String repositoryId )
122 throws ArchivaRestServiceException;
124 @Path( "metadatas/{g}/{a}/{v}" )
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;
132 @Path( "metadata/{g}/{a}/{v}/{key}/{value}" )
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;
141 @Path( "metadata/{g}/{a}/{v}/{key}" )
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;
150 @Path( "artifactContentEntries/{g}/{a}/{v}" )
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;
163 @Path( "artifactDownloadInfos/{g}/{a}/{v}" )
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;
173 @Path( "artifactContentText/{g}/{a}/{v}" )
175 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
176 @RedbackAuthorization( noPermission = true, noRestriction = true )
178 * if path is empty content of the file is returned (for pom view)
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;