metadataResolving( session, trace, metadata, repository );
LocalRepositoryManager lrm = session.getLocalRepositoryManager();
LocalMetadataRequest localRequest =
new LocalMetadataRequest( metadata, repository, request.getRequestContext() );
LocalMetadataResult lrmResult = lrm.find( session, localRequest );
File metadataFile = lrmResult.getFile();
if ( session.isOffline() )
{
if ( metadataFile != null )
{
metadata = metadata.setFile( metadataFile );
result.setMetadata( metadata );
}
else
{
String msg =
"The repository system is offline but the metadata " + metadata + " from " + repository
+ " is not available in the local repository.";
result.setException( new MetadataNotFoundException( metadata, repository, msg ) );
}
metadataResolved( session, trace, metadata, repository, result.getException() );
continue;
}
Long localLastUpdate = null;
if ( request.isFavorLocalRepository() )
{
File localFile = getLocalFile( session, metadata );
localLastUpdate = localLastUpdates.get( localFile );
if ( localLastUpdate == null )
{
localLastUpdate = Long.valueOf( localFile != null ? localFile.lastModified() : 0 );
localLastUpdates.put( localFile, localLastUpdate );
}
}
List<UpdateCheck<Metadata, MetadataTransferException>> checks =
new ArrayList<UpdateCheck<Metadata, MetadataTransferException>>();
Exception exception = null;
for ( RemoteRepository repo : repositories )
{
UpdateCheck<Metadata, MetadataTransferException> check =
new UpdateCheck<Metadata, MetadataTransferException>();
check.setLocalLastUpdated( ( localLastUpdate != null ) ? localLastUpdate.longValue() : 0 );
check.setItem( metadata );
// use 'main' installation file for the check (-> use requested repository)
File checkFile =
new File(
session.getLocalRepository().getBasedir(),
session.getLocalRepositoryManager().getPathForRemoteMetadata( metadata, repository,
request.getRequestContext() ) );
check.setFile( checkFile );
check.setRepository( repository );
check.setAuthoritativeRepository( repo );
check.setPolicy( getPolicy( session, repo, metadata.getNature() ).getUpdatePolicy() );
if ( lrmResult.isStale() )
{
checks.add( check );
}
else
{