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.security.common.ArchivaRoleConstants;
26 import org.apache.archiva.web.action.AbstractActionSupport;
27 import org.codehaus.plexus.redback.rbac.Resource;
28 import org.codehaus.redback.integration.interceptor.SecureAction;
29 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
30 import org.codehaus.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
39 @Controller( "networkConfigurationAction" )
41 public class NetworkConfigurationAction
42 extends AbstractActionSupport
43 implements Preparable, SecureAction
47 private ArchivaAdministration archivaAdministration;
49 private NetworkConfiguration networkConfiguration;
51 public void prepare( )
54 networkConfiguration = archivaAdministration.getNetworkConfiguration( );
57 public SecureActionBundle getSecureActionBundle( )
58 throws SecureActionException
60 SecureActionBundle bundle = new SecureActionBundle( );
62 bundle.setRequiresAuthentication( true );
63 bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
77 archivaAdministration.setNetworkConfiguration( this.networkConfiguration );
79 catch ( RepositoryAdminException e )
81 addActionError( "Error during networkConfiguration upate:" + e.getMessage( ) );
84 addActionMessage( "Network Configuration Updated" );
88 public NetworkConfiguration getNetworkConfiguration( )
90 return networkConfiguration;
93 public void setNetworkConfiguration( NetworkConfiguration networkConfiguration )
95 this.networkConfiguration = networkConfiguration;