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.maven2.model.Artifact;
022    import org.apache.archiva.redback.authorization.RedbackAuthorization;
023    import org.apache.archiva.security.common.ArchivaRoleConstants;
024    
025    import javax.ws.rs.GET;
026    import javax.ws.rs.Path;
027    import javax.ws.rs.PathParam;
028    import javax.ws.rs.Produces;
029    import javax.ws.rs.core.MediaType;
030    import java.util.List;
031    
032    /**
033     * provide REST services on the top of stage merge repository plugin
034     *
035     * @author Olivier Lamy
036     * @since 1.4-M3
037     */
038    @Path ("/mergeRepositoriesService/")
039    public interface MergeRepositoriesService
040    {
041    
042        /**
043         * <b>permissions are checked in impl</b>
044         * @since 1.4-M3
045         */
046        @Path ("mergeConflictedArtifacts/{sourceRepositoryId}/{targetRepositoryId}")
047        @GET
048        @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
049        @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_MERGE_REPOSITORY)
050        List<Artifact> getMergeConflictedArtifacts( @PathParam ("sourceRepositoryId") String sourceRepositoryId,
051                                                    @PathParam ("targetRepositoryId") String targetRepositoryId )
052            throws ArchivaRestServiceException;
053    
054        /**
055         * <b>permissions are checked in impl</b>
056         * @since 1.4-M3
057         */
058        @Path ("mergeRepositories/{sourceRepositoryId}/{targetRepositoryId}/{skipConflicts}")
059        @GET
060        @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_MERGE_REPOSITORY)
061        void mergeRepositories( @PathParam ("sourceRepositoryId") String sourceRepositoryId,
062                                @PathParam ("targetRepositoryId") String targetRepositoryId,
063                                @PathParam ("skipConflicts") boolean skipConflicts )
064            throws ArchivaRestServiceException;
065    }