This project has retired. For details please refer to its Attic page.
Source code
001package 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
022import org.apache.archiva.maven2.model.Artifact;
023import org.apache.archiva.redback.authorization.RedbackAuthorization;
024import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
025import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
026import org.apache.archiva.rest.api.model.StringList;
027import org.apache.archiva.security.common.ArchivaRoleConstants;
028
029import javax.ws.rs.Consumes;
030import javax.ws.rs.DELETE;
031import javax.ws.rs.GET;
032import javax.ws.rs.POST;
033import javax.ws.rs.Path;
034import javax.ws.rs.PathParam;
035import javax.ws.rs.Produces;
036import javax.ws.rs.QueryParam;
037import javax.ws.rs.core.MediaType;
038import java.util.List;
039
040/**
041 * @author Olivier Lamy
042 * @since 1.4-M1
043 */
044@Path ("/repositoriesService/")
045public interface RepositoriesService
046{
047
048    /**
049     * index repository
050     */
051    @Path ("scanRepository")
052    @GET
053    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
054    @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
055    Boolean scanRepository( @QueryParam ("repositoryId") String repositoryId,
056                            @QueryParam ("fullScan") boolean fullScan )
057        throws ArchivaRestServiceException;
058
059
060    /**
061     * scan directories
062     * @since 1.4-M3
063     */
064    @Path ("scanRepositoryDirectoriesNow/{repositoryId}")
065    @GET
066    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
067    @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
068    RepositoryScanStatistics scanRepositoryDirectoriesNow( @PathParam ("repositoryId") String repositoryId )
069        throws ArchivaRestServiceException;
070
071
072    @Path ("alreadyScanning/{repositoryId}")
073    @GET
074    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
075    @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
076    Boolean alreadyScanning( @PathParam ("repositoryId") String repositoryId )
077        throws ArchivaRestServiceException;
078
079    @Path ("removeScanningTaskFromQueue/{repositoryId}")
080    @GET
081    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
082    @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
083    Boolean removeScanningTaskFromQueue( @PathParam ("repositoryId") String repositoryId )
084        throws ArchivaRestServiceException;
085
086    @Path ("scanRepositoryNow")
087    @GET
088    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
089    @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
090    Boolean scanRepositoryNow( @QueryParam ("repositoryId") String repositoryId,
091                               @QueryParam ("fullScan") boolean fullScan )
092        throws ArchivaRestServiceException;
093
094    /**
095     * permissions are checked in impl
096     * will copy an artifact from the source repository to the target repository
097     */
098    @Path ("copyArtifact")
099    @POST
100    @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
101    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
102    @RedbackAuthorization (noPermission = true)
103    Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
104        throws ArchivaRestServiceException;
105
106    @Path ("scheduleDownloadRemoteIndex")
107    @GET
108    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
109    @RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
110    Boolean scheduleDownloadRemoteIndex( @QueryParam ("repositoryId") String repositoryId,
111                                         @QueryParam ("now") boolean now,
112                                         @QueryParam ("fullDownload") boolean fullDownload )
113        throws ArchivaRestServiceException;
114
115
116    /**
117     * <b>permissions are checked in impl</b>
118     * @since 1.4-M2
119     */
120    @Path ("deleteArtifact")
121    @POST
122    @Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
123    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
124    @RedbackAuthorization (noPermission = true)
125    Boolean deleteArtifact( Artifact artifact )
126        throws ArchivaRestServiceException;
127
128    /**
129     * <b>permissions are checked in impl</b>
130     * @since 1.4-M4
131     */
132    @Path ("projectVersion/{repositoryId}/{namespace}/{projectId}/{version}")
133    @DELETE
134    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
135    @RedbackAuthorization (noPermission = true)
136    Boolean removeProjectVersion( @PathParam ( "repositoryId" ) String repositoryId,
137                                  @PathParam ( "namespace" ) String namespace, @PathParam ( "projectId" ) String projectId,
138                                  @PathParam ( "version" ) String version )
139        throws ArchivaRestServiceException;
140
141    @Path ("isAuthorizedToDeleteArtifacts/{repositoryId}")
142    @GET
143    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
144    @RedbackAuthorization (noPermission = true, noRestriction = true)
145    Boolean isAuthorizedToDeleteArtifacts( @PathParam ("repositoryId") String repoId )
146        throws ArchivaRestServiceException;
147
148    /**
149     * <b>permissions are checked in impl</b>
150     * @since 1.4-M3
151     */
152    @Path ("deleteGroupId")
153    @GET
154    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
155    @RedbackAuthorization (noPermission = true)
156    Boolean deleteGroupId( @QueryParam ("groupId") String groupId, @QueryParam ("repositoryId") String repositoryId )
157        throws ArchivaRestServiceException;
158
159    /**
160     * <b>permissions are checked in impl</b>
161     * @since 1.4-M4
162     */
163    @Path ("project/{repositoryId}/{groupId}/{projectId}")
164    @DELETE
165    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
166    @RedbackAuthorization (noPermission = true)
167    Boolean deleteProject( @PathParam ("groupId") String groupId, @PathParam ("projectId") String projectId,
168                           @PathParam ("repositoryId") String repositoryId )
169        throws ArchivaRestServiceException;
170
171    /**
172     * @since 2.0
173     */
174    @Path ("runningRemoteDownloadIds")
175    @GET
176    @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
177    @RedbackAuthorization (noPermission = true)
178    StringList getRunningRemoteDownloadIds();
179
180}