ALM Site Administration API Type Library
AlignRepository Method
Description
Realigns an optimized repository that was created from a snapshot.
Syntax
Visual Basic
Public Function AlignRepository( _
   ByVal DomainName As String, _
   ByVal ProjectName As String, _
   ByVal Mode As String _
) As String
Parameters
DomainName
The logical group of projects in the ALM database.
ProjectName
The name of the project in the ALM database.
Mode
One of silent or interactive. If an empty string is passed, the mode is interactive.
Return Type

A string indicating whether the process was successfully launched.

Since the process it asynchronous, successful launch does not indicate whether the process ran to completion. Use ReadMaintenanceTaskProgress to check the actual state of the process.

Remarks

When a backup is made of a project that is online, changes to attachments may occur while the backup is in progress. Deletions, additions, or modifications performed during the backup may cause the copy of the project database to be inconsistent with the copy of the file system.

When such a backup is restored, there may be references in the project database to files that do not exist on the file system, and files on the file system that are not referenced in the project database. This method deletes the orphaned references and files.

Additions and modifications performed during the backup are not recoverable with this method.

 

Example
using SACLIENTLib;

public void AlignRepositorySync( SAapi saConnection, 
                                 string saURL, string user, string password, 
                                 string domainName, string projectName )
{
    saConnection.Login( saUrl, user, password );

    // mode is empty string for interactive behavior
    saConnection.AlignRepository( domainName, projectName, string.Empty ); 

    // set timeout for aligner to 10 minutes
    for ( int i = 0; i < 10 * 60; i++ ){ 
        Thread.Sleep( 1000 );
        projectStatus = 
            saConnection.ReadMaintenanceTaskProgress
                         (domainName, projectName );

        if ( projectStatus == "Y" || projectStatus == "N" )
             {
                break;
             }
    }

    if ( projectStatus != "Y" && projectStatus != "N" ){
            throw new Exception( "Timeout for Repository Aligner Reached" );
    }
}

See Also