]> source.dussan.org Git - archiva.git/blob
215bda18824692ba9d8f5b515c289ae8579e828b
[archiva.git] /
1 package org.apache.archiva.web.api;
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.redback.authorization.RedbackAuthorization;
22 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
23 import org.apache.archiva.security.common.ArchivaRoleConstants;
24 import org.apache.archiva.web.model.FileMetadata;
25 import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
26
27 import javax.ws.rs.Consumes;
28 import javax.ws.rs.DELETE;
29 import javax.ws.rs.GET;
30 import javax.ws.rs.POST;
31 import javax.ws.rs.Path;
32 import javax.ws.rs.PathParam;
33 import javax.ws.rs.Produces;
34 import javax.ws.rs.QueryParam;
35 import javax.ws.rs.core.MediaType;
36 import java.util.List;
37
38 /**
39  * @author Olivier Lamy
40  * @since 1.4-M3
41  */
42 @Path( "/fileUploadService/" )
43 public interface FileUploadService
44 {
45
46     String FILES_SESSION_KEY = FileUploadService.class.getName() + "files_session_key";
47
48     @POST
49     @Consumes( MediaType.MULTIPART_FORM_DATA )
50     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
51     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_FILE_UPLOAD )
52     FileMetadata post( MultipartBody multipartBody )
53         throws ArchivaRestServiceException;
54
55     @Path( "{fileName}" )
56     @DELETE
57     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
58     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_FILE_UPLOAD )
59     Boolean deleteFile( @PathParam( "fileName" ) String fileName )
60         throws ArchivaRestServiceException;
61
62
63     @Path( "sessionFileMetadatas" )
64     @GET
65     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
66     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_FILE_UPLOAD )
67     List<FileMetadata> getSessionFileMetadatas()
68         throws ArchivaRestServiceException;
69
70     @Path( "save/{repositoryId}/{groupId}/{artifactId}/{version}/{packaging}" )
71     @GET
72     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
73     @RedbackAuthorization( resource = "{repositoryId}", permissions = ArchivaRoleConstants.OPERATION_REPOSITORY_UPLOAD )
74     Boolean save( @PathParam( "repositoryId" ) String repositoryId, @PathParam( "groupId" ) String groupId,
75                   @PathParam( "artifactId" ) String artifactId, @PathParam( "version" ) String version,
76                   @PathParam( "packaging" ) String packaging, @QueryParam( "generatePom" ) boolean generatePom )
77         throws ArchivaRestServiceException;
78
79
80     @Path( "clearUploadedFiles" )
81     @GET
82     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
83     @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_FILE_UPLOAD )
84     Boolean clearUploadedFiles()
85         throws ArchivaRestServiceException;
86
87 }