VcsInitAddin
Return to Introduction  Previous page  Next page
This, required, function should be exported from all server-side addins. It is used to initialize the addin and is called when the Addin is first loaded.

procedure VcsInitAddin( const pName: PChar; pPath: PChar;   
                        DisableServerProc: TDisableServer;   
                        EnableServerProc: TEnableServer;   
                        FlushBuffersProc: TFlushBuffers;   
                        ReinitializeProc: TReinitialize;   
                        ValidateProc: TValidateRepository;   
                        FileEnumeratorProc: TEnumerateFiles;   
                        GetUserProc: TGetUserInfo;   
                        GetFileProc: TGetFileInfo;   
                        Offline: Boolean ); stdcall; export;  

If you allocate memory or resources in the Addin, you can use the VcsReleaseAddin function to release it.

Parameters

Name
Description
pName (out)
Return a descriptive name for this addin in this parameter.
pPath
This is the full path to the server repository.
DisableServerProc
A pointer to a method of type TDisableServer that can be called from within the addin.
EnableServerProc
A pointer to a method of type TEnableServer that can be called from within the addin.
FlushBuffersProc
A pointer to a method of type TFlushBuffers that can be called from within the addin.
ReinitializeProc
A pointer to a method of type TReinitialize that can be called from within the addin.
ValidateProc
A pointer to a method of type TValidateRepository that can be called from within the addin.
FileEnumeratorProc
A pointer to a method of type TEnumerateFiles that can be called from within the addin.
GetUserProc
A pointer to a method of type TGetUserInfo that can be called from within the addin.
GetFilesProc
A pointer to a method of type TGetFileInfo that can be called from within the addin.
Offline
Indicates whether the server is currently offline.


Example (Delphi)

type  
  // Callback for Validation / File Enumeration  
  TFeedbackProc = procedure( pText: PChar ); stdcall;  
  TEnumerateFilesProc = procedure( pFile: PChar ); stdcall;  
  // Interface to GPVSCore.dll  
  TDisableServer = procedure; stdcall;  
  TEnableServer = procedure; stdcall;  
  TFlushBuffers = procedure; stdcall;  
  TReinitialize = function: Boolean; stdcall;  
  TValidateRepository = procedure ( pPath, pFile: PChar; ValidateProjects: Boolean; ValidateArchives: Boolean; fbProc: TFeedbackProc ); stdcall;  
  TEnumerateFiles = procedure ( pPath: PChar; EnumerateProjects, EnumerateArchives: Boolean; EnumerateProc: TEnumerateFilesProc ); stdcall;  
  TGetUserInfo = function ( UID: Cardinal; const pName, pFullName, pEMail, pLocation, pExtra: PChar ): Integer; stdcall;  
  TGetFileInfo = function ( FileID: Cardinal; const pName, pLockedBy, pExtra: PChar; var TimeStamp, FileDate: Integer; var Virtual, Frozen, Removed: Boolean ): Integer; stdcall;  
 
var  
  DoDisableServer: TDisableServer = nil;  
  DoEnableServer: TEnableServer = nil;  
  DoFlushBuffers: TFlushBuffers = nil;  
  DoReinitialize: TReinitialize = nil;  
  DoValidateRepository: TValidateRepository = nil;  
  DoEnumerateFiles: TEnumerateFiles = nil;  
  DoGetUserInfo: TGetUserInfo = nil;  
  DoGetFileInfo: TGetFileInfo = nil;  
  RepositoryPath: String = '';  
 
procedure VcsInitAddin( const pName: PChar; pPath: PChar;   
                        DisableServerProc: TDisableServer;   
                        EnableServerProc: TEnableServer;   
                        FlushBuffersProc: TFlushBuffers;   
                        ReinitializeProc: TReinitialize;   
                        ValidateProc: TValidateRepository;   
                        FileEnumeratorProc: TEnumerateFiles;   
                        GetUserProc: TGetUserInfo;   
                        GetFileProc: TGetFileInfo;   
                        Offline: Boolean );  
begin  
  // This procedure is called when the addin is first loaded  
  // Use it to initialize internal variables.  
  StrCopy( pName, 'Sample Addin' );  
  // Store the passed function pointers for later use...  
  DoDisableServer := DisableServerProc;  
  DoEnableServer := EnableServerProc;  
  DoFlushBuffers := FlushBuffersProc;  
  DoReinitialize := ReinitializeProc;  
  DoValidateRepository := ReinitializeProc;  
  DoEnumerateFiles := FileEnumeratorProc;  
  DoGetUserInfo := GetUserProc;  
  DoGetFileInfo := GetFileProc;  
  // Remember the location of the repository  
  SetLength( RepositoryPath, StrLen( pPath ) );  
  RepositoryPath := String( pPath );  
  if Copy( RepositoryPath, Length( RepositoryPath ), 1 ) <> '\' then  
    RepositoryPath := RepositoryPath + '\';  
end;  
 

 


© 1995-2011 Quality Software Components Ltd