Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdministrationController"/> class.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/>.</param>
 /// <param name="serverControl">The value of <see cref="serverControl"/>.</param>
 /// <param name="serverUpdater">The value of <see cref="serverUpdater"/>.</param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/>.</param>
 /// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 /// <param name="updatesConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="updatesConfiguration"/>.</param>
 /// <param name="fileLoggingConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="fileLoggingConfiguration"/>.</param>
 public AdministrationController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IGitHubClientFactory gitHubClientFactory,
     IServerControl serverControl,
     IServerUpdateInitiator serverUpdater,
     IAssemblyInformationProvider assemblyInformationProvider,
     IIOManager ioManager,
     IPlatformIdentifier platformIdentifier,
     IFileTransferTicketProvider fileTransferService,
     ILogger <AdministrationController> logger,
     IOptions <UpdatesConfiguration> updatesConfigurationOptions,
     IOptions <FileLoggingConfiguration> fileLoggingConfigurationOptions)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     this.gitHubClientFactory         = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.serverControl               = serverControl ?? throw new ArgumentNullException(nameof(serverControl));
     this.serverUpdater               = serverUpdater ?? throw new ArgumentNullException(nameof(serverUpdater));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.ioManager           = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.fileTransferService = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
     updatesConfiguration     = updatesConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(updatesConfigurationOptions));
     fileLoggingConfiguration = fileLoggingConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(fileLoggingConfigurationOptions));
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceFactory"/> class.
 /// </summary>
 /// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
 /// <param name="databaseContextFactory">The value of <see cref="databaseContextFactory"/>.</param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/>.</param>
 /// <param name="loggerFactory">The value of <see cref="loggerFactory"/>.</param>
 /// <param name="topicClientFactory">The value of <see cref="topicClientFactory"/>.</param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/>.</param>
 /// <param name="synchronousIOManager">The value of <see cref="synchronousIOManager"/>.</param>
 /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/>.</param>
 /// <param name="byondInstaller">The value of <see cref="byondInstaller"/>.</param>
 /// <param name="chatFactory">The value of <see cref="chatFactory"/>.</param>
 /// <param name="processExecutor">The value of <see cref="processExecutor"/>.</param>
 /// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/>.</param>
 /// <param name="watchdogFactory">The value of <see cref="watchdogFactory"/>.</param>
 /// <param name="jobManager">The value of <see cref="jobManager"/>.</param>
 /// <param name="networkPromptReaper">The value of <see cref="networkPromptReaper"/>.</param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="repositoryFactory">The value of <see cref="repositoryFactory"/>.</param>
 /// <param name="repositoryCommands">The value of <see cref="repositoryCommands"/>.</param>
 /// <param name="serverPortProvider">The value of <see cref="serverPortProvider"/>.</param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="gitRemoteFeaturesFactory">The value of <see cref="gitRemoteFeaturesFactory"/>.</param>
 /// <param name="remoteDeploymentManagerFactory">The value of <see cref="remoteDeploymentManagerFactory"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 public InstanceFactory(
     IIOManager ioManager,
     IDatabaseContextFactory databaseContextFactory,
     IAssemblyInformationProvider assemblyInformationProvider,
     ILoggerFactory loggerFactory,
     ITopicClientFactory topicClientFactory,
     ICryptographySuite cryptographySuite,
     ISynchronousIOManager synchronousIOManager,
     ISymlinkFactory symlinkFactory,
     IByondInstaller byondInstaller,
     IChatManagerFactory chatFactory,
     IProcessExecutor processExecutor,
     IPostWriteHandler postWriteHandler,
     IWatchdogFactory watchdogFactory,
     IJobManager jobManager,
     INetworkPromptReaper networkPromptReaper,
     IPlatformIdentifier platformIdentifier,
     ILibGit2RepositoryFactory repositoryFactory,
     ILibGit2Commands repositoryCommands,
     IServerPortProvider serverPortProvider,
     IFileTransferTicketProvider fileTransferService,
     IGitRemoteFeaturesFactory gitRemoteFeaturesFactory,
     IRemoteDeploymentManagerFactory remoteDeploymentManagerFactory,
     IOptions <GeneralConfiguration> generalConfigurationOptions)
 {
     this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.databaseContextFactory      = databaseContextFactory ?? throw new ArgumentNullException(nameof(databaseContextFactory));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.loggerFactory                  = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
     this.topicClientFactory             = topicClientFactory ?? throw new ArgumentNullException(nameof(topicClientFactory));
     this.cryptographySuite              = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.synchronousIOManager           = synchronousIOManager ?? throw new ArgumentNullException(nameof(synchronousIOManager));
     this.symlinkFactory                 = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
     this.byondInstaller                 = byondInstaller ?? throw new ArgumentNullException(nameof(byondInstaller));
     this.chatFactory                    = chatFactory ?? throw new ArgumentNullException(nameof(chatFactory));
     this.processExecutor                = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
     this.postWriteHandler               = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler));
     this.watchdogFactory                = watchdogFactory ?? throw new ArgumentNullException(nameof(watchdogFactory));
     this.jobManager                     = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.networkPromptReaper            = networkPromptReaper ?? throw new ArgumentNullException(nameof(networkPromptReaper));
     this.platformIdentifier             = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.repositoryFactory              = repositoryFactory ?? throw new ArgumentNullException(nameof(repositoryFactory));
     this.repositoryCommands             = repositoryCommands ?? throw new ArgumentNullException(nameof(repositoryCommands));
     this.serverPortProvider             = serverPortProvider ?? throw new ArgumentNullException(nameof(serverPortProvider));
     this.fileTransferService            = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
     this.gitRemoteFeaturesFactory       = gitRemoteFeaturesFactory ?? throw new ArgumentNullException(nameof(gitRemoteFeaturesFactory));
     this.remoteDeploymentManagerFactory = remoteDeploymentManagerFactory ?? throw new ArgumentNullException(nameof(remoteDeploymentManagerFactory));
     generalConfiguration                = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ByondController"/> class.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="instanceManager">The <see cref="IInstanceManager"/> for the <see cref="InstanceRequiredController"/>.</param>
 /// <param name="jobManager">The value of <see cref="jobManager"/>.</param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 public ByondController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IInstanceManager instanceManager,
     IJobManager jobManager,
     IFileTransferTicketProvider fileTransferService,
     ILogger <ByondController> logger)
     : base(
         instanceManager,
         databaseContext,
         authenticationContextFactory,
         logger)
 {
     this.jobManager          = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.fileTransferService = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
 }
        /// <summary>
        /// Construct <see cref="Configuration"/>
        /// </summary>
        /// <param name="ioManager">The value of <see cref="ioManager"/></param>
        /// <param name="synchronousIOManager">The value of <see cref="synchronousIOManager"/></param>
        /// <param name="symlinkFactory">The value of <see cref="symlinkFactory"/></param>
        /// <param name="processExecutor">The value of <see cref="processExecutor"/></param>
        /// <param name="postWriteHandler">The value of <see cref="postWriteHandler"/></param>
        /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
        /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
        /// <param name="logger">The value of <see cref="logger"/></param>
        public Configuration(
            IIOManager ioManager,
            ISynchronousIOManager synchronousIOManager,
            ISymlinkFactory symlinkFactory,
            IProcessExecutor processExecutor,
            IPostWriteHandler postWriteHandler,
            IPlatformIdentifier platformIdentifier,
            IFileTransferTicketProvider fileTransferService,
            ILogger <Configuration> logger)
        {
            this.ioManager            = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
            this.synchronousIOManager = synchronousIOManager ?? throw new ArgumentNullException(nameof(synchronousIOManager));
            this.symlinkFactory       = symlinkFactory ?? throw new ArgumentNullException(nameof(symlinkFactory));
            this.processExecutor      = processExecutor ?? throw new ArgumentNullException(nameof(processExecutor));
            this.postWriteHandler     = postWriteHandler ?? throw new ArgumentNullException(nameof(postWriteHandler));
            this.platformIdentifier   = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
            this.fileTransferService  = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
            this.logger = logger ?? throw new ArgumentNullException(nameof(logger));

            semaphore   = new SemaphoreSlim(1);
            disposeCts  = new CancellationTokenSource();
            uploadTasks = Task.CompletedTask;
        }