archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r691862 - in /archiva/branches/archiva-1.1.x: ./ archiva-docs/ archiva-jetty/ archiva-modules/ archiva-modules/archiva-base/archiva-checksum/src/main/java/ archiva-modules/archiva-base/archiva-common/src/main/java/ archiva-modules/archiva-b...
Date Thu, 04 Sep 2008 03:54:40 GMT
Author: oching
Date: Wed Sep  3 20:54:38 2008
New Revision: 691862

URL: http://svn.apache.org/viewvc?rev=691862&view=rev
Log:
merged the following from trunk:
-r685789 (MRM-848: queue scanning of repositories during startup; scan only the repositories
which haven't been scanned previously by checking the 
scan statistics)
-r685911, -r685922 and -r685923 (Ignore generated files & directories by eclipse/m2eclipse/maven)


Modified:
    archiva/branches/archiva-1.1.x/   (props changed)
    archiva/branches/archiva-1.1.x/archiva-docs/   (props changed)
    archiva/branches/archiva-1.1.x/archiva-jetty/   (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/   (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-checksum/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-common/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-configuration/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/   (props
changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-indexer/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-model/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-policies/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-proxy/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-database/src/main/java/   (props
changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-reporting/   (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-reporting/archiva-artifact-reports/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-scheduled/src/main/java/   (props
changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/   (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-rss/   (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-security/src/main/java/
  (props changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-webapp-test/   (props
changed)
    archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-webdav/   (props changed)

Propchange: archiva/branches/archiva-1.1.x/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -3,3 +3,6 @@
 *.ipr
 *.iws
 .metadata
+.settings
+.classpath
+.project

Propchange: archiva/branches/archiva-1.1.x/archiva-docs/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -2,3 +2,6 @@
 *.iws
 *.iml
 *.ipr
+.settings
+.classpath
+.project

Propchange: archiva/branches/archiva-1.1.x/archiva-jetty/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -2,3 +2,4 @@
 *.iml
 .classpath
 .project
+.settings

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -1,2 +1,5 @@
 target
 *.iml
+.settings
+.classpath
+.project

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-checksum/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-common/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-configuration/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -1,2 +1,5 @@
 *.iml
 target
+.settings
+.classpath
+.project

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-indexer/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-model/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-policies/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-proxy/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-database/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-reporting/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -1,2 +1,5 @@
 *.iml
 target
+.settings
+.classpath
+.project

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-reporting/archiva-artifact-reports/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-reporting/archiva-report-manager/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-scheduled/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Modified: archiva/branches/archiva-1.1.x/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java
URL: http://svn.apache.org/viewvc/archiva/branches/archiva-1.1.x/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java?rev=691862&r1=691861&r2=691862&view=diff
==============================================================================
--- archiva/branches/archiva-1.1.x/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java
(original)
+++ archiva/branches/archiva-1.1.x/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java
Wed Sep  3 20:54:38 2008
@@ -25,6 +25,9 @@
 import org.apache.maven.archiva.configuration.ConfigurationEvent;
 import org.apache.maven.archiva.configuration.ConfigurationListener;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.database.ArchivaDAO;
+import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics;
+import org.apache.maven.archiva.repository.scanner.RepositoryScanStatistics;
 import org.apache.maven.archiva.scheduled.tasks.ArchivaTask;
 import org.apache.maven.archiva.scheduled.tasks.DatabaseTask;
 import org.apache.maven.archiva.scheduled.tasks.RepositoryTask;
@@ -46,6 +49,7 @@
 import org.slf4j.LoggerFactory;
 
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -81,6 +85,11 @@
      * @plexus.requirement
      */
     private ArchivaConfiguration archivaConfiguration;
+    
+    /**
+     * @plexus.requirement role-hint="jdo"
+     */
+    private ArchivaDAO dao;
 
     public static final String DATABASE_SCAN_GROUP = "database-group";
 
@@ -97,6 +106,8 @@
     public static final String CRON_HOURLY = "0 0 * * * ?";
 
     private Set<String> jobs = new HashSet<String>();
+    
+    private List<String> queuedRepos = new ArrayList<String>();
 
     public void startup()
         throws ArchivaException
@@ -126,6 +137,11 @@
                 if ( repoConfig.isScanned() )
                 {
                     scheduleRepositoryJobs( repoConfig );
+                    
+                    if( !isPreviouslyScanned( repoConfig ) )
+                    {
+                        queueInitialRepoScan( repoConfig );
+                    }
                 }
             }
 
@@ -137,6 +153,54 @@
         }
     }
 
+    private boolean isPreviouslyScanned( ManagedRepositoryConfiguration repoConfig )
+    {
+        List<RepositoryScanStatistics> results =
+            dao.query( new MostRecentRepositoryScanStatistics( repoConfig.getId() ) );
+
+        if ( results != null && !results.isEmpty() )
+        {
+            return true;
+        }
+
+        return false;
+    }
+    
+    // MRM-848: Pre-configured repository initially appear to be empty
+    private synchronized void queueInitialRepoScan( ManagedRepositoryConfiguration repoConfig
)
+    {
+        String repoId = repoConfig.getId();
+
+        RepositoryTask task = new RepositoryTask();
+        task.setRepositoryId( repoId );
+        task.setName( REPOSITORY_JOB + ":" + repoId + ":initial-scan" );
+        task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
+
+        boolean scheduleTask = false;
+
+        if ( queuedRepos.contains( repoId ) )
+        {
+            log.error( "Repository [" + repoId + "] is currently being processed or is already
queued." );
+        }
+        else
+        {
+            scheduleTask = true;
+        }
+
+        if ( scheduleTask )
+        {
+            try
+            {
+                queuedRepos.add( repoConfig.getId() );
+                this.queueRepositoryTask( task );
+            }
+            catch ( TaskQueueException e )
+            {
+                log.error( "Error occurred while queueing repository [" + repoId + "] task
: " + e.getMessage() );
+            }
+        }
+    }
+    
     private synchronized void scheduleRepositoryJobs( ManagedRepositoryConfiguration repoConfig
)
         throws SchedulerException
     {
@@ -230,6 +294,7 @@
                 scheduler.unscheduleJob( job, REPOSITORY_SCAN_GROUP );
             }
             jobs.clear();
+            queuedRepos.clear();
         }
         catch ( SchedulerException e )
         {

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -1,2 +1,5 @@
 *.iml
 target
+.settings
+.classpath
+.project

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-rss/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -3,3 +3,4 @@
 .project
 .settings
 target
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-security/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -0,0 +1 @@
+META-INF

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-webapp-test/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -3,3 +3,7 @@
 *.iml
 *.ipr
 *.iws
+.settings
+bin
+.classpath
+.project

Propchange: archiva/branches/archiva-1.1.x/archiva-modules/archiva-web/archiva-webdav/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Sep  3 20:54:38 2008
@@ -3,3 +3,4 @@
 *.iml
 .classpath
 .project
+META-INF



Mime
View raw message