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.admin.model.beans.RemoteRepository;
023    import org.apache.archiva.security.common.ArchivaRoleConstants;
024    import org.apache.archiva.redback.authorization.RedbackAuthorization;
025    
026    import javax.ws.rs.Consumes;
027    import javax.ws.rs.GET;
028    import javax.ws.rs.POST;
029    import javax.ws.rs.Path;
030    import javax.ws.rs.PathParam;
031    import javax.ws.rs.Produces;
032    import javax.ws.rs.core.MediaType;
033    import java.util.List;
034    
035    /**
036     * @author Olivier Lamy
037     * @since 1.4-M1
038     */
039    @Path( "/remoteRepositoriesService/" )
040    public interface RemoteRepositoriesService
041    {
042        @Path( "getRemoteRepositories" )
043        @GET
044        @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
045        @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
046        List<RemoteRepository> getRemoteRepositories()
047            throws ArchivaRestServiceException;
048    
049        @Path( "getRemoteRepository/{repositoryId}" )
050        @GET
051        @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
052        @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
053        RemoteRepository getRemoteRepository( @PathParam( "repositoryId" ) String repositoryId )
054            throws ArchivaRestServiceException;
055    
056        @Path( "deleteRemoteRepository/{repositoryId}" )
057        @GET
058        @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
059        @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
060        Boolean deleteRemoteRepository( @PathParam( "repositoryId" ) String repositoryId )
061            throws Exception;
062    
063    
064        @Path( "addRemoteRepository" )
065        @POST
066        @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
067        @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
068        @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
069        Boolean addRemoteRepository( RemoteRepository remoteRepository )
070            throws Exception;
071    
072    
073        @Path( "updateRemoteRepository" )
074        @POST
075        @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
076        @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
077        @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
078        Boolean updateRemoteRepository( RemoteRepository remoteRepository )
079            throws Exception;
080    
081    
082    }