1 package org.apache.archiva.web.action.admin.network;
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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
21 import com.opensymphony.xwork2.Preparable;
22 import org.apache.archiva.admin.model.RepositoryAdminException;
23 import org.apache.archiva.admin.model.admin.ArchivaAdministration;
24 import org.apache.archiva.admin.model.beans.NetworkConfiguration;
25 import org.apache.archiva.redback.rbac.Resource;
26 import org.apache.archiva.security.common.ArchivaRoleConstants;
27 import org.apache.archiva.web.action.AbstractActionSupport;
28 import org.apache.archiva.redback.integration.interceptor.SecureAction;
29 import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
30 import org.apache.archiva.redback.integration.interceptor.SecureActionException;
31 import org.springframework.context.annotation.Scope;
32 import org.springframework.stereotype.Controller;
34 import javax.inject.Inject;
37 * @author Olivier Lamy
40 @Controller( "networkConfigurationAction" )
42 public class NetworkConfigurationAction
43 extends AbstractActionSupport
44 implements Preparable, SecureAction
48 private ArchivaAdministration archivaAdministration;
50 private NetworkConfiguration networkConfiguration;
52 public void prepare( )
55 networkConfiguration = archivaAdministration.getNetworkConfiguration( );
58 public SecureActionBundle getSecureActionBundle( )
59 throws SecureActionException
61 SecureActionBundle bundle = new SecureActionBundle( );
63 bundle.setRequiresAuthentication( true );
64 bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
78 archivaAdministration.setNetworkConfiguration( this.networkConfiguration );
80 catch ( RepositoryAdminException e )
82 addActionError( "Error during networkConfiguration upate:" + e.getMessage( ) );
85 addActionMessage( "Network Configuration Updated" );
89 public NetworkConfiguration getNetworkConfiguration( )
91 return networkConfiguration;
94 public void setNetworkConfiguration( NetworkConfiguration networkConfiguration )
96 this.networkConfiguration = networkConfiguration;