import org.apache.maven.archiva.indexer.record.IndexRecordExistsArtifactFilter;
import org.apache.maven.archiva.indexer.record.RepositoryIndexRecordFactory;
import org.apache.maven.archiva.reporting.ReportExecutor;
+import org.apache.maven.archiva.reporting.ReportingDatabase;
import org.apache.maven.archiva.reporting.ReportingMetadataFilter;
import org.apache.maven.archiva.reporting.ReportingStoreException;
import org.apache.maven.archiva.scheduler.TaskExecutionException;
boolean includeSnapshots = repositoryConfiguration.isIncludeSnapshots();
ArtifactRepository repository = repoFactory.createRepository( repositoryConfiguration );
+ ReportingDatabase reporter = reportExecutor.getReportDatabase( repository );
+
+ // keep original value in case there is another process under way
+ long origStartTime = reporter.getStartTime();
+ reporter.setStartTime( System.currentTimeMillis() );
// Discovery process
String layoutProperty = repositoryConfiguration.getLayout();
}
}
- MetadataFilter metadataFilter =
- new ReportingMetadataFilter( reportExecutor.getReportDatabase( repository ) );
+ MetadataFilter metadataFilter = new ReportingMetadataFilter( reporter );
MetadataDiscoverer metadataDiscoverer =
(MetadataDiscoverer) metadataDiscoverers.get( layoutProperty );
// run the reports
reportExecutor.runMetadataReports( metadata, repository );
}
+
+ reporter.setStartTime( origStartTime );
}
}
}
public void storeReports( ReportingDatabase database, ArtifactRepository repository )
throws ReportingStoreException
{
+ database.updateTimings();
+
ReportingXpp3Writer writer = new ReportingXpp3Writer();
File file = new File( repository.getBasedir(), "report-database.xml" );
IOUtil.close( fileWriter );
}
}
-
}
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
private boolean inProgress;
+ private long startTime;
+
public ReportingDatabase()
{
this( new Reporting(), null );
ArtifactResults results = getArtifactResults( artifact );
results.addFailure( createResults( reason ) );
numFailures++;
+ updateTimings();
}
public void addWarning( Artifact artifact, String reason )
ArtifactResults results = getArtifactResults( artifact );
results.addWarning( createResults( reason ) );
numWarnings++;
+ updateTimings();
}
private ArtifactResults getArtifactResults( Artifact artifact )
MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
results.addFailure( createResults( reason ) );
numFailures++;
+ updateTimings();
}
public void addWarning( RepositoryMetadata metadata, String reason )
MetadataResults results = getMetadataResults( metadata, System.currentTimeMillis() );
results.addWarning( createResults( reason ) );
numWarnings++;
+ updateTimings();
}
private void initMetadataMap()
public void setInProgress( boolean inProgress )
{
this.inProgress = inProgress;
+
+ if ( inProgress )
+ {
+ startTime = System.currentTimeMillis();
+ }
}
public void clear()
reporting.getArtifacts().clear();
reporting.getMetadata().clear();
+
+ updateTimings();
+ }
+
+ public void setStartTime( long startTime )
+ {
+ this.startTime = startTime;
+ }
+
+ public long getStartTime()
+ {
+ return startTime;
+ }
+
+ public void updateTimings()
+ {
+ long startTime = getStartTime();
+ Date endTime = new Date();
+ if ( startTime > 0 )
+ {
+ getReporting().setExecutionTime( endTime.getTime() - startTime );
+ }
+ getReporting().setLastModified( endTime );
}
}
<multiplicity>*</multiplicity>
</association>
</field>
+ <field xml.attribute="true">
+ <name>lastModified</name>
+ <version>1.0.0</version>
+ <type>Date</type>
+ </field>
+ <field xml.attribute="true">
+ <name>executionTime</name>
+ <version>1.0.0</version>
+ <type>long</type>
+ </field>
</fields>
</class>
<class>
<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
- <title>Repository Health</title>
+ <%-- TODO! change the name --%>
+ <title>Report: Repository Health</title>
<ww:head/>
</head>
<div id="contentArea">
-<ww:actionerror/>
+<%-- TODO!: select report, repository and filter --%>
<ww:set name="databases" value="databases"/>
<c:forEach items="${databases}" var="database">
${database.numFailures}
<img src="<c:url value="/images/icon_warning_sml.gif"/>" width="15" height="15" alt=""/>
${database.numWarnings}
+
+ <span style="font-size: x-small">
+ <%-- TODO! use better formatting here --%>
+ Last updated: ${database.reporting.lastModified},
+ execution time: <fmt:formatNumber maxFractionDigits="0" value="${database.reporting.executionTime / 60000}"/> minutes
+ <fmt:formatNumber maxFractionDigits="0" value="${(database.reporting.executionTime / 1000) % 60}"/> seconds
+ </span>
</p>
<%-- TODO need to protect iterations against concurrent modification exceptions by cloning the lists synchronously --%>
</tr>
</table>
- <p>
- <span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
- </span>
- </p>
<div>
<div style="float: right">
<a href="#">Repair all</a>
2
<img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
1
+ <span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
+ </span>
</p>
<h3>Artifacts</h3>
2
<img src="images/icon_warning_sml.gif" width="15" height="15" alt=""/>
0
+ <span style="font-size: x-small">Report finished: 12 Jun 2006 10:11:12, execution time: 10 minutes 15 seconds
+ </span>
</p>
<h3>Artifacts</h3>