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
This commit is contained in:
Edwin L. Punzalan 2006-12-11 08:30:32 +00:00
parent eb278b5812
commit 62e0518548
3 changed files with 42 additions and 0 deletions

View 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" );
}

View 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;

View File

@ -57,6 +57,13 @@
</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"/>