From 62e0518548af2be9fe46f8472fbcb135791812c6 Mon Sep 17 00:00:00 2001 From: "Edwin L. Punzalan" Date: Mon, 11 Dec 2006 08:30:32 +0000 Subject: [PATCH] PR: MRM-247 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 --- .../executors/IndexerTaskExecutor.java | 8 ++++++ .../web/action/admin/ConfigureAction.java | 27 +++++++++++++++++++ .../main/webapp/WEB-INF/jsp/admin/index.jsp | 7 +++++ 3 files changed, 42 insertions(+) diff --git a/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/executors/IndexerTaskExecutor.java b/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/executors/IndexerTaskExecutor.java index f563ee8fc..ae3ebea14 100644 --- a/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/executors/IndexerTaskExecutor.java +++ b/archiva-core/src/main/java/org/apache/maven/archiva/scheduler/executors/IndexerTaskExecutor.java @@ -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" ); } diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java index 9f604b3ef..08c03480d 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java @@ -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; diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp index 9b73d566b..8c795d8c3 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/index.jsp @@ -57,6 +57,13 @@ + + Last Indexing Time + + + + + -- 2.39.5