summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-scheduled
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2008-10-02 01:34:00 +0000
committerMaria Odea B. Ching <oching@apache.org>2008-10-02 01:34:00 +0000
commit1a0214346caa380ace16179a1550dfed1f08253a (patch)
treeee22ecd8f3ac554510a262770fd0927d1dc88c6e /archiva-modules/archiva-scheduled
parent5cdf0b8fa4251ef40c94e9416ccb4843214bf2e2 (diff)
downloadarchiva-1a0214346caa380ace16179a1550dfed1f08253a.tar.gz
archiva-1a0214346caa380ace16179a1550dfed1f08253a.zip
[MRM-84]
updated query for groups and projects git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@700982 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-scheduled')
-rw-r--r--archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java49
1 files changed, 8 insertions, 41 deletions
diff --git a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java
index 65393a164..b07388b04 100644
--- a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java
+++ b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java
@@ -29,6 +29,8 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.database.constraints.ArtifactsByRepositoryConstraint;
import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
+import org.apache.maven.archiva.database.constraints.UniqueArtifactIdConstraint;
+import org.apache.maven.archiva.database.constraints.UniqueGroupIdConstraint;
import org.apache.maven.archiva.model.RepositoryContentStatistics;
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.archiva.repository.scanner.RepositoryScanStatistics;
@@ -43,6 +45,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -140,16 +143,6 @@ public class ArchivaRepositoryScanningTaskExecutor
dbstats.setTotalFileCount( stats.getTotalFileCount() );
dbstats.setWhenGathered( stats.getWhenGathered() );
- // MRM-84
- /*
- List<RepositoryContentStatistics> secondResults = dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );
- if ( CollectionUtils.isNotEmpty( results ) )
- {
- RepositoryContentStatistics lastStats = secondResults.get( 0 );
- sinceWhen = lastStats.getWhenGathered().getTime() + lastStats.getDuration();
- }
- */
-
// total artifact count
try
{
@@ -165,47 +158,21 @@ public class ArchivaRepositoryScanningTaskExecutor
{
log.error( "Error occurred while querying artifacts for artifact count : " + ae.getMessage() );
}
-
// total repo size
long size = FileUtils.sizeOfDirectory( new File( arepo.getLocation() ) );
dbstats.setTotalSize( size );
-
- /*
- TODO:
// total unique groups
List<String> repos = new ArrayList<String>();
repos.add( arepo.getId() );
- try
- {
- List<String> groupIds = dao.getArtifactDAO().queryArtifacts( new UniqueGroupIdConstraint( repos ) );
- dbstats.setTotalGroupCount( groupIds.size() );
- }
- catch ( ObjectNotFoundException oe )
- {
-
- }
- catch ( ArchivaDatabaseException ae )
- {
-
- }
- // total unique projects
- try
- {
- List<Object[]> artifactIds = dao.getArtifactDAO().queryArtifacts( new UniqueArtifactIdConstraint( arepo.getId(), true ) );
- dbstats.setTotalProjectCount( artifactIds.size() );
- }
- catch ( ObjectNotFoundException oe )
- {
-
- }
- catch ( ArchivaDatabaseException ae )
- {
-
- }*/
+ List<String> groupIds = dao.query( new UniqueGroupIdConstraint( repos ) );
+ dbstats.setTotalGroupCount( groupIds.size() );
+ List<Object[]> artifactIds = dao.query( new UniqueArtifactIdConstraint( arepo.getId(), true ) );
+ dbstats.setTotalProjectCount( artifactIds.size() );
+
return dbstats;
}
}