import java.io.File;
import java.util.ArrayList;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.apache.maven.archiva.configuration.FileTypes;
import org.apache.maven.archiva.repository.RepositoryException;
import org.codehaus.plexus.util.DirectoryWalker;
+import javax.swing.*;
+
/**
* DefaultRepositoryScanner
*
* @plexus.requirement
*/
private RepositoryContentConsumers consumerUtil;
-
+
+ private Set<RepositoryScannerInstance> inProgressScans = new LinkedHashSet<RepositoryScannerInstance>();
+
public RepositoryScanStatistics scan( ManagedRepositoryConfiguration repository, long changesSince )
throws RepositoryException
{
}
File repositoryBase = new File( repository.getLocation() );
-
+
if ( !repositoryBase.exists() )
{
throw new UnsupportedOperationException( "Unable to scan a repository, directory "
RepositoryScannerInstance scannerInstance = new RepositoryScannerInstance( repository, knownContentConsumers,
invalidContentConsumers, changesSince );
+ inProgressScans.add( scannerInstance );
+
dirWalker.addDirectoryWalkListener( scannerInstance );
// Execute scan.
stats.setKnownConsumers( gatherIds( knownContentConsumers ) );
stats.setInvalidConsumers( gatherIds( invalidContentConsumers ) );
-
+
+ inProgressScans.remove( scannerInstance );
+
return stats;
}
ids.add( consumer.getId() );
}
return ids;
- }
+ }
+
+ public Set<RepositoryScannerInstance> getInProgressScans()
+ {
+ return inProgressScans;
+ }
}
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.maven.archiva.repository.RepositoryException;
+import java.util.Collection;
import java.util.List;
+import java.util.Set;
/**
* RepositoryScanner
List<String> ignoredContentPatterns, long changesSince )
throws RepositoryException;
+ Set<RepositoryScannerInstance> getInProgressScans();
}
log.debug( "Repository Scanner: " + message );
}
+ public ManagedRepositoryConfiguration getRepository()
+ {
+ return repository;
+ }
+
+ public RepositoryScanStatistics getStats()
+ {
+ return stats;
+ }
+
+ public long getChangesSince()
+ {
+ return changesSince;
+ }
}
* under the License.
*/
-import com.opensymphony.xwork2.Preparable;
-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.repository.scanner.RepositoryScanner;
import org.apache.maven.archiva.security.ArchivaRoleConstants;
import org.apache.maven.archiva.web.action.PlexusActionSupport;
-import org.apache.maven.archiva.web.util.ContextUtils;
-import org.apache.struts2.interceptor.ServletRequestAware;
import org.codehaus.plexus.cache.Cache;
import org.codehaus.plexus.redback.rbac.Resource;
import org.codehaus.plexus.taskqueue.TaskQueue;
import org.codehaus.redback.integration.interceptor.SecureActionBundle;
import org.codehaus.redback.integration.interceptor.SecureActionException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
/**
* Shows system status information for the administrator.
*/
private Map<String,Cache> caches;
+ /**
+ * @plexus.requirement
+ */
+ private RepositoryScanner scanner;
+
private String memoryStatus;
public SecureActionBundle getSecureActionBundle()
return memoryStatus;
}
+ public RepositoryScanner getScanner()
+ {
+ return scanner;
+ }
+
public Map<String, Cache> getCaches()
{
return caches;
</c:forEach>
</table>
+ <h2>Repository Scans</h2>
+
+ <c:choose>
+ <c:when test="${!empty scanner.inProgressScans}">
+ <table>
+ <tr>
+ <th>Repository</th>
+ <th>Files processed</th>
+ <th>New files</th>
+ </tr>
+ <c:forEach var="scan" items="${scanner.inProgressScans}">
+ <tr>
+ <td>${scan.repository.name} (${scan.repository.id})</td>
+ <td>${scan.stats.totalFileCount}</td>
+ <td>${scan.stats.newFileCount}</td>
+ </tr>
+ </c:forEach>
+ </table>
+ </c:when>
+ <c:otherwise>
+ <p>No scans in progress.</p>
+ </c:otherwise>
+ </c:choose>
+
<h2>Caches</h2>
<table>