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