This project has retired. For details please refer to its Attic page.
ArchivaAdministrationService xref
View Javadoc
1   package org.apache.archiva.rest.api.services;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  import org.apache.archiva.admin.model.beans.FileType;
22  import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
23  import org.apache.archiva.admin.model.beans.NetworkConfiguration;
24  import org.apache.archiva.admin.model.beans.OrganisationInformation;
25  import org.apache.archiva.admin.model.beans.UiConfiguration;
26  import org.apache.archiva.redback.authorization.RedbackAuthorization;
27  import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
28  import org.apache.archiva.security.common.ArchivaRoleConstants;
29  
30  import javax.ws.rs.Consumes;
31  import javax.ws.rs.GET;
32  import javax.ws.rs.POST;
33  import javax.ws.rs.Path;
34  import javax.ws.rs.PathParam;
35  import javax.ws.rs.Produces;
36  import javax.ws.rs.QueryParam;
37  import javax.ws.rs.core.MediaType;
38  import java.util.List;
39  
40  /**
41   * @author Olivier Lamy
42   * @since 1.4-M1
43   */
44  @Path( "/archivaAdministrationService/" )
45  public interface ArchivaAdministrationService
46  {
47      @Path( "getLegacyArtifactPaths" )
48      @GET
49      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
50      @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
51      List<LegacyArtifactPath> getLegacyArtifactPaths()
52          throws ArchivaRestServiceException;
53  
54      @Path( "deleteLegacyArtifactPath" )
55      @GET
56      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
57      @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
58      Boolean deleteLegacyArtifactPath( @QueryParam( "path" ) String path )
59          throws ArchivaRestServiceException;
60  
61      @Path( "addFileTypePattern" )
62      @GET
63      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
64      @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
65      Boolean addFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, @QueryParam( "pattern" ) String pattern )
66          throws ArchivaRestServiceException;
67  
68      @Path( "removeFileTypePattern" )
69      @GET
70      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
71      @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
72      Boolean removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId,
73                                     @QueryParam( "pattern" ) String pattern )
74          throws ArchivaRestServiceException;
75  
76      @Path( "getFileType" )
77      @GET
78      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
79      @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
80      FileType getFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
81          throws ArchivaRestServiceException;
82  
83      @Path( "addFileType" )
84      @POST
85      @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
86      @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
87      void addFileType( FileType fileType )
88          throws ArchivaRestServiceException;
89  
90      @Path( "removeFileType" )
91      @GET
92      @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
93      @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
94      Boolean removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
95          throws ArchivaRestServiceException;
96  
97      @Path( "enabledKnownContentConsumer/{knownContentConsumer}" )
98      @GET
99      @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