mirror of
https://github.com/apache/archiva.git
synced 2025-02-12 04:56:02 +00:00
[MRM-462] adjust repository list to new configuration
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches@569010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
de47399940
commit
57cca996fc
@ -19,12 +19,9 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.model.RepositoryContentStatistics;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* AdminRepositoryConfiguration
|
||||
*
|
||||
@ -62,19 +59,6 @@ public AdminRepositoryConfiguration( ManagedRepositoryConfiguration repoconfig )
|
||||
this.setDeleteReleasedSnapshots( repoconfig.isDeleteReleasedSnapshots() );
|
||||
}
|
||||
|
||||
// TODO: needed? used by repositories.jsp only
|
||||
public boolean isDirectoryExists()
|
||||
{
|
||||
String directory = getLocation();
|
||||
if ( StringUtils.isBlank( directory ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
File dir = new File( directory );
|
||||
return dir.exists() && dir.isDirectory();
|
||||
}
|
||||
|
||||
public RepositoryContentStatistics getStats()
|
||||
{
|
||||
return stats;
|
||||
|
@ -22,10 +22,14 @@
|
||||
import com.opensymphony.webwork.interceptor.ServletRequestAware;
|
||||
import com.opensymphony.xwork.Preparable;
|
||||
import org.apache.commons.collections.Transformer;
|
||||
import org.apache.commons.collections.list.TransformedList;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.Configuration;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.configuration.functors.RepositoryConfigurationComparator;
|
||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||
import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
|
||||
import org.apache.maven.archiva.model.RepositoryContentStatistics;
|
||||
import org.apache.maven.archiva.security.ArchivaRoleConstants;
|
||||
import org.apache.maven.archiva.web.util.ContextUtils;
|
||||
import org.codehaus.plexus.redback.rbac.Resource;
|
||||
@ -35,8 +39,11 @@
|
||||
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Shows the Repositories Tab for the administrator.
|
||||
@ -59,14 +66,22 @@ public class RepositoriesAction
|
||||
*/
|
||||
private ArchivaConfiguration archivaConfiguration;
|
||||
|
||||
private List managedRepositories;
|
||||
private List<ManagedRepositoryConfiguration> managedRepositories;
|
||||
|
||||
private List remoteRepositories;
|
||||
private List<RemoteRepositoryConfiguration> remoteRepositories;
|
||||
|
||||
private Map<String, RepositoryContentStatistics> repositoryStatistics;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role-hint="jdo"
|
||||
*/
|
||||
private ArchivaDAO dao;
|
||||
|
||||
private String baseUrl;
|
||||
|
||||
public void setServletRequest( HttpServletRequest request )
|
||||
{
|
||||
// TODO! what is this?
|
||||
this.baseUrl = ContextUtils.getBaseURL( request, "repository" );
|
||||
}
|
||||
|
||||
@ -82,27 +97,42 @@ public SecureActionBundle getSecureActionBundle()
|
||||
}
|
||||
|
||||
public void prepare()
|
||||
throws Exception
|
||||
{
|
||||
Configuration config = archivaConfiguration.getConfiguration();
|
||||
|
||||
remoteRepositories = TransformedList.decorate( config.getRemoteRepositories(), repoConfigToAdmin );
|
||||
managedRepositories = TransformedList.decorate( config.getManagedRepositories(), repoConfigToAdmin );
|
||||
remoteRepositories = new ArrayList<RemoteRepositoryConfiguration>( config.getRemoteRepositories() );
|
||||
managedRepositories = new ArrayList<ManagedRepositoryConfiguration>( config.getManagedRepositories() );
|
||||
|
||||
Collections.sort( managedRepositories, new RepositoryConfigurationComparator() );
|
||||
Collections.sort( remoteRepositories, new RepositoryConfigurationComparator() );
|
||||
|
||||
repositoryStatistics = new HashMap<String, RepositoryContentStatistics>();
|
||||
for ( ManagedRepositoryConfiguration repo : managedRepositories )
|
||||
{
|
||||
List<RepositoryContentStatistics> results =
|
||||
dao.query( new MostRecentRepositoryScanStatistics( repo.getId() ) );
|
||||
if ( !results.isEmpty() )
|
||||
{
|
||||
repositoryStatistics.put( repo.getId(), results.get( 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List getManagedRepositories()
|
||||
public List<ManagedRepositoryConfiguration> getManagedRepositories()
|
||||
{
|
||||
return managedRepositories;
|
||||
}
|
||||
|
||||
public List getRemoteRepositories()
|
||||
public List<RemoteRepositoryConfiguration> getRemoteRepositories()
|
||||
{
|
||||
return remoteRepositories;
|
||||
}
|
||||
|
||||
public Map<String, RepositoryContentStatistics> getRepositoryStatistics()
|
||||
{
|
||||
return repositoryStatistics;
|
||||
}
|
||||
|
||||
public String getBaseUrl()
|
||||
{
|
||||
return baseUrl;
|
||||
|
@ -110,11 +110,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Directory</th>
|
||||
<td>${repository.location}
|
||||
<c:if test="${not(repository.directoryExists)}">
|
||||
<span class="missing">Directory Does Not Exist</span>
|
||||
</c:if>
|
||||
</td>
|
||||
<td>${repository.location}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>WebDAV URL</th>
|
||||
@ -185,27 +181,28 @@
|
||||
<tr>
|
||||
<th>Stats</th>
|
||||
<td>
|
||||
<c:set var="stats" value="${repositoryStatistics[repository.id]}"/>
|
||||
<c:choose>
|
||||
<c:when test="${empty(repository.stats)}">
|
||||
<c:when test="${empty(stats)}">
|
||||
No Statistics Available.
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Last Scanned</th>
|
||||
<td>${repository.stats.whenGathered}</td>
|
||||
<td>${stats.whenGathered}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Duration</th>
|
||||
<td>${repository.stats.duration} ms</td>
|
||||
<td>${stats.duration} ms</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total File Count</th>
|
||||
<td>${repository.stats.totalFileCount}
|
||||
<td>${stats.totalFileCount}
|
||||
</tr>
|
||||
<tr>
|
||||
<th>New Files Found</th>
|
||||
<td>${repository.stats.newFileCount}
|
||||
<td>${stats.newFileCount}
|
||||
</tr>
|
||||
</table>
|
||||
</c:otherwise>
|
||||
@ -308,14 +305,16 @@
|
||||
</c:choose>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Releases Included</th>
|
||||
<td class="${repository.releases ? 'donemark' : 'errormark'} booleanIcon"> ${repository.releases}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Snapshots Included</th>
|
||||
<td class="${repository.snapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.snapshots}</td>
|
||||
</tr>
|
||||
<%-- TODO! remove
|
||||
<tr>
|
||||
<th>Releases Included</th>
|
||||
<td class="${repository.releases ? 'donemark' : 'errormark'} booleanIcon"> ${repository.releases}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Snapshots Included</th>
|
||||
<td class="${repository.snapshots ? 'donemark' : 'errormark'} booleanIcon"> ${repository.snapshots}</td>
|
||||
</tr>
|
||||
--%>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user