]> source.dussan.org Git - archiva.git/commitdiff
PR: MRM-247
authorEdwin L. Punzalan <epunzalan@apache.org>
Mon, 11 Dec 2006 08:30:32 +0000 (08:30 +0000)
committerEdwin L. Punzalan <epunzalan@apache.org>
Mon, 11 Dec 2006 08:30:32 +0000 (08:30 +0000)
Submitted by: Teodoro Cue, Jr.

Add timestamp when the indexer last run for user reference

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@485552 13f79535-47bb-0310-9956-ffa450edef68

archiva-core/src/main/java/org/apache/maven/archiva/scheduler/executors/IndexerTaskExecutor.java
archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java
archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp

index f563ee8fc2aa2f55e85902e48b02420365ac7de7..ae3ebea14164104b75f759ad316f8a3ba54d8c20 100644 (file)
@@ -104,8 +104,15 @@ public class IndexerTaskExecutor
      */
     private ReportGroup reportGroup;
 
+    private long lastIndexingTime = 0;
+
     private static final int ARTIFACT_BUFFER_SIZE = 1000;
 
+    public long getLastIndexingTime()
+    {
+        return lastIndexingTime;
+    }
+
     public void executeTask( Task task )
         throws TaskExecutionException
     {
@@ -282,6 +289,7 @@ public class IndexerTaskExecutor
         }
 
         time = System.currentTimeMillis() - time;
+        lastIndexingTime = System.currentTimeMillis();
         getLogger().info( "Finished repository indexing process in " + time + "ms" );
     }
 
index 9f604b3ef1c7011d68a9c10086c847c4bbc7ff55..08c03480da13b3bb8ebb5a443da9429a67f7cec8 100644 (file)
@@ -26,6 +26,7 @@ import org.apache.maven.archiva.configuration.ConfigurationStoreException;
 import org.apache.maven.archiva.configuration.InvalidConfigurationException;
 import org.apache.maven.archiva.indexer.RepositoryIndexException;
 import org.apache.maven.archiva.indexer.RepositoryIndexSearchException;
+import org.apache.maven.archiva.scheduler.executors.IndexerTaskExecutor;
 import org.apache.maven.archiva.security.ArchivaRoleConstants;
 import org.codehaus.plexus.scheduler.CronExpressionValidator;
 import org.codehaus.plexus.security.rbac.Resource;
@@ -36,6 +37,7 @@ import org.codehaus.plexus.xwork.action.PlexusActionSupport;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.Date;
 
 /**
  * Configures the application.
@@ -51,6 +53,11 @@ public class ConfigureAction
      */
     private ConfigurationStore configurationStore;
 
+    /**
+     * @plexus.requirement role="org.codehaus.plexus.taskqueue.execution.TaskExecutor" role-hint="indexer"
+     */
+    private IndexerTaskExecutor indexer;
+
     /**
      * The configuration.
      */
@@ -72,6 +79,8 @@ public class ConfigureAction
 
     private String year;
 
+    private String lastIndexingTime;
+
     public void validate()
     {
         //validate cron expression
@@ -146,6 +155,14 @@ public class ConfigureAction
             i++;
         }
 
+        if ( indexer.getLastIndexingTime() != 0 ) {
+            lastIndexingTime = new Date( indexer.getLastIndexingTime() ).toString();
+        }
+        else
+        {
+            lastIndexingTime = "Never been run.";
+        }
+
         return INPUT;
     }
 
@@ -160,6 +177,16 @@ public class ConfigureAction
         configuration = configurationStore.getConfigurationFromStore();
     }
 
+    public String getLastIndexingTime()
+    {
+        return lastIndexingTime;
+    }
+
+    public void setLastIndexingTime(String lastIndexingTime)
+    {
+        this.lastIndexingTime = lastIndexingTime;
+    }
+
     public String getSecond()
     {
         return second;
index 9b73d566b28bbed3faf79e114dbf393c5670df3b..8c795d8c39a1222a52797da270877abd94c22d6f 100644 (file)
       </pss:ifAuthorized>
     </td>
   </tr>
+  <tr>
+    <th>Last Indexing Time</th>
+    <td>
+      <ww:property value="lastIndexingTime"/>
+    </td>
+    <td></td>
+  </tr>
 </table>
 
 <ww:set name="proxy" value="proxy"/>