You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FileUploadService.java 3.4KB

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