private void ConfigureIoC() { StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; StructureMapConfiguration.BuildInstancesOf <HomeController>().TheDefaultIsConcreteType <HomeController>(); DependencyResolver.InitializeWith(new StructureMapDependencyResolver()); ControllerBuilder.Current.SetControllerFactory(typeof(IoCControllerFactory)); }
public void Onstart() { _logger.Log("Agent Service Starting ..."); _logger.Log("Agent Version: " + Assembly.GetExecutingAssembly().GetName().Version); const int TIMER_INTERVAL_IS_SIX_SECONDS = 6000; RestartManager.RestartNeeded = false; CommandsController.ProcessCommands = true; _timer = new ProdTimer { Interval = TIMER_INTERVAL_IS_SIX_SECONDS }; _timer.Elapsed(TimerElapsed); StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; StructureMapConfiguration.BuildInstancesOf <ITimer>().TheDefaultIs(Registry.Object(_timer)); IoC.Register(); RunXenToolsUpgradeChecks(); RunCloudAutomation(); CheckAgentUpdater(); _timer.Enabled = true; }
public static void Register() { StructureMapConfiguration.BuildInstancesOf <ILogger>().TheDefaultIsConcreteType <Logger>(); StructureMapConfiguration.BuildInstancesOf <IBackupAgent>().TheDefaultIsConcreteType <BackupAgent>(); StructureMapConfiguration.BuildInstancesOf <IAgentDownload>().TheDefaultIsConcreteType <AgentDownload>(); StructureMapConfiguration.BuildInstancesOf <ICheckSumCheck>().TheDefaultIsConcreteType <CheckSumCheck>(); StructureMapConfiguration.BuildInstancesOf <IStopAgentService>().TheDefaultIsConcreteType <StopAgentService>(); StructureMapConfiguration.BuildInstancesOf <IStartAgentService>().TheDefaultIsConcreteType <StartAgentService>(); StructureMapConfiguration.BuildInstancesOf <IInstallAgentService>().TheDefaultIsConcreteType <InstallAgentService>(); StructureMapConfiguration.BuildInstancesOf <IFinalize>().TheDefaultIsConcreteType <Finalize>(); }
public static void ConfigureStructureMap() { if (!_isStructureMapConfigured) { StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; StructureMapConfiguration.BuildInstancesOf <ITimer>().TheDefaultIs( Registry.Object(MockRepository.GenerateMock <ITimer>())); IoC.Register(); _isStructureMapConfigured = true; } }
public void Onstart() { _logger.Log("Agent Service Starting ..."); _logger.Log("Agent Version: " + Assembly.GetExecutingAssembly().GetName().Version); const int TIMER_INTERVAL_IS_SIX_SECONDS = 6000; _timer = new ProdTimer { Interval = TIMER_INTERVAL_IS_SIX_SECONDS }; _timer.Elapsed(TimerElapsed); _timer.Enabled = true; StructureMapConfiguration.UseDefaultStructureMapConfigFile = false; StructureMapConfiguration.BuildInstancesOf <ITimer>().TheDefaultIs(Registry.Object(_timer)); IoC.Register(); }
public static void Register() { StructureMapConfiguration.BuildInstancesOf <ICommandQueue>().TheDefaultIsConcreteType <CommandQueue>(); StructureMapConfiguration.BuildInstancesOf <ICommandFactory>().TheDefaultIsConcreteType <CommandFactory>(); StructureMapConfiguration.BuildInstancesOf <IExecutableProcess>().TheDefaultIsConcreteType <ExecutableProcess>(); StructureMapConfiguration.BuildInstancesOf <ILogger>().TheDefaultIsConcreteType <Logger>(); StructureMapConfiguration.BuildInstancesOf <IExecutableProcessQueue>().TheDefaultIsConcreteType <ExecutableProcessQueue>(); StructureMapConfiguration.BuildInstancesOf <IXenStore>().TheDefaultIsConcreteType <XenStore>(); StructureMapConfiguration.BuildInstancesOf <IExecutableProcessCommandPatternSubsitution>().TheDefaultIsConcreteType <ExecutableProcessCommandPatternSubsitution>(); StructureMapConfiguration.BuildInstancesOf <ISetNetworkInterface>().TheDefaultIsConcreteType <SetNetworkInterface>(); StructureMapConfiguration.BuildInstancesOf <ISetPassword>().TheDefaultIsConcreteType <SetPassword>(); StructureMapConfiguration.BuildInstancesOf <IWmiMacNetworkNameGetter>().TheDefaultIsConcreteType <WmiMacNetworkNameGetter>(); StructureMapConfiguration.BuildInstancesOf <IXenNetworkInformation>().TheDefaultIsConcreteType <XenNetworkInformation>(); StructureMapConfiguration.BuildInstancesOf <IAgentUpdateMessageSender>().TheDefaultIsConcreteType <AgentUpdateMessageSender>(); StructureMapConfiguration.BuildInstancesOf <IDiffieHellmanPrerequisitesChecker>().TheDefaultIsConcreteType <DiffieHellmanPrerequisitesChecker>(); StructureMapConfiguration.BuildInstancesOf <IOperatingSystemChecker>().TheDefaultIsConcreteType <OperatingSystemChecker>(); StructureMapConfiguration.BuildInstancesOf <ISetNetworkRoutes>().TheDefaultIsConcreteType <SetNetworkRoutes>(); StructureMapConfiguration.BuildInstancesOf <IRegistryReader>().TheDefaultIsConcreteType <RegistryReader>(); StructureMapConfiguration.BuildInstancesOf <IAdministratorAccountNameFinder>().TheDefaultIsConcreteType <AdministratorAccountNameFinder>(); StructureMapConfiguration.BuildInstancesOf <ISystemInformation>().TheDefaultIsConcreteType <SystemInformation>(); StructureMapConfiguration.BuildInstancesOf <INetshFirewallRuleNameAvailable>().TheDefaultIsConcreteType <NetshFirewallRuleNameAvailable>(); StructureMapConfiguration.BuildInstancesOf <IXenProviderDataInformation>().TheDefaultIsConcreteType <XenProviderDataInformation>(); //ACTIONS StructureMapConfiguration.BuildInstancesOf <IActivateWindowsUsingKms>().TheDefaultIsConcreteType <ActivateWindowsUsingKms>(); StructureMapConfiguration.BuildInstancesOf <IAgentUpdateMessageHandler>().TheDefaultIsConcreteType <AgentUpdateMessageHandler>(); StructureMapConfiguration.BuildInstancesOf <IChecksumValidator>().TheDefaultIsConcreteType <ChecksumValidator>(); StructureMapConfiguration.BuildInstancesOf <IConnectionChecker>().TheDefaultIsConcreteType <ConnectionChecker>(); StructureMapConfiguration.BuildInstancesOf <IDownloader>().TheDefaultIsConcreteType <Downloader>(); StructureMapConfiguration.BuildInstancesOf <IFileCreator>().TheDefaultIsConcreteType <FileCreator>(); StructureMapConfiguration.BuildInstancesOf <IFinalizer>().TheDefaultIsConcreteType <Finalizer>(); StructureMapConfiguration.BuildInstancesOf <IInjectFileMessageHandler>().TheDefaultIsConcreteType <InjectFileMessageHandler>(); StructureMapConfiguration.BuildInstancesOf <IInstaller>().TheDefaultIsConcreteType <Installer>(); StructureMapConfiguration.BuildInstancesOf <ISetNetworkInterface>().TheDefaultIsConcreteType <SetNetworkInterface>(); StructureMapConfiguration.BuildInstancesOf <ISetNetworkRoutes>().TheDefaultIsConcreteType <SetNetworkRoutes>(); StructureMapConfiguration.BuildInstancesOf <ISetProviderData>().TheDefaultIsConcreteType <SetProviderData>(); StructureMapConfiguration.BuildInstancesOf <ISetPassword>().TheDefaultIsConcreteType <SetPassword>(); StructureMapConfiguration.BuildInstancesOf <ISleeper>().TheDefaultIsConcreteType <Sleeper>(); StructureMapConfiguration.BuildInstancesOf <IServiceRestarter>().TheDefaultIsConcreteType <ServiceRestarter>(); StructureMapConfiguration.BuildInstancesOf <IServiceStarter>().TheDefaultIsConcreteType <ServiceStarter>(); StructureMapConfiguration.BuildInstancesOf <IServiceStopper>().TheDefaultIsConcreteType <ServiceStopper>(); StructureMapConfiguration.BuildInstancesOf <IVersionChecker>().TheDefaultIsConcreteType <VersionChecker>(); StructureMapConfiguration.BuildInstancesOf <IUnzipper>().TheDefaultIsConcreteType <Unzipper>(); StructureMapConfiguration.BuildInstancesOf <IFileCopier>().TheDefaultIsConcreteType <FileCopier>(); StructureMapConfiguration.BuildInstancesOf <IIPFinder>().TheDefaultIsConcreteType <IPFinder>(); StructureMapConfiguration.BuildInstancesOf <IDiffieHellman>().TheDefaultIs( Registry.Instance <IDiffieHellman>().UsingConcreteType <DiffieHellmanManaged>() .WithProperty("prime").EqualTo(Constants.DiffieHellmanPrime) .WithProperty("generator").EqualTo(Constants.DiffieHellanGenerator) ); StructureMapConfiguration.BuildInstancesOf <ServiceWork>().TheDefaultIsConcreteType <ServiceWork>(); //COMMANDS StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <Version>().WithName(Utilities.Commands.version.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <Password>().WithName(Utilities.Commands.password.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <Ready>().WithName(Utilities.Commands.ready.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <ResetNetwork>().WithName(Utilities.Commands.resetnetwork.ToString()); //StructureMapConfiguration.AddInstanceOf<IExecutableCommand>().UsingConcreteType<ResetSoftwareFirewall>().WithName(Utilities.Commands.resetsoftwarefirewall.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <AgentUpdate>().WithName(Utilities.Commands.agentupdate.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <XentoolsUpdate>().WithName(Utilities.Commands.xentoolsupdate.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <KmsActivate>().WithName(Utilities.Commands.kmsactivate.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <KeyInit>().WithName(Utilities.Commands.keyinit.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <InjectFile>().WithName(Utilities.Commands.injectfile.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <Features>().WithName(Utilities.Commands.features.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <Unrescue>().WithName(Utilities.Commands.unrescue.ToString()); StructureMapConfiguration.AddInstanceOf <IExecutableCommand>().UsingConcreteType <UpdaterUpdate>().WithName(Utilities.Commands.updaterupdate.ToString()); }