This project has retired. For details please refer to its Attic page.
Source code
001package 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
021import org.apache.archiva.admin.model.beans.FileType;
022import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
023import org.apache.archiva.admin.model.beans.NetworkConfiguration;
024import org.apache.archiva.admin.model.beans.OrganisationInformation;
025import org.apache.archiva.admin.model.beans.UiConfiguration;
026import org.apache.archiva.redback.authorization.RedbackAuthorization;
027import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
028import org.apache.archiva.security.common.ArchivaRoleConstants;
029
030import javax.ws.rs.Consumes;
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( "/archivaAdministrationService/" )
045public interface ArchivaAdministrationService
046{
047    @Path( "getLegacyArtifactPaths" )
048    @GET
049    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
050    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
051    List<LegacyArtifactPath> getLegacyArtifactPaths()
052        throws ArchivaRestServiceException;
053
054    @Path( "deleteLegacyArtifactPath" )
055    @GET
056    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
057    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
058    Boolean deleteLegacyArtifactPath( @QueryParam( "path" ) String path )
059        throws ArchivaRestServiceException;
060
061    @Path( "addFileTypePattern" )
062    @GET
063    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
064    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
065    Boolean addFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, @QueryParam( "pattern" ) String pattern )
066        throws ArchivaRestServiceException;
067
068    @Path( "removeFileTypePattern" )
069    @GET
070    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
071    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
072    Boolean removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId,
073                                   @QueryParam( "pattern" ) String pattern )
074        throws ArchivaRestServiceException;
075
076    @Path( "getFileType" )
077    @GET
078    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
079    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
080    FileType getFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
081        throws ArchivaRestServiceException;
082
083    @Path( "addFileType" )
084    @POST
085    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
086    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
087    void addFileType( FileType fileType )
088        throws ArchivaRestServiceException;
089
090    @Path( "removeFileType" )
091    @GET
092    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
093    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
094    Boolean removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
095        throws ArchivaRestServiceException;
096
097    @Path( "enabledKnownContentConsumer/{knownContentConsumer}" )
098    @GET
099    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
100    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
101    Boolean enabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
102        throws ArchivaRestServiceException;
103
104    @Path( "enabledKnownContentConsumers" )
105    @POST
106    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
107    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
108    void enabledKnownContentConsumers( List<String> knownContentConsumers )
109        throws ArchivaRestServiceException;
110
111
112    @Path( "disabledKnownContentConsumer/{knownContentConsumer}" )
113    @GET
114    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
115    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
116    Boolean disabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
117        throws ArchivaRestServiceException;
118
119    @Path( "enabledInvalidContentConsumer/{invalidContentConsumer}" )
120    @GET
121    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
122    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
123    Boolean enabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
124        throws ArchivaRestServiceException;
125
126    @Path( "enabledInvalidContentConsumers" )
127    @POST
128    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
129    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
130    void enabledInvalidContentConsumers( List<String> invalidContentConsumers )
131        throws ArchivaRestServiceException;
132
133    @Path( "disabledInvalidContentConsumer/{invalidContentConsumer}" )
134    @GET
135    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
136    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
137    Boolean disabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
138        throws ArchivaRestServiceException;
139
140    @Path( "getFileTypes" )
141    @GET
142    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
143    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
144    List<FileType> getFileTypes()
145        throws ArchivaRestServiceException;
146
147    @Path( "getKnownContentConsumers" )
148    @GET
149    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
150    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
151    List<String> getKnownContentConsumers()
152        throws ArchivaRestServiceException;
153
154    /**
155     * @since 1.4-M3
156     */
157    @Path( "getKnownContentAdminRepositoryConsumers" )
158    @GET
159    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
160    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
161    List<AdminRepositoryConsumer> getKnownContentAdminRepositoryConsumers()
162        throws ArchivaRestServiceException;
163
164    /**
165     * @since 1.4-M3
166     */
167    @Path( "getInvalidContentAdminRepositoryConsumers" )
168    @GET
169    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
170    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
171    List<AdminRepositoryConsumer> getInvalidContentAdminRepositoryConsumers()
172        throws ArchivaRestServiceException;
173
174    @Path( "getInvalidContentConsumers" )
175    @GET
176    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
177    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
178    List<String> getInvalidContentConsumers()
179        throws ArchivaRestServiceException;
180
181    @Path( "getOrganisationInformation" )
182    @GET
183    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
184    @RedbackAuthorization( noPermission = true, noRestriction = true )
185    OrganisationInformation getOrganisationInformation()
186        throws ArchivaRestServiceException;
187
188    @Path( "setOrganisationInformation" )
189    @POST
190    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
191    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
192    void setOrganisationInformation( OrganisationInformation organisationInformation )
193        throws ArchivaRestServiceException;
194
195    @Path( "getUiConfiguration" )
196    @GET
197    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
198    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
199    UiConfiguration getUiConfiguration()
200        throws ArchivaRestServiceException;
201
202    @Path( "registrationDisabled" )
203    @GET
204    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
205    @RedbackAuthorization( noRestriction = true, noPermission = true )
206    Boolean registrationDisabled()
207        throws ArchivaRestServiceException;
208
209    @Path( "setUiConfiguration" )
210    @POST
211    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
212    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
213    void setUiConfiguration( UiConfiguration uiConfiguration )
214        throws ArchivaRestServiceException;
215
216    /**
217     * @since 1.4-M3
218     */
219    @Path( "applicationUrl" )
220    @GET
221    @Produces( MediaType.TEXT_PLAIN )
222    @RedbackAuthorization( noRestriction = true, noPermission = true )
223    String getApplicationUrl()
224        throws ArchivaRestServiceException;
225
226
227    @Path( "getNetworkConfiguration" )
228    @GET
229    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
230    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
231    NetworkConfiguration getNetworkConfiguration()
232        throws ArchivaRestServiceException;
233
234    @Path( "setNetworkConfiguration" )
235    @POST
236    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
237    @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
238    void setNetworkConfiguration( NetworkConfiguration networkConfiguration )
239        throws ArchivaRestServiceException;
240}
241