1 package org.apache.archiva.web.api;
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.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;
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;
39 * @author Olivier Lamy
42 @Path( "/fileUploadService/" )
43 public interface FileUploadService
46 String FILES_SESSION_KEY = FileUploadService.class.getName() + "files_session_key";
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;
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;
63 @Path( "sessionFileMetadatas" )
65 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
66 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_FILE_UPLOAD )
67 List<FileMetadata> getSessionFileMetadatas()
68 throws ArchivaRestServiceException;
70 @Path( "save/{repositoryId}/{groupId}/{artifactId}/{version}/{packaging}" )
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;
80 @Path( "clearUploadedFiles" )
82 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
83 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_FILE_UPLOAD )
84 Boolean clearUploadedFiles()
85 throws ArchivaRestServiceException;