示例#1
0
 /************************ Construction ***********************************/
 /*----------------------- GitContext ------------------------------------*/
 /// <summary>
 /// Injection constructor
 /// </summary>
 /// <param name="localFactory">
 /// Local repository factory
 /// </param>
 /// <param name="remoteFactory">
 /// Remote repository factory
 /// </param>
 /// <param name="gitExec">
 /// Git executor
 /// </param>
 /// <param name="lfsExec">
 /// LFS executor
 /// </param>
 public GitContext(
     IGitCacheConfiguration gitCacheConfiguration,
     ILocalRepositoryFactory localFactory,
     IRemoteRepositoryFactory remoteFactory,
     IGitExecuter gitExec,
     IGitLFSExecuter lfsExec)
 {
     if (null == (Configuration = gitCacheConfiguration))
     {
         throw new ArgumentNullException(nameof(gitCacheConfiguration), "Missing git-cache configuration");
     }
     if (null == (LocalFactory = localFactory))
     {
         throw new ArgumentNullException(nameof(localFactory), "Missing required local repository factory");
     }
     if (null == (RemoteFactory = remoteFactory))
     {
         throw new ArgumentNullException(nameof(remoteFactory), "Remote repository factory must be valid");
     }
     if (null == (GitExecuter = gitExec))
     {
         throw new ArgumentNullException(nameof(gitExec), "Git executor must be valid");
     }
     if (null == (LFSExecuter = lfsExec))
     {
         throw new ArgumentNullException(nameof(lfsExec), "LFS executor must be valid");
     }
 } /* End of Function - GitContext */
 /*======================= PUBLIC ========================================*/
 /************************ Events *****************************************/
 /************************ Properties *************************************/
 /************************ Construction ***********************************/
 /*----------------------- ResourceLockFilterAsyncAttribute --------------*/
 /// <summary>
 ///
 /// </summary>
 /// <param name="lockManager"></param>
 /// <param name="logger"></param>
 /// <param name="config"></param>
 public ResourceLockFilterAsyncAttribute(IResourceLockManager <string> lockManager,
                                         ILogger <ResourceLockFilterAsyncAttribute> logger,
                                         IGitCacheConfiguration config)
     : base(lockManager, logger, config)
 {
     ;
 } /* End of Function - ResourceLockFilterAsyncAttribute */
 /*======================= PUBLIC ========================================*/
 /************************ Events *****************************************/
 /************************ Properties *************************************/
 /************************ Construction ***********************************/
 /*----------------------- ReaderWriterLockFilterAsyncAttribute ----------*/
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="config">
 /// Git configuration object
 /// </param>
 /// <param name="gitContext">
 /// Git context object
 /// </param>
 /// <param name="lockManager">
 /// Lock manager
 /// </param>
 /// <param name="logger">
 /// Logger for the object
 /// </param>
 /// <param name="remoteStatusSvc">
 /// Service for getting the reference status
 /// </param>
 public ReaderWriterLockFilterAsyncAttribute(
     IReaderWriterLockManager <string> lockManager,
     ILogger <ReaderWriterLockFilterAsyncAttribute> logger,
     IGitCacheConfiguration config,
     IRemoteStatus remoteStatusSvc,
     IGitContext gitContext)
 {
     if (null == (Manager = lockManager))
     {
         throw new ArgumentNullException(
                   nameof(lockManager), "Lock manager must be a valid value");
     }
     if (null == (Logger = logger))
     {
         throw new ArgumentNullException(
                   nameof(logger), "Logger must be a valid value");
     }
     if (null == (Configuration = config))
     {
         throw new ArgumentNullException(
                   nameof(config), "Configuration must be a valid value");
     }
     if (null == (RemoteStatusService = remoteStatusSvc))
     {
         throw new ArgumentNullException(
                   nameof(remoteStatusSvc), "Remote status service must be a valid value");
     }
     if (null == (GitContext = gitContext))
     {
         throw new ArgumentNullException(
                   nameof(gitContext), "A valid git context must be provided");
     }
 } /* End of Function - ReaderWriterLockFilterAsyncAttribute */
示例#4
0
 /************************ Construction ***********************************/
 /*----------------------- LocalRepo -------------------------------------*/
 /// <summary>
 /// Constructor, taking a remote repository and local configuration object
 /// </summary>
 /// <param name="remoteRepo">
 /// A remote repository to setup a local one for
 /// </param>
 /// <param name="config">
 /// A configuration object to use for the local repository
 /// </param>
 public LocalRepository(IRemoteRepository remoteRepo, IGitCacheConfiguration config)
 {
     if (null == (Remote = remoteRepo))
     {
         throw new ArgumentNullException(
                   nameof(remoteRepo),
                   "Must provide a remote repository object");
     }
     if (null == config)
     {
         throw new ArgumentNullException(
                   nameof(config),
                   "Must provide a valid configuration item");
     }
     Path = System.IO.Path.Combine(config.LocalStoragePath,
                                   Remote.Server,
                                   Remote.Owner,
                                   Remote.Name);
 } /* End of Function - LocalRepo */
 /************************ Construction ***********************************/
 /*----------------------- BaseResourceLockFilterAttribute ---------------*/
 /// <summary>
 /// Constructor for initializing required components
 /// </summary>
 /// <param name="lockManager">
 /// Required lock manager
 /// </param>
 /// <param name="logger">
 /// Required logger to use for the instance
 /// </param>
 /// <param name="config">
 /// Required configuration object
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// If any of the arguments are null
 /// </exception>
 protected BaseResourceLockFilterAttribute(IResourceLockManager <string> lockManager,
                                           ILogger logger,
                                           IGitCacheConfiguration config)
 {
     if (null == (LockManager = lockManager))
     {
         throw new ArgumentNullException(
                   nameof(lockManager), "Lock manager must be a valid value");
     }
     if (null == (Logger = logger))
     {
         throw new ArgumentNullException(
                   nameof(logger), "Logger must be a valid value");
     }
     if (null == (Configuration = config))
     {
         throw new ArgumentNullException(
                   nameof(config), "Configuration must be a valid value");
     }
 } /* End of Function - BaseResourceLockFilterAttribute */
示例#6
0
 /*======================= PUBLIC ========================================*/
 /************************ Events *****************************************/
 /************************ Properties *************************************/
 /************************ Construction ***********************************/
 /************************ Methods ****************************************/
 /*----------------------- Build -----------------------------------------*/
 /// <summary>
 ///
 /// </summary>
 /// <param name="repo"></param>
 /// <param name="config"></param>
 public ILocalRepository Build(
     IRemoteRepository repo,
     IGitCacheConfiguration config)
 {
     return(new LocalRepository(repo, config));
 } /* End of Function - Build */