aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2021-06-01 22:46:51 +0200
committerMartin Stockhammer <martin_s@apache.org>2021-06-01 22:46:51 +0200
commit0ce53483a85b6b7a3a14417434edf56934b474ba (patch)
tree148acd378bdb456482396cb46c315024840fd807 /archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src
parentca18ec34d706efa6fdc6ecde6277ba6004e8eb4e (diff)
downloadarchiva-0ce53483a85b6b7a3a14417434edf56934b474ba.tar.gz
archiva-0ce53483a85b6b7a3a14417434edf56934b474ba.zip
Centralizing repository group handling. First part.
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src')
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/RepositoryGroupService.java92
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/maven/MavenManagedRepositoryService.java (renamed from archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/MavenManagedRepositoryService.java)6
2 files changed, 51 insertions, 47 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/RepositoryGroupService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/RepositoryGroupService.java
index 8a5b6eaeb..a95c68f95 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/RepositoryGroupService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/RepositoryGroupService.java
@@ -55,20 +55,20 @@ import static org.apache.archiva.rest.api.services.v2.RestConfiguration.DEFAULT_
* @since 3.0
*/
@Path( "/repository_groups" )
-@Schema( name="RepositoryGroups", description = "Managing of repository groups or virtual repositories")
+@Schema( name = "RepositoryGroups", description = "Managing of repository groups or virtual repositories" )
public interface RepositoryGroupService
{
@Path( "" )
@GET
- @Produces( { APPLICATION_JSON } )
+ @Produces( {APPLICATION_JSON} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
@Operation( summary = "Returns all repository group entries.",
parameters = {
- @Parameter(name = "q", description = "Search term"),
- @Parameter(name = "offset", description = "The offset of the first element returned"),
- @Parameter(name = "limit", description = "Maximum number of items to return in the response"),
- @Parameter(name = "orderBy", description = "List of attribute used for sorting (key, value)"),
- @Parameter(name = "order", description = "The sort order. Either ascending (asc) or descending (desc)")
+ @Parameter( name = "q", description = "Search term" ),
+ @Parameter( name = "offset", description = "The offset of the first element returned" ),
+ @Parameter( name = "limit", description = "Maximum number of items to return in the response" ),
+ @Parameter( name = "orderBy", description = "List of attribute used for sorting (key, value)" ),
+ @Parameter( name = "order", description = "The sort order. Either ascending (asc) or descending (desc)" )
},
security = {
@SecurityRequirement(
@@ -78,22 +78,22 @@ public interface RepositoryGroupService
responses = {
@ApiResponse( responseCode = "200",
description = "If the list could be returned",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = PagedResult.class))
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = PagedResult.class ) )
),
@ApiResponse( responseCode = "403", description = "Authenticated user is not permitted to gather the information",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) )
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) )
}
)
- PagedResult<RepositoryGroup> getRepositoriesGroups(@QueryParam("q") @DefaultValue( "" ) String searchTerm,
- @QueryParam( "offset" ) @DefaultValue( "0" ) Integer offset,
- @QueryParam( "limit" ) @DefaultValue( value = DEFAULT_PAGE_LIMIT ) Integer limit,
- @QueryParam( "orderBy") @DefaultValue( "id" ) List<String> orderBy,
- @QueryParam("order") @DefaultValue( "asc" ) String order)
+ PagedResult<RepositoryGroup> getRepositoriesGroups( @QueryParam( "q" ) @DefaultValue( "" ) String searchTerm,
+ @QueryParam( "offset" ) @DefaultValue( "0" ) Integer offset,
+ @QueryParam( "limit" ) @DefaultValue( value = DEFAULT_PAGE_LIMIT ) Integer limit,
+ @QueryParam( "orderBy" ) @DefaultValue( "id" ) List<String> orderBy,
+ @QueryParam( "order" ) @DefaultValue( "asc" ) String order )
throws ArchivaRestServiceException;
@Path( "{repositoryGroupId}" )
@GET
- @Produces( { APPLICATION_JSON } )
+ @Produces( {APPLICATION_JSON} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
@Operation( summary = "Returns a single repository group configuration.",
security = {
@@ -104,12 +104,12 @@ public interface RepositoryGroupService
responses = {
@ApiResponse( responseCode = "200",
description = "If the configuration is returned",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = RepositoryGroup.class))
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = RepositoryGroup.class ) )
),
@ApiResponse( responseCode = "403", description = "Authenticated user is not permitted to gather the information",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
@ApiResponse( responseCode = "404", description = "The repository group with the given id does not exist",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) )
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) )
}
)
RepositoryGroup getRepositoryGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId )
@@ -117,14 +117,14 @@ public interface RepositoryGroupService
@Path( "" )
@POST
- @Consumes( { APPLICATION_JSON } )
- @Produces( { APPLICATION_JSON } )
+ @Consumes( {APPLICATION_JSON} )
+ @Produces( {APPLICATION_JSON} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
@Operation( summary = "Creates a new group entry.",
requestBody =
- @RequestBody(required = true, description = "The configuration of the repository group.",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = RepositoryGroup.class))
- )
+ @RequestBody( required = true, description = "The configuration of the repository group.",
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = RepositoryGroup.class ) )
+ )
,
security = {
@SecurityRequirement(
@@ -134,17 +134,17 @@ public interface RepositoryGroupService
responses = {
@ApiResponse( responseCode = "201",
description = "If the list could be returned",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = RepositoryGroup.class))
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = RepositoryGroup.class ) )
),
@ApiResponse( responseCode = "303", description = "The repository group exists already",
headers = {
- @Header( name="Location", description = "The URL of existing group", schema = @Schema(type="string"))
+ @Header( name = "Location", description = "The URL of existing group", schema = @Schema( type = "string" ) )
}
),
@ApiResponse( responseCode = "403", description = "Authenticated user is not permitted to gather the information",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
@ApiResponse( responseCode = "422", description = "The body data is not valid",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) )
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) )
}
)
RepositoryGroup addRepositoryGroup( RepositoryGroup repositoryGroup )
@@ -152,13 +152,13 @@ public interface RepositoryGroupService
@Path( "{repositoryGroupId}" )
@PUT
- @Consumes( { APPLICATION_JSON } )
- @Produces( { APPLICATION_JSON } )
+ @Consumes( {APPLICATION_JSON} )
+ @Produces( {APPLICATION_JSON} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
@Operation( summary = "Returns all repository group entries.",
requestBody =
- @RequestBody(required = true, description = "The configuration of the repository group.",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = RepositoryGroup.class))
+ @RequestBody( required = true, description = "The configuration of the repository group.",
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = RepositoryGroup.class ) )
)
,
security = {
@@ -169,14 +169,14 @@ public interface RepositoryGroupService
responses = {
@ApiResponse( responseCode = "200",
description = "If the group is returned",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = RepositoryGroup.class))
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = RepositoryGroup.class ) )
),
@ApiResponse( responseCode = "403", description = "Authenticated user is not permitted to gather the information",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
@ApiResponse( responseCode = "404", description = "The group with the given id does not exist",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
@ApiResponse( responseCode = "422", description = "The body data is not valid",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) )
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) )
}
)
RepositoryGroup updateRepositoryGroup( @PathParam( "repositoryGroupId" ) String groupId, RepositoryGroup repositoryGroup )
@@ -184,7 +184,7 @@ public interface RepositoryGroupService
@Path( "{repositoryGroupId}" )
@DELETE
- @Produces( { APPLICATION_JSON } )
+ @Produces( {APPLICATION_JSON} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
@Operation( summary = "Deletes the repository group entry with the given id.",
security = {
@@ -197,9 +197,9 @@ public interface RepositoryGroupService
description = "If the group was deleted"
),
@ApiResponse( responseCode = "403", description = "Authenticated user is not permitted to delete the group",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
@ApiResponse( responseCode = "404", description = "The group with the given id does not exist",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
}
)
Response deleteRepositoryGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId )
@@ -207,7 +207,7 @@ public interface RepositoryGroupService
@Path( "{repositoryGroupId}/repositories/{repositoryId}" )
@PUT
- @Produces( { APPLICATION_JSON } )
+ @Produces( {APPLICATION_JSON} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
@Operation( summary = "Adds the repository with the given id to the repository group.",
security = {
@@ -220,18 +220,18 @@ public interface RepositoryGroupService
description = "If the repository was added or if it was already part of the group"
),
@ApiResponse( responseCode = "403", description = "Authenticated user is not permitted to delete the group",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
@ApiResponse( responseCode = "404", description = "The group with the given id does not exist",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
}
)
RepositoryGroup addRepositoryToGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId,
- @PathParam( "repositoryId" ) String repositoryId )
+ @PathParam( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;
@Path( "{repositoryGroupId}/repositories/{repositoryId}" )
@DELETE
- @Produces( { APPLICATION_JSON } )
+ @Produces( {APPLICATION_JSON} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
@Operation( summary = "Removes the repository with the given id from the repository group.",
security = {
@@ -244,13 +244,13 @@ public interface RepositoryGroupService
description = "If the repository was removed."
),
@ApiResponse( responseCode = "403", description = "Authenticated user is not permitted to delete the group",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
@ApiResponse( responseCode = "404", description = "The group with the given id does not exist, or the repository was not part of the group.",
- content = @Content(mediaType = APPLICATION_JSON, schema = @Schema(implementation = ArchivaRestError.class )) ),
+ content = @Content( mediaType = APPLICATION_JSON, schema = @Schema( implementation = ArchivaRestError.class ) ) ),
}
)
RepositoryGroup deleteRepositoryFromGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId,
- @PathParam( "repositoryId" ) String repositoryId )
+ @PathParam( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/MavenManagedRepositoryService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/maven/MavenManagedRepositoryService.java
index 5aff95ef6..5e63682ee 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/MavenManagedRepositoryService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/v2/maven/MavenManagedRepositoryService.java
@@ -1,4 +1,4 @@
-package org.apache.archiva.rest.api.services.v2;
+package org.apache.archiva.rest.api.services.v2.maven;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -31,6 +31,8 @@ import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.v2.FileInfo;
import org.apache.archiva.rest.api.model.v2.MavenManagedRepository;
import org.apache.archiva.rest.api.model.v2.MavenManagedRepositoryUpdate;
+import org.apache.archiva.rest.api.services.v2.ArchivaRestError;
+import org.apache.archiva.rest.api.services.v2.ArchivaRestServiceException;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@@ -51,6 +53,8 @@ import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.apache.archiva.rest.api.services.v2.RestConfiguration.DEFAULT_PAGE_LIMIT;
/**
+ * Service interface for managing managed maven repositories
+ *
* @author Martin Stockhammer <martin_s@apache.org>
* @since 3.0
*/