001 package org.apache.archiva.rest.api.services; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 import org.apache.archiva.maven2.model.Artifact; 023 import org.apache.archiva.redback.authorization.RedbackAuthorization; 024 import org.apache.archiva.repository.scanner.RepositoryScanStatistics; 025 import org.apache.archiva.rest.api.model.ArtifactTransferRequest; 026 import org.apache.archiva.security.common.ArchivaRoleConstants; 027 028 import javax.ws.rs.Consumes; 029 import javax.ws.rs.DELETE; 030 import javax.ws.rs.GET; 031 import javax.ws.rs.POST; 032 import javax.ws.rs.Path; 033 import javax.ws.rs.PathParam; 034 import javax.ws.rs.Produces; 035 import javax.ws.rs.QueryParam; 036 import javax.ws.rs.core.MediaType; 037 038 /** 039 * @author Olivier Lamy 040 * @since 1.4-M1 041 */ 042 @Path ("/repositoriesService/") 043 public interface RepositoriesService 044 { 045 046 /** 047 * index repository 048 */ 049 @Path ("scanRepository") 050 @GET 051 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 052 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER) 053 Boolean scanRepository( @QueryParam ("repositoryId") String repositoryId, 054 @QueryParam ("fullScan") boolean fullScan ) 055 throws ArchivaRestServiceException; 056 057 058 /** 059 * scan directories 060 * @since 1.4-M3 061 */ 062 @Path ("scanRepositoryDirectoriesNow/{repositoryId}") 063 @GET 064 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 065 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER) 066 RepositoryScanStatistics scanRepositoryDirectoriesNow( @PathParam ("repositoryId") String repositoryId ) 067 throws ArchivaRestServiceException; 068 069 070 @Path ("alreadyScanning/{repositoryId}") 071 @GET 072 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 073 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER) 074 Boolean alreadyScanning( @PathParam ("repositoryId") String repositoryId ) 075 throws ArchivaRestServiceException; 076 077 @Path ("removeScanningTaskFromQueue/{repositoryId}") 078 @GET 079 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 080 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER) 081 Boolean removeScanningTaskFromQueue( @PathParam ("repositoryId") String repositoryId ) 082 throws ArchivaRestServiceException; 083 084 @Path ("scanRepositoryNow") 085 @GET 086 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 087 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER) 088 Boolean scanRepositoryNow( @QueryParam ("repositoryId") String repositoryId, 089 @QueryParam ("fullScan") boolean fullScan ) 090 throws ArchivaRestServiceException; 091 092 /** 093 * permissions are checked in impl 094 * will copy an artifact from the source repository to the target repository 095 */ 096 @Path ("copyArtifact") 097 @POST 098 @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) 099 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 100 @RedbackAuthorization (noPermission = true) 101 Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest ) 102 throws ArchivaRestServiceException; 103 104 @Path ("scheduleDownloadRemoteIndex") 105 @GET 106 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 107 @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER) 108 Boolean scheduleDownloadRemoteIndex( @QueryParam ("repositoryId") String repositoryId, 109 @QueryParam ("now") boolean now, 110 @QueryParam ("fullDownload") boolean fullDownload ) 111 throws ArchivaRestServiceException; 112 113 114 /** 115 * <b>permissions are checked in impl</b> 116 * @since 1.4-M2 117 */ 118 @Path ("deleteArtifact") 119 @POST 120 @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) 121 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 122 @RedbackAuthorization (noPermission = true) 123 Boolean deleteArtifact( Artifact artifact ) 124 throws ArchivaRestServiceException; 125 126 /** 127 * <b>permissions are checked in impl</b> 128 * @since 1.4-M4 129 */ 130 @Path ("projectVersion/{repositoryId}/{namespace}/{projectId}/{version}") 131 @DELETE 132 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 133 @RedbackAuthorization (noPermission = true) 134 Boolean removeProjectVersion( @PathParam ( "repositoryId" ) String repositoryId, 135 @PathParam ( "namespace" ) String namespace, @PathParam ( "projectId" ) String projectId, 136 @PathParam ( "version" ) String version ) 137 throws ArchivaRestServiceException; 138 139 @Path ("isAuthorizedToDeleteArtifacts/{repositoryId}") 140 @GET 141 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 142 @RedbackAuthorization (noPermission = true, noRestriction = true) 143 Boolean isAuthorizedToDeleteArtifacts( @PathParam ("repositoryId") String repoId ) 144 throws ArchivaRestServiceException; 145 146 /** 147 * <b>permissions are checked in impl</b> 148 * @since 1.4-M3 149 */ 150 @Path ("deleteGroupId") 151 @GET 152 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 153 @RedbackAuthorization (noPermission = true) 154 Boolean deleteGroupId( @QueryParam ("groupId") String groupId, @QueryParam ("repositoryId") String repositoryId ) 155 throws ArchivaRestServiceException; 156 157 /** 158 * <b>permissions are checked in impl</b> 159 * @since 1.4-M4 160 */ 161 @Path ("project/{repositoryId}/{groupId}/{projectId}") 162 @DELETE 163 @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN }) 164 @RedbackAuthorization (noPermission = true) 165 Boolean deleteProject( @PathParam ("groupId") String groupId, @PathParam ("projectId") String projectId, 166 @PathParam ("repositoryId") String repositoryId ) 167 throws ArchivaRestServiceException; 168 169 170 }