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 com.opensymphony.xwork2.Preparable;
\r
23 import org.apache.archiva.admin.repository.RepositoryAdminException;
\r
24 import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
\r
25 import org.apache.archiva.admin.repository.admin.LegacyArtifactPath;
\r
26 import org.apache.archiva.security.common.ArchivaRoleConstants;
\r
27 import org.apache.archiva.web.util.ContextUtils;
\r
28 import org.apache.maven.archiva.web.action.AbstractActionSupport;
\r
29 import org.apache.struts2.interceptor.ServletRequestAware;
\r
30 import org.codehaus.plexus.redback.rbac.Resource;
\r
31 import org.codehaus.redback.integration.interceptor.SecureAction;
\r
32 import org.codehaus.redback.integration.interceptor.SecureActionBundle;
\r
33 import org.codehaus.redback.integration.interceptor.SecureActionException;
\r
34 import org.springframework.context.annotation.Scope;
\r
35 import org.springframework.stereotype.Controller;
\r
37 import javax.inject.Inject;
\r
38 import javax.servlet.http.HttpServletRequest;
\r
39 import java.util.ArrayList;
\r
40 import java.util.List;
\r
43 * Shows the LegacyArtifactPath Tab for the administrator.
\r
47 @Controller( "legacyArtifactPathAction" )
\r
48 @Scope( "prototype" )
\r
49 public class LegacyArtifactPathAction
\r
50 extends AbstractActionSupport
\r
51 implements SecureAction, ServletRequestAware, Preparable
\r
55 private ArchivaAdministration archivaAdministration;
\r
57 private List<LegacyArtifactPath> legacyArtifactPaths;
\r
60 * Used to construct the repository WebDAV URL in the repository action.
\r
62 private String baseUrl;
\r
64 public void setServletRequest( HttpServletRequest request )
\r
66 // TODO: is there a better way to do this?
\r
67 this.baseUrl = ContextUtils.getBaseURL( request, "repository" );
\r
70 public SecureActionBundle getSecureActionBundle()
\r
71 throws SecureActionException
\r
73 SecureActionBundle bundle = new SecureActionBundle();
\r
75 bundle.setRequiresAuthentication( true );
\r
76 bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
\r
81 public void prepare()
\r
82 throws RepositoryAdminException
\r
84 legacyArtifactPaths = new ArrayList<LegacyArtifactPath>( getArchivaAdministration().getLegacyArtifactPaths() );
\r
87 public List<LegacyArtifactPath> getLegacyArtifactPaths()
\r
89 return legacyArtifactPaths;
\r
92 public String getBaseUrl()
\r
97 public ArchivaAdministration getArchivaAdministration()
\r
99 return archivaAdministration;
\r
102 public void setArchivaAdministration( ArchivaAdministration archivaAdministration )
\r
104 this.archivaAdministration = archivaAdministration;
\r