1 package org.apache.maven.archiva.web.action.admin.legacy;
\r
4 * Licensed to the Apache Software Foundation (ASF) under one
\r
5 * or more contributor license agreements. See the NOTICE file
\r
6 * distributed with this work for additional information
\r
7 * regarding copyright ownership. The ASF licenses this file
\r
8 * to you under the Apache License, Version 2.0 (the
\r
9 * "License"); you may not use this file except in compliance
\r
10 * with the License. You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing,
\r
15 * software distributed under the License is distributed on an
\r
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
\r
17 * KIND, either express or implied. See the License for the
\r
18 * specific language governing permissions and limitations
\r
19 * under the License.
\r
22 import java.util.ArrayList;
\r
23 import java.util.List;
\r
25 import javax.servlet.http.HttpServletRequest;
\r
27 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
\r
28 import org.apache.maven.archiva.configuration.Configuration;
\r
29 import org.apache.maven.archiva.configuration.LegacyArtifactPath;
\r
30 import org.apache.maven.archiva.security.ArchivaRoleConstants;
\r
31 import org.apache.maven.archiva.web.util.ContextUtils;
\r
32 import org.codehaus.plexus.redback.rbac.Resource;
\r
33 import org.codehaus.plexus.redback.xwork.interceptor.SecureAction;
\r
34 import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
\r
35 import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
\r
36 import org.codehaus.plexus.xwork.action.PlexusActionSupport;
\r
38 import com.opensymphony.webwork.interceptor.ServletRequestAware;
\r
39 import com.opensymphony.xwork.Preparable;
\r
42 * Shows the LegacyArtifactPath Tab for the administrator.
\r
45 * @plexus.component role="com.opensymphony.xwork.Action" role-hint="legacyArtifactPathAction"
\r
47 public class LegacyArtifactPathAction
\r
48 extends PlexusActionSupport
\r
49 implements SecureAction, ServletRequestAware, Preparable
\r
52 * @plexus.requirement
\r
54 private ArchivaConfiguration archivaConfiguration;
\r
56 private List<LegacyArtifactPath> legacyArtifactPaths;
\r
59 * Used to construct the repository WebDAV URL in the repository action.
\r
61 private String baseUrl;
\r
63 public void setServletRequest( HttpServletRequest request )
\r
65 // TODO: is there a better way to do this?
\r
66 this.baseUrl = ContextUtils.getBaseURL( request, "repository" );
\r
69 public SecureActionBundle getSecureActionBundle()
\r
70 throws SecureActionException
\r
72 SecureActionBundle bundle = new SecureActionBundle();
\r
74 bundle.setRequiresAuthentication( true );
\r
75 bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION,
\r
81 public void prepare()
\r
83 Configuration config = archivaConfiguration.getConfiguration();
\r
85 legacyArtifactPaths = new ArrayList<LegacyArtifactPath>( config.getLegacyArtifactPaths() );
\r
88 public List<LegacyArtifactPath> getLegacyArtifactPaths()
\r
90 return legacyArtifactPaths;
\r
93 public String getBaseUrl()
\r