String projectId, String projectVersion )
throws MetadataResolutionException
{
MetadataRepository metadataRepository = session.getRepository();
ProjectVersionMetadata metadata =
metadataRepository.getProjectVersion( repoId, namespace, projectId, projectVersion );
// TODO: do we want to detect changes as well by comparing timestamps? isProjectVersionNewerThan(updated)
// in such cases we might also remove/update stale metadata, including adjusting plugin-based facets
// This would also be better than checking for completeness - we can then refresh only when fixed (though
// sometimes this has an additional dependency - such as a parent - requesting the user to force an update
// may then work here and be more efficient than always trying again)
if ( metadata == null || metadata.isIncomplete() )
{
try
{
metadata = repositoryStorage.readProjectVersionMetadata( repoId, namespace, projectId, projectVersion );
if ( log.isDebugEnabled() )
{
log.debug( "Resolved project version metadata from storage: " + metadata );
}
// FIXME: make this a more generic post-processing that plugins can take advantage of
// eg. maven projects should be able to process parent here
if ( !metadata.getDependencies().isEmpty() )
{
ProjectVersionReference ref = new ProjectVersionReference();
ref.setNamespace( namespace );
ref.setProjectId( projectId );
ref.setProjectVersion( projectVersion );