1 package org.apache.archiva.web.action.admin.legacy;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import com.opensymphony.xwork2.Preparable;
23 import org.apache.archiva.admin.model.RepositoryAdminException;
24 import org.apache.archiva.admin.model.admin.ArchivaAdministration;
25 import org.apache.archiva.admin.model.beans.LegacyArtifactPath;
26 import org.apache.archiva.security.common.ArchivaRoleConstants;
27 import org.apache.archiva.web.util.ContextUtils;
28 import org.apache.archiva.web.action.AbstractActionSupport;
29 import org.apache.struts2.interceptor.ServletRequestAware;
30 import org.apache.archiva.redback.rbac.Resource;
31 import org.apache.archiva.redback.integration.interceptor.SecureAction;
32 import org.apache.archiva.redback.integration.interceptor.SecureActionBundle;
33 import org.apache.archiva.redback.integration.interceptor.SecureActionException;
34 import org.springframework.context.annotation.Scope;
35 import org.springframework.stereotype.Controller;
37 import javax.inject.Inject;
38 import javax.servlet.http.HttpServletRequest;
39 import java.util.ArrayList;
40 import java.util.List;
43 * Shows the LegacyArtifactPath Tab for the administrator.
47 @Controller( "legacyArtifactPathAction" )
49 public class LegacyArtifactPathAction
50 extends AbstractActionSupport
51 implements SecureAction, ServletRequestAware, Preparable
55 private ArchivaAdministration archivaAdministration;
57 private List<LegacyArtifactPath> legacyArtifactPaths;
60 * Used to construct the repository WebDAV URL in the repository action.
62 private String baseUrl;
64 public void setServletRequest( HttpServletRequest request )
66 // TODO: is there a better way to do this?
67 this.baseUrl = ContextUtils.getBaseURL( request, "repository" );
70 public SecureActionBundle getSecureActionBundle()
71 throws SecureActionException
73 SecureActionBundle bundle = new SecureActionBundle();
75 bundle.setRequiresAuthentication( true );
76 bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
82 throws RepositoryAdminException
84 legacyArtifactPaths = new ArrayList<LegacyArtifactPath>( getArchivaAdministration().getLegacyArtifactPaths() );
87 public List<LegacyArtifactPath> getLegacyArtifactPaths()
89 return legacyArtifactPaths;
92 public String getBaseUrl()
97 public ArchivaAdministration getArchivaAdministration()
99 return archivaAdministration;
102 public void setArchivaAdministration( ArchivaAdministration archivaAdministration )
104 this.archivaAdministration = archivaAdministration;