diff options
author | Olivier Lamy <olamy@apache.org> | 2011-09-22 22:20:45 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-09-22 22:20:45 +0000 |
commit | 45eaefbd9a4500966b6c8085a7f3055a8df96e32 (patch) | |
tree | dcecb8144af342ea3bbfceeb714a14bd3502b951 /archiva-modules/archiva-web/archiva-rest/archiva-rest-api | |
parent | 51e9374b16bf024539c9b00f8eee677d8f8e18c4 (diff) | |
download | archiva-45eaefbd9a4500966b6c8085a7f3055a8df96e32.tar.gz archiva-45eaefbd9a4500966b6c8085a7f3055a8df96e32.zip |
[MRM-1490] REST services : add a service to copy an artifact from one repo to an other one
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1174423 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest/archiva-rest-api')
2 files changed, 70 insertions, 0 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArtifactTransferRequest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArtifactTransferRequest.java new file mode 100644 index 000000000..10416adcc --- /dev/null +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArtifactTransferRequest.java @@ -0,0 +1,55 @@ +package org.apache.archiva.rest.api.model; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; + +/** + * @author Olivier Lamy + */ +@XmlRootElement( name = "artifactTransferRequest" ) +public class ArtifactTransferRequest + extends Artifact + implements Serializable +{ + private String sourceRepositoryId; + + private String targetRepositoryId; + + public String getSourceRepositoryId() + { + return sourceRepositoryId; + } + + public void setSourceRepositoryId( String sourceRepositoryId ) + { + this.sourceRepositoryId = sourceRepositoryId; + } + + public String getTargetRepositoryId() + { + return targetRepositoryId; + } + + public void setTargetRepositoryId( String targetRepositoryId ) + { + this.targetRepositoryId = targetRepositoryId; + } +} diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoriesService.java index ea08d7c52..d0397fb17 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoriesService.java @@ -19,10 +19,13 @@ package org.apache.archiva.rest.api.services; * under the License. */ +import org.apache.archiva.rest.api.model.ArtifactTransferRequest; import org.apache.archiva.security.common.ArchivaRoleConstants; import org.codehaus.plexus.redback.authorization.RedbackAuthorization; +import javax.ws.rs.Consumes; import javax.ws.rs.GET; +import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -68,4 +71,16 @@ public interface RepositoriesService @QueryParam( "fullScan" ) boolean fullScan ) throws ArchivaRestServiceException; + @Path( "copyArtifact" ) + @POST + @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } ) + @RedbackAuthorization( noPermission = true ) + /** + * permission are checked in impl + * will copy an artifact from the source repository to the target repository + */ + Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest ) + throws ArchivaRestServiceException; + } |