addons/koji/common/src/main/java/org/commonjava/indy/koji/data/KojiRepairManager.java
private KojiRepairResult.RepairResult doRepair( String packageType, RemoteRepository repository,
                                                    KojiBuildInfo buildInfo, String user, boolean isDryRun )
                    throws KojiRepairException
    {
        StoreKey storeKey;
        if ( repository != null )
        {
            storeKey = repository.getKey();
        }
        else
        {
            String name = kojiUtils.getRepositoryName( buildInfo );
            storeKey = new StoreKey( packageType, StoreType.remote, name );
            try
            {
                repository = (RemoteRepository) storeManager.getArtifactStore( storeKey );
            }
            catch ( IndyDataException e )
            {
                throw new KojiRepairException( "Cannot get store: %s. Reason: %s", e, storeKey,
                                               e.getMessage() );
            }
        }

        KojiRepairResult.RepairResult repairResult = new KojiRepairResult.RepairResult( storeKey );

        String url = repository.getUrl();

        String newUrl;
        try
        {
            newUrl = kojiUtils.formatStorageUrl( config.getStorageRootUrl(), buildInfo ); // volume is involved
        }
        catch ( MalformedURLException e )
        {
            throw new KojiRepairException( "Failed to format storage Url: %s. Reason: %s", e, storeKey,
                                           e.getMessage() );
        }

        boolean changed = !url.equals( newUrl );
        if ( changed )
        {
            repairResult.withPropertyChange( "url", url, newUrl );

            if ( !isDryRun )
            {
                ChangeSummary changeSummary = new ChangeSummary( user,
                                                                 "Repair " + storeKey + " url with volume: " + buildInfo
                                                                                 .getVolumeName() );
                repository.setUrl( newUrl );
                repository.setMetadata( METADATA_KOJI_BUILD_ID, Integer.toString( buildInfo.getId() ) );
                boolean fireEvents = false;
                boolean skipIfExists = false;
                try
                {
                    storeManager.storeArtifactStore( repository, changeSummary, skipIfExists, fireEvents, new EventMetadata() );
                }
                catch ( IndyDataException e )
                {
                    throw new KojiRepairException( "Failed to repair store: %s. Reason: %s", e, storeKey, e.getMessage() );
                }
            }
        }
        return repairResult;
    }
private KojiRepairResult.RepairResult doRepair( String packageType, RemoteRepository repository,
                                                    KojiBuildInfo buildInfo, String user, boolean isDryRun )
                    throws KojiRepairException
    {
        StoreKey storeKey;
        if ( repository != null )
        {
            storeKey = repository.getKey();
        }
        else
        {
            String name = kojiUtils.getRepositoryName( buildInfo );
            storeKey = new StoreKey( packageType, StoreType.remote, name );
            try
            {
                repository = (RemoteRepository) storeManager.getArtifactStore( storeKey );
            }
            catch ( IndyDataException e )
            {
                throw new KojiRepairException( "Cannot get store: %s. Reason: %s", e, storeKey,
                                               e.getMessage() );
            }
        }

        KojiRepairResult.RepairResult repairResult = new KojiRepairResult.RepairResult( storeKey );

        String url = repository.getUrl();

        String newUrl;
        try
        {
            newUrl = kojiUtils.formatStorageUrl( config.getStorageRootUrl(), buildInfo ); // volume is involved
        }
        catch ( MalformedURLException e )
        {
            throw new KojiRepairException( "Failed to format storage Url: %s. Reason: %s", e, storeKey,
                                           e.getMessage() );
        }

        boolean changed = !url.equals( newUrl );
        if ( changed )
        {
            repairResult.withPropertyChange( "url", url, newUrl );

            if ( !isDryRun )
            {
                ChangeSummary changeSummary = new ChangeSummary( user,
                                                                 "Repair " + storeKey + " url with volume: " + buildInfo
                                                                                 .getVolumeName() );
                repository.setUrl( newUrl );
                repository.setMetadata( METADATA_KOJI_BUILD_ID, Integer.toString( buildInfo.getId() ) );
                boolean fireEvents = false;
                boolean skipIfExists = false;
                try
                {
                    storeManager.storeArtifactStore( repository, changeSummary, skipIfExists, fireEvents, new EventMetadata() );
                }
                catch ( IndyDataException e )
                {
                    throw new KojiRepairException( "Failed to repair store: %s. Reason: %s", e, storeKey, e.getMessage() );
                }
            }
        }
        return repairResult;
    }
Repair one remote repository.
@param packageType
@param repository repository to be repaired. If null, the repository name will be retrieved according to
the buildInfo and the naming format in koji.conf.
@param buildInfo koji build which this repository proxies
@param user the user does the repair
@param isDryRun
@return
@throws KojiRepairException