archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r440244 - in /maven/archiva/trunk: archiva-configuration/src/main/mdo/ archiva-core/src/main/java/org/apache/maven/archiva/scheduler/ archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/ archiva-indexer/src/main/java/org/apac...
Date Tue, 05 Sep 2006 04:08:17 GMT
Author: brett
Date: Mon Sep  4 21:08:15 2006
New Revision: 440244

URL: http://svn.apache.org/viewvc?view=rev&rev=440244
Log:
[MRM-161] add the reporter scheduled task

Added:
    maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/ReporterTask.java
  (with props)
    maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
  (contents, props changed)
      - copied, changed from r439935, maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexRecordExistsArtifactFilter.java
    maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java
  (contents, props changed)
      - copied, changed from r439934, maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java
Removed:
    maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexRecordExistsArtifactFilter.java
    maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java
Modified:
    maven/archiva/trunk/archiva-configuration/src/main/mdo/configuration.mdo
    maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/DefaultRepositoryTaskScheduler.java
    maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/RepositoryTaskScheduler.java
    maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexerTask.java
    maven/archiva/trunk/archiva-webapp/src/main/resources/xwork.xml
    maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
    maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp
    maven/archiva/trunk/design/white-site/src/site/xdoc/admin/config.xml
    maven/archiva/trunk/design/white-site/src/site/xdoc/admin/index.xml

Modified: maven/archiva/trunk/archiva-configuration/src/main/mdo/configuration.mdo
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-configuration/src/main/mdo/configuration.mdo?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-configuration/src/main/mdo/configuration.mdo (original)
+++ maven/archiva/trunk/archiva-configuration/src/main/mdo/configuration.mdo Mon Sep  4 21:08:15
2006
@@ -73,11 +73,11 @@
           <defaultValue>0 0 * * * ?</defaultValue>
         </field>
         <field>
-          <name>converterCronExpression</name>
+          <name>reporterCronExpression</name>
           <version>1.0.0</version>
           <type>String</type>
-          <description>When to run the converter mechanism. Default is every 4 hours,
on the half hour.</description>
-          <defaultValue>0 30 0/4 * * ?</defaultValue>
+          <description>When to run the indexing mechanism. Default is every hour on
the half hour.</description>
+          <defaultValue>0 30 * * * ?</defaultValue>
         </field>
         <field>
           <name>globalBlackListPatterns</name>

Modified: maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/DefaultRepositoryTaskScheduler.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/DefaultRepositoryTaskScheduler.java?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/DefaultRepositoryTaskScheduler.java
(original)
+++ maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/DefaultRepositoryTaskScheduler.java
Mon Sep  4 21:08:15 2006
@@ -61,11 +61,18 @@
 
     private static final String INDEXER_JOB = "indexerTask";
 
+    private static final String REPORTER_JOB = "reporterTask";
+
     /**
      * @plexus.requirement role-hint="indexer"
      */
     private RepositoryTask indexerTask;
 
+    /**
+     * @plexus.requirement role-hint="reporter"
+     */
+    private RepositoryTask reporterTask;
+
     public void start()
         throws StartingException
     {
@@ -97,13 +104,10 @@
     private void scheduleJobs( Configuration configuration )
         throws ParseException, SchedulerException
     {
+        // TODO! would be nice to queue jobs that are triggered so we could avoid two running
at the same time (so have a queue for discovery based jobs so they didn't thrash the repo)
         if ( configuration.getIndexPath() != null )
         {
-            JobDetail jobDetail = new JobDetail( INDEXER_JOB, DISCOVERER_GROUP, RepositoryTaskJob.class
);
-            JobDataMap dataMap = new JobDataMap();
-            dataMap.put( AbstractJob.LOGGER, getLogger() );
-            dataMap.put( RepositoryTaskJob.TASK_KEY, indexerTask );
-            jobDetail.setJobDataMap( dataMap );
+            JobDetail jobDetail = createJobDetail( INDEXER_JOB, indexerTask );
 
             getLogger().info( "Scheduling indexer: " + configuration.getIndexerCronExpression()
);
             CronTrigger trigger =
@@ -124,6 +128,23 @@
         {
             getLogger().info( "Not scheduling indexer - index path is not configured" );
         }
+
+        JobDetail jobDetail = createJobDetail( REPORTER_JOB, reporterTask );
+
+        getLogger().info( "Scheduling reporter: " + configuration.getReporterCronExpression()
);
+        CronTrigger trigger =
+            new CronTrigger( REPORTER_JOB + "Trigger", DISCOVERER_GROUP, configuration.getReporterCronExpression()
);
+        scheduler.scheduleJob( jobDetail, trigger );
+    }
+
+    private JobDetail createJobDetail( String jobName, RepositoryTask task )
+    {
+        JobDetail jobDetail = new JobDetail( jobName, DISCOVERER_GROUP, RepositoryTaskJob.class
);
+        JobDataMap dataMap = new JobDataMap();
+        dataMap.put( AbstractJob.LOGGER, getLogger() );
+        dataMap.put( RepositoryTaskJob.TASK_KEY, task );
+        jobDetail.setJobDataMap( dataMap );
+        return jobDetail;
     }
 
     public void stop()
@@ -132,6 +153,7 @@
         try
         {
             scheduler.unscheduleJob( INDEXER_JOB, DISCOVERER_GROUP );
+            scheduler.unscheduleJob( REPORTER_JOB, DISCOVERER_GROUP );
         }
         catch ( SchedulerException e )
         {
@@ -166,5 +188,11 @@
         throws TaskExecutionException
     {
         indexerTask.execute();
+    }
+
+    public void runReporter()
+        throws TaskExecutionException
+    {
+        reporterTask.execute();
     }
 }

Modified: maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/RepositoryTaskScheduler.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/RepositoryTaskScheduler.java?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/RepositoryTaskScheduler.java
(original)
+++ maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/RepositoryTaskScheduler.java
Mon Sep  4 21:08:15 2006
@@ -30,4 +30,7 @@
 
     void runIndexer()
         throws TaskExecutionException;
+
+    void runReporter()
+        throws TaskExecutionException;
 }

Modified: maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexerTask.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexerTask.java?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexerTask.java
(original)
+++ maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexerTask.java
Mon Sep  4 21:08:15 2006
@@ -27,6 +27,7 @@
 import org.apache.maven.archiva.indexer.RepositoryArtifactIndex;
 import org.apache.maven.archiva.indexer.RepositoryArtifactIndexFactory;
 import org.apache.maven.archiva.indexer.RepositoryIndexException;
+import org.apache.maven.archiva.indexer.record.IndexRecordExistsArtifactFilter;
 import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
 import org.apache.maven.archiva.scheduler.TaskExecutionException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -42,7 +43,7 @@
 import java.util.Map;
 
 /**
- * Task for discovering changes in the repository.
+ * Task for discovering changes in the repository and updating the index accordingly.
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @plexus.component role="org.apache.maven.archiva.scheduler.task.RepositoryTask" role-hint="indexer"
@@ -100,7 +101,7 @@
         throws TaskExecutionException
     {
         long time = System.currentTimeMillis();
-        getLogger().info( "Starting repository discovery process" );
+        getLogger().info( "Starting repository indexing process" );
 
         RepositoryArtifactIndex index = indexFactory.createStandardIndex( indexPath );
 

Added: maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/ReporterTask.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/ReporterTask.java?view=auto&rev=440244
==============================================================================
--- maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/ReporterTask.java
(added)
+++ maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/ReporterTask.java
Mon Sep  4 21:08:15 2006
@@ -0,0 +1,98 @@
+package org.apache.maven.archiva.scheduler.task;
+
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ConfigurationStore;
+import org.apache.maven.archiva.configuration.ConfigurationStoreException;
+import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory;
+import org.apache.maven.archiva.scheduler.TaskExecutionException;
+import org.codehaus.plexus.logging.AbstractLogEnabled;
+
+import java.util.Map;
+
+/**
+ * Task for discovering problems in the repository.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @plexus.component role="org.apache.maven.archiva.scheduler.task.RepositoryTask" role-hint="reporter"
+ */
+public class ReporterTask
+    extends AbstractLogEnabled
+    implements RepositoryTask
+{
+    /**
+     * Configuration store.
+     *
+     * @plexus.requirement
+     */
+    private ConfigurationStore configurationStore;
+
+    /**
+     * @plexus.requirement
+     */
+    private ConfiguredRepositoryFactory repoFactory;
+
+    /**
+     * @plexus.requirement role="org.apache.maven.archiva.discoverer.ArtifactDiscoverer"
+     */
+    private Map artifactDiscoverers;
+
+    public void execute()
+        throws TaskExecutionException
+    {
+        Configuration configuration;
+        try
+        {
+            configuration = configurationStore.getConfigurationFromStore();
+        }
+        catch ( ConfigurationStoreException e )
+        {
+            throw new TaskExecutionException( e.getMessage(), e );
+        }
+
+        execute( configuration );
+    }
+
+    private void execute( Configuration configuration )
+        throws TaskExecutionException
+    {
+        long time = System.currentTimeMillis();
+        getLogger().info( "Starting repository reporting process" );
+
+        // TODO!
+
+        time = System.currentTimeMillis() - time;
+        getLogger().info( "Finished repository reporting process in " + time + "ms" );
+    }
+
+    public void executeNowIfNeeded()
+        throws TaskExecutionException
+    {
+        Configuration configuration;
+        try
+        {
+            configuration = configurationStore.getConfigurationFromStore();
+        }
+        catch ( ConfigurationStoreException e )
+        {
+            throw new TaskExecutionException( e.getMessage(), e );
+        }
+
+        // TODO!
+    }
+}

Propchange: maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/ReporterTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
(from r439935, maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexRecordExistsArtifactFilter.java)
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java?view=diff&rev=440244&p1=maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexRecordExistsArtifactFilter.java&r1=439935&p2=maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/task/IndexRecordExistsArtifactFilter.java
(original)
+++ maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
Mon Sep  4 21:08:15 2006
@@ -1,4 +1,4 @@
-package org.apache.maven.archiva.scheduler.task;
+package org.apache.maven.archiva.indexer.record;
 
 /*
  * Copyright 2005-2006 The Apache Software Foundation.

Propchange: maven/archiva/trunk/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/record/IndexRecordExistsArtifactFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java
(from r439934, maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java)
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java?view=diff&rev=440244&p1=maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java&r1=439934&p2=maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunIndexerAction.java
(original)
+++ maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java
Mon Sep  4 21:08:15 2006
@@ -23,9 +23,9 @@
 /**
  * Configures the application.
  *
- * @plexus.component role="com.opensymphony.xwork.Action" role-hint="runIndexerAction"
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="runRepositoryTaskAction"
  */
-public class RunIndexerAction
+public class RunRepositoryTaskAction
     extends ActionSupport
 {
     /**
@@ -33,10 +33,18 @@
      */
     private RepositoryTaskScheduler taskScheduler;
 
-    public String execute()
+    public String runIndexer()
         throws TaskExecutionException
     {
         taskScheduler.runIndexer();
+
+        return SUCCESS;
+    }
+
+    public String runReporter()
+        throws TaskExecutionException
+    {
+        taskScheduler.runReporter();
 
         return SUCCESS;
     }

Propchange: maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/archiva/trunk/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/archiva/trunk/archiva-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-webapp/src/main/resources/xwork.xml?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-webapp/src/main/resources/xwork.xml (original)
+++ maven/archiva/trunk/archiva-webapp/src/main/resources/xwork.xml Mon Sep  4 21:08:15 2006
@@ -208,7 +208,11 @@
       <interceptor-ref name="defaultStack"/>
     </action>
 
-    <action name="runIndexer" class="runIndexerAction">
+    <action name="runIndexer" class="runRepositoryTaskAction" method="runIndexer">
+      <result type="redirect-action">index</result>
+    </action>
+
+    <action name="runReporter" class="runRepositoryTaskAction" method="runReporter">
       <result type="redirect-action">index</result>
     </action>
   </package>

Modified: maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp (original)
+++ maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/configure.jsp Mon
Sep  4 21:08:15 2006
@@ -31,6 +31,7 @@
   <ww:form method="post" action="saveConfiguration" namespace="/admin" validate="true">
     <ww:textfield name="indexPath" label="Index Directory" size="100"/>
     <ww:textfield name="indexerCronExpression" label="Indexing Schedule"/>
+    <ww:textfield name="reporterCronExpression" label="Reporting Schedule"/>
     <ww:hidden name="proxy.protocol" value="http"/>
     <ww:textfield name="proxy.host" label="HTTP Proxy Host"/>
     <ww:textfield name="proxy.port" label="HTTP Proxy Port"/>

Modified: maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp (original)
+++ maven/archiva/trunk/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp Mon Sep
 4 21:08:15 2006
@@ -43,9 +43,15 @@
     <td>
       <ww:property value="indexerCronExpression"/>
     </td>
-    <%-- TODO: a "run now without timestamp checking" operation should be here too, to
pick up any stragglers (in the event of a bug) --%>
     <%-- TODO: a "delete index and run now" operation should be here too (really clean,
remove deletions that didn't get picked up) --%>
     <td><a href="<ww:url action="runIndexer" />">Run Now</a></td>
+  </tr>
+  <tr>
+    <th>Reporting Schedule</th>
+    <td>
+      <ww:property value="reporterCronExpression"/>
+    </td>
+    <td><a href="<ww:url action="runReporter" />">Run Now</a></td>
   </tr>
 </table>
 

Modified: maven/archiva/trunk/design/white-site/src/site/xdoc/admin/config.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/design/white-site/src/site/xdoc/admin/config.xml?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/design/white-site/src/site/xdoc/admin/config.xml (original)
+++ maven/archiva/trunk/design/white-site/src/site/xdoc/admin/config.xml Mon Sep  4 21:08:15
2006
@@ -17,6 +17,10 @@
             <input type="text"/>
           </p>
           <p>
+            Reporting Cron Expression:
+            <input type="text"/>
+          </p>
+          <p>
             <input type="submit" value="Save Configuration"/>
           </p>
         </form>

Modified: maven/archiva/trunk/design/white-site/src/site/xdoc/admin/index.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/design/white-site/src/site/xdoc/admin/index.xml?view=diff&rev=440244&r1=440243&r2=440244
==============================================================================
--- maven/archiva/trunk/design/white-site/src/site/xdoc/admin/index.xml (original)
+++ maven/archiva/trunk/design/white-site/src/site/xdoc/admin/index.xml Mon Sep  4 21:08:15
2006
@@ -21,6 +21,13 @@
             <a href="#">Run Now</a>
           </td>
         </tr>
+        <tr>
+          <th>Reporting Schedule</th>
+          <td>...</td>
+          <td>
+            <a href="#">Run Now</a>
+          </td>
+        </tr>
       </table>
 
       <p>



Mime
View raw message