001 package org.apache.archiva.rest.api.services; 002 /* 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, 014 * software distributed under the License is distributed on an 015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 016 * KIND, either express or implied. See the License for the 017 * specific language governing permissions and limitations 018 * under the License. 019 */ 020 021 import org.apache.archiva.admin.model.beans.FileType; 022 import org.apache.archiva.admin.model.beans.LegacyArtifactPath; 023 import org.apache.archiva.admin.model.beans.NetworkConfiguration; 024 import org.apache.archiva.admin.model.beans.OrganisationInformation; 025 import org.apache.archiva.admin.model.beans.UiConfiguration; 026 import org.apache.archiva.redback.authorization.RedbackAuthorization; 027 import org.apache.archiva.rest.api.model.AdminRepositoryConsumer; 028 import org.apache.archiva.security.common.ArchivaRoleConstants; 029 030 import javax.ws.rs.Consumes; 031 import javax.ws.rs.GET; 032 import javax.ws.rs.POST; 033 import javax.ws.rs.Path; 034 import javax.ws.rs.PathParam; 035 import javax.ws.rs.Produces; 036 import javax.ws.rs.QueryParam; 037 import javax.ws.rs.core.MediaType; 038 import java.util.List; 039 040 /** 041 * @author Olivier Lamy 042 * @since 1.4-M1 043 */ 044 @Path( "/archivaAdministrationService/" ) 045 public interface ArchivaAdministrationService 046 { 047 @Path( "getLegacyArtifactPaths" ) 048 @GET 049 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 050 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 051 List<LegacyArtifactPath> getLegacyArtifactPaths() 052 throws ArchivaRestServiceException; 053 054 @Path( "addLegacyArtifactPath" ) 055 @POST 056 @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 057 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 058 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 059 void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath ) 060 throws ArchivaRestServiceException; 061 062 @Path( "deleteLegacyArtifactPath" ) 063 @GET 064 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 065 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 066 Boolean deleteLegacyArtifactPath( @QueryParam( "path" ) String path ) 067 throws ArchivaRestServiceException; 068 069 @Path( "addFileTypePattern" ) 070 @GET 071 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 072 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 073 Boolean addFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, @QueryParam( "pattern" ) String pattern ) 074 throws ArchivaRestServiceException; 075 076 @Path( "removeFileTypePattern" ) 077 @GET 078 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 079 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 080 Boolean removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, 081 @QueryParam( "pattern" ) String pattern ) 082 throws ArchivaRestServiceException; 083 084 @Path( "getFileType" ) 085 @GET 086 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 087 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 088 FileType getFileType( @QueryParam( "fileTypeId" ) String fileTypeId ) 089 throws ArchivaRestServiceException; 090 091 @Path( "addFileType" ) 092 @POST 093 @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 094 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 095 void addFileType( FileType fileType ) 096 throws ArchivaRestServiceException; 097 098 @Path( "removeFileType" ) 099 @GET 100 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 101 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 102 Boolean removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId ) 103 throws ArchivaRestServiceException; 104 105 @Path( "enabledKnownContentConsumer/{knownContentConsumer}" ) 106 @GET 107 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 108 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 109 Boolean enabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer ) 110 throws ArchivaRestServiceException; 111 112 @Path( "enabledKnownContentConsumers" ) 113 @POST 114 @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 115 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 116 void enabledKnownContentConsumers( List<String> knownContentConsumers ) 117 throws ArchivaRestServiceException; 118 119 120 @Path( "disabledKnownContentConsumer/{knownContentConsumer}" ) 121 @GET 122 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 123 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 124 Boolean disabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer ) 125 throws ArchivaRestServiceException; 126 127 @Path( "enabledInvalidContentConsumer/{invalidContentConsumer}" ) 128 @GET 129 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 130 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 131 Boolean enabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer ) 132 throws ArchivaRestServiceException; 133 134 @Path( "enabledInvalidContentConsumers" ) 135 @POST 136 @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 137 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 138 void enabledInvalidContentConsumers( List<String> invalidContentConsumers ) 139 throws ArchivaRestServiceException; 140 141 @Path( "disabledInvalidContentConsumer/{invalidContentConsumer}" ) 142 @GET 143 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 144 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 145 Boolean disabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer ) 146 throws ArchivaRestServiceException; 147 148 @Path( "getFileTypes" ) 149 @GET 150 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 151 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 152 List<FileType> getFileTypes() 153 throws ArchivaRestServiceException; 154 155 @Path( "getKnownContentConsumers" ) 156 @GET 157 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 158 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 159 List<String> getKnownContentConsumers() 160 throws ArchivaRestServiceException; 161 162 /** 163 * @since 1.4-M3 164 */ 165 @Path( "getKnownContentAdminRepositoryConsumers" ) 166 @GET 167 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 168 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 169 List<AdminRepositoryConsumer> getKnownContentAdminRepositoryConsumers() 170 throws ArchivaRestServiceException; 171 172 /** 173 * @since 1.4-M3 174 */ 175 @Path( "getInvalidContentAdminRepositoryConsumers" ) 176 @GET 177 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 178 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 179 List<AdminRepositoryConsumer> getInvalidContentAdminRepositoryConsumers() 180 throws ArchivaRestServiceException; 181 182 @Path( "getInvalidContentConsumers" ) 183 @GET 184 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 185 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 186 List<String> getInvalidContentConsumers() 187 throws ArchivaRestServiceException; 188 189 @Path( "getOrganisationInformation" ) 190 @GET 191 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) 192 @RedbackAuthorization( noPermission = true, noRestriction = true ) 193 OrganisationInformation getOrganisationInformation() 194 throws ArchivaRestServiceException; 195 196 @Path( "setOrganisationInformation" ) 197 @POST 198 @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 199 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 200 void setOrganisationInformation( OrganisationInformation organisationInformation ) 201 throws ArchivaRestServiceException; 202 203 @Path( "getUiConfiguration" ) 204 @GET 205 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 206 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 207 UiConfiguration getUiConfiguration() 208 throws ArchivaRestServiceException; 209 210 @Path( "registrationDisabled" ) 211 @GET 212 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 213 @RedbackAuthorization( noRestriction = true, noPermission = true ) 214 Boolean registrationDisabled() 215 throws ArchivaRestServiceException; 216 217 @Path( "setUiConfiguration" ) 218 @POST 219 @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 220 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 221 void setUiConfiguration( UiConfiguration uiConfiguration ) 222 throws ArchivaRestServiceException; 223 224 /** 225 * @since 1.4-M3 226 */ 227 @Path( "applicationUrl" ) 228 @GET 229 @Produces( MediaType.TEXT_PLAIN ) 230 @RedbackAuthorization( noRestriction = true, noPermission = true ) 231 String getApplicationUrl() 232 throws ArchivaRestServiceException; 233 234 235 @Path( "getNetworkConfiguration" ) 236 @GET 237 @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 238 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 239 NetworkConfiguration getNetworkConfiguration() 240 throws ArchivaRestServiceException; 241 242 @Path( "setNetworkConfiguration" ) 243 @POST 244 @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) 245 @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ) 246 void setNetworkConfiguration( NetworkConfiguration networkConfiguration ) 247 throws ArchivaRestServiceException; 248 } 249