Пример #1
0
        internal Cluster(ClusterOptions clusterOptions)
        {
            if (clusterOptions == null)
            {
                throw new InvalidConfigurationException("ClusterOptions is null.");
            }
            if (string.IsNullOrWhiteSpace(clusterOptions.Password) || string.IsNullOrWhiteSpace(clusterOptions.UserName))
            {
                throw new InvalidConfigurationException("Username and password are required.");
            }

            var configTokenSource = new CancellationTokenSource();

            _context = new ClusterContext(this, configTokenSource, clusterOptions);
            _context.StartConfigListening();

            LazyQueryClient           = new Lazy <IQueryClient>(() => _context.ServiceProvider.GetRequiredService <IQueryClient>());
            LazyAnalyticsClient       = new Lazy <IAnalyticsClient>(() => _context.ServiceProvider.GetRequiredService <IAnalyticsClient>());
            LazySearchClient          = new Lazy <ISearchClient>(() => _context.ServiceProvider.GetRequiredService <ISearchClient>());
            LazyQueryManager          = new Lazy <IQueryIndexManager>(() => _context.ServiceProvider.GetRequiredService <IQueryIndexManager>());
            LazyBucketManager         = new Lazy <IBucketManager>(() => _context.ServiceProvider.GetRequiredService <IBucketManager>());
            LazyUserManager           = new Lazy <IUserManager>(() => _context.ServiceProvider.GetRequiredService <IUserManager>());
            LazySearchManager         = new Lazy <ISearchIndexManager>(() => _context.ServiceProvider.GetRequiredService <ISearchIndexManager>());
            LazyAnalyticsIndexManager = new Lazy <IAnalyticsIndexManager>(() => _context.ServiceProvider.GetRequiredService <IAnalyticsIndexManager>());

            _logger            = _context.ServiceProvider.GetRequiredService <ILogger <Cluster> >();
            _retryOrchestrator = _context.ServiceProvider.GetRequiredService <IRetryOrchestrator>();
            _redactor          = _context.ServiceProvider.GetRequiredService <IRedactor>();

            var bootstrapperFactory = _context.ServiceProvider.GetRequiredService <IBootstrapperFactory>();

            _bootstrapper = bootstrapperFactory.Create(clusterOptions.BootstrapPollInterval);
        }
Пример #2
0
 public Quickstart(
     IBootstrapper bootstrapper,
     Option <RegistryCredentials> credentials,
     string iothubConnectionString,
     string eventhubCompatibleEndpointWithEntityPath,
     UpstreamProtocolType upstreamProtocol,
     Option <string> proxy,
     string imageTag,
     string deviceId,
     string hostname,
     LeaveRunning leaveRunning,
     bool noVerify,
     bool bypassEdgeInstallation,
     string verifyDataFromModule,
     Option <string> deploymentFileName,
     Option <string> twinTestFileName,
     string deviceCaCert,
     string deviceCaPk,
     string deviceCaCerts,
     bool optimizedForPerformance,
     LogLevel runtimeLogLevel,
     bool cleanUpExistingDeviceOnSuccess,
     Option <DPSAttestation> dpsAttestation)
     : base(bootstrapper, credentials, iothubConnectionString, eventhubCompatibleEndpointWithEntityPath, upstreamProtocol, proxy, imageTag, deviceId, hostname, deploymentFileName, twinTestFileName, deviceCaCert, deviceCaPk, deviceCaCerts, optimizedForPerformance, runtimeLogLevel, cleanUpExistingDeviceOnSuccess, dpsAttestation)
 {
     this.leaveRunning           = leaveRunning;
     this.noVerify               = noVerify;
     this.bypassEdgeInstallation = bypassEdgeInstallation;
     this.verifyDataFromModule   = verifyDataFromModule;
     this.dpsProvisionTest       = dpsAttestation.HasValue;
 }
Пример #3
0
        private static void Initialize(IDestination destination, IBootstrapper bootstrapper)
        {
            TinyIoCContainer container = new TinyIoCContainer();
            NoomResolver     resolver  = new NoomResolver(container);

            NoomCache  cache  = new NoomCache();
            NoomTools  tools  = new NoomTools(resolver, cache);
            NoomRouter router = new NoomRouter();

            NoomNavigator navigator = new NoomNavigator(router, destination, tools);

            container.Register <ICache>(cache);
            container.Register <IRouter>(router);
            container.Register <INavigator>(navigator);
            container.Register <IResolver>(resolver);
            container.RegisterMultiple(typeof(IModule), bootstrapper.FindAllModules());

            foreach (Type type in bootstrapper.FindAllViews())
            {
                container.Register(type);
            }

            foreach (IModule module in container.ResolveAll <IModule>())
            {
                module.Register(router);
            }

            navigator.NavigateTo("/");
        }
        public static Task InitializeAsync(IContainer container, IBootstrapper bootstrapper)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            if (Container != null)
            {
                throw new InvalidOperationException(
                    ExceptionMessages.ApplicationServiceLocator_TheContainerIsAlreadyInitialized);
            }

            Container = container;

            if (bootstrapper != null)
            {
                var task = container.InstallAsync(bootstrapper);
                return task.ContinueWith(t =>
                {
                    if (!IsInitializedSuccessfully)
                    {
                        throw new ContainerInitializationException(container);
                    }
                });
            }

            return Task.Factory.StartNew(() => { });
        }
Пример #5
0
		/// <summary>
		/// Creates the <see cref="Contract.IBootstrapper"/> instance.
		/// </summary>
		public void Initialize(ServerContext context, Contract.Type bootstrapperType, string[] args) {
			Logger.Initialize("log4net.config");
			Logger.Info(this, "Initializing " + bootstrapperType.FullName + "...");
			this._bootstrapper = ReflectionHelper.CreateInstance<IBootstrapper>(AppDomain.CurrentDomain, bootstrapperType);
			this._bootstrapper.Initialize(context, args);
			Logger.Info(this, "Initialized " + bootstrapperType.FullName);
		}
Пример #6
0
        private void RunSegment(
            int segmentIndex,
            int segmentCount,
            SegmentConfiguration segmentConfiguration,
            IBootstrapper bootstrapper,
            ISafeRepository safeRepository)
        {
            this.SetupConfigurationProvider(segmentConfiguration, bootstrapper);
            IContext context = this.SetupContext(
                segmentConfiguration,
                segmentIndex,
                segmentCount,
                bootstrapper,
                safeRepository);
            IBridge bridge = this.bridgeFactory.CreateBridge(
                segmentConfiguration.Type,
                context.EntityType.Type,
                bootstrapper);
            IInvocableInitializer invocableInitializer =
                bootstrapper.Get <IInvocableInitializer>();

            bridge.ContextValidator.Validate(context);
            ISegmentRunner segmentRunner = bridge.CreateSegmentRunner();

            bridge.EventDispatcher.SegmentExecuting(new SegmentExecutingArgs());
            invocableInitializer.Initialize(bridge.EventDispatcher);
            segmentRunner.Run();
            bridge.EventDispatcher.SegmentExecuted(new SegmentExecutedArgs());
        }
Пример #7
0
            public IContext CreateContext(
                IBootstrapper bootstrapper,
                SegmentConfiguration segmentConfiguration,
                int segmentIndex,
                int segmentCount,
                IDictionary <string, object> runData)
            {
                IContext context;
                IEnumerable <IExternalSystem>
                externalSystems = this.CreateExternalSystems();
                IExternalSystem sourceSystem =
                    this.GetSourceSystem(segmentConfiguration, externalSystems);
                IEnumerable <IEntityType> entityTypes =
                    this.CreateEntityTypes(sourceSystem, externalSystems);
                IEntityType entityType =
                    this.GetEntityType(segmentConfiguration.EntityType, entityTypes);
                IReadOnlyDictionary <string, string> parameters =
                    this.AssembleParameters(bootstrapper, entityType, sourceSystem);

                context = new Context(
                    segmentConfiguration.Type,
                    segmentIndex,
                    segmentCount,
                    sourceSystem,
                    entityType,
                    externalSystems,
                    entityTypes,
                    parameters,
                    runData);
                return(context);
            }
Пример #8
0
        public void Load(IBootstrapper bootstrapper)
        {
            string RootPath = ".";

            try
            {
                var HostingEnvironment = bootstrapper.Resolve <IHostEnvironment>();
                RootPath = HostingEnvironment.ContentRootPath;
            }
            catch { }
            var Environment  = System.Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development";
            var AssemblyName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel
#if RELEASE
                         .Information()
#else
                         .Debug()
#endif
                         .Enrich.FromLogContext()
                         .WriteTo
                         .File(
                RootPath + "/Logs/log-.txt",
                outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{UserName}] {Message}{NewLine}{Exception}",
                rollingInterval: RollingInterval.Day)
                         .CreateLogger();
            bootstrapper.Register(Log.Logger, ServiceLifetime.Singleton);
        }
Пример #9
0
        public static IBootstrapperAddOptionalParameters <T> AddContracts <T>([NotNull] this IBootstrapper <T> bootstrapper,
                                                                              [NotNull] IEnumerable <Contract <T> > contracts)
            where T : ITimePeriod <T>
        {
            if (bootstrapper == null)
            {
                throw new ArgumentNullException(nameof(bootstrapper));
            }
            if (contracts == null)
            {
                throw new ArgumentNullException(nameof(contracts));
            }

            var contractList = contracts.ToList();

            if (contractList.Count < 1)
            {
                throw new ArgumentException("contracts parameter must contain at least one element.", nameof(contracts));
            }

            IBootstrapperAddOptionalParameters <T> addOptionalParameters = bootstrapper.AddContract(contractList[0]);

            foreach (var contract in contractList.Skip(1))
            {
                addOptionalParameters = addOptionalParameters.AddContract(contract);
            }

            return(addOptionalParameters);
        }
Пример #10
0
 public Quickstart(
     IBootstrapper bootstrapper,
     Option <RegistryCredentials> credentials,
     string iothubConnectionString,
     string eventhubCompatibleEndpointWithEntityPath,
     UpstreamProtocolType upstreamProtocol,
     string imageTag,
     string deviceId,
     string hostname,
     LeaveRunning leaveRunning,
     bool noDeployment,
     bool noVerify,
     string verifyDataFromModule,
     Option <string> deploymentFileName,
     string deviceCaCert,
     string deviceCaPk,
     string deviceCaCerts,
     bool optimizedForPerformance,
     LogLevel runtimeLogLevel,
     bool cleanUpExistingDeviceOnSuccess) :
     base(bootstrapper, credentials, iothubConnectionString, eventhubCompatibleEndpointWithEntityPath, upstreamProtocol, imageTag, deviceId, hostname, deploymentFileName, deviceCaCert, deviceCaPk, deviceCaCerts, optimizedForPerformance, runtimeLogLevel, cleanUpExistingDeviceOnSuccess)
 {
     this.leaveRunning         = leaveRunning;
     this.noDeployment         = noDeployment;
     this.noVerify             = noVerify;
     this.verifyDataFromModule = verifyDataFromModule;
 }
        private static IContainer InitialiseContainerWithBootstrapper(IBootstrapper containerBootstrapper)
        {
            IContainer container = new Container();

            try
            {
                if (!ApplicationServiceLocator.IsInitializedSuccessfully)
                {
                    ApplicationServiceLocator.InitializeAsync(container, containerBootstrapper).Wait();
                }
                else
                {
                    container = ApplicationServiceLocator.Container;
                }
            }
            catch (Exception exception)
            {
                Trace.TraceError(exception.Message);
            }

            DependencyResolver.SetResolver(
                x => container.HasComponent(x) ? container.Resolve(x) : null,
                x => container.HasComponent(x) ? container.ResolveAll(x) : new object[0]);

            return container;
        }
Пример #12
0
 protected Details(
     IBootstrapper bootstrapper,
     Option <RegistryCredentials> credentials,
     string iothubConnectionString,
     string eventhubCompatibleEndpointWithEntityPath,
     string imageTag,
     string deviceId,
     string hostname,
     Option <string> deploymentFileName,
     string deviceCaCert,
     string deviceCaPk,
     string deviceCaCerts,
     bool optimizedForPerformance,
     LogLevel runtimeLogLevel,
     bool cleanUpExistingDeviceOnSuccess
     )
 {
     this.bootstrapper           = bootstrapper;
     this.credentials            = credentials;
     this.iothubConnectionString = iothubConnectionString;
     this.eventhubCompatibleEndpointWithEntityPath = eventhubCompatibleEndpointWithEntityPath;
     this.imageTag                       = imageTag;
     this.deviceId                       = deviceId;
     this.hostname                       = hostname;
     this.DeploymentFileName             = deploymentFileName;
     this.deviceCaCert                   = deviceCaCert;
     this.deviceCaPk                     = deviceCaPk;
     this.deviceCaCerts                  = deviceCaCerts;
     this.optimizedForPerformance        = optimizedForPerformance;
     this.runtimeLogLevel                = runtimeLogLevel;
     this.cleanUpExistingDeviceOnSuccess = cleanUpExistingDeviceOnSuccess;
 }
Пример #13
0
        /// <summary>
        ///     Method responsible for running.
        /// </summary>
        /// <param name="bootstrapper">bootstrapping class object</param>
        public void Run(IBootstrapper bootstrapper)
        {
            log.Debug("going to run bootstrapping class");
            Bootstrapper = bootstrapper;

            ConfigureModuleCatalog();

            ConfigureContainer();
            ConfigureApplicationInformation();
            ShowSplashScreen();
            PublishSystemMessage("Splash screen opened");
            AuthenticateUser();
            InitialiseShell();

            if (Container.IsTypeRegistered <IModuleManager>())
            {
                log.Debug("module manager is registered going to initialize modules");
                InitializeModules();
                Bootstrapper.PostModuleInitialization(Container);
            }

            log.Debug("going to close splash screen");

            CloseSplashScreen();
            PublishSystemMessage("Application Started :-)");
        }
            public async Task SetsLogLevel(string logLevel, int expected)
            {
                // Given
                string[]      args         = new[] { "build", "-l", logLevel };
                IBootstrapper bootstrapper = App.Bootstrapper.Create(args);

                bootstrapper.AddCommand <BuildCommand <EngineCommandSettings> >("build");
                TestLoggerProvider provider = new TestLoggerProvider
                {
                    ThrowLogLevel = LogLevel.None
                };

                bootstrapper.ConfigureServices(services => services.AddSingleton <ILoggerProvider>(provider));
                bootstrapper.AddPipeline(
                    "Foo",
                    new Core.LogMessage(LogLevel.Trace, "A"),
                    new Core.LogMessage(LogLevel.Debug, "B"),
                    new Core.LogMessage(LogLevel.Information, "C"),
                    new Core.LogMessage(LogLevel.Warning, "D"),
                    new Core.LogMessage(LogLevel.Error, "E"),
                    new Core.LogMessage(LogLevel.Critical, "F"));

                // When
                int exitCode = await bootstrapper.RunAsync();

                // Then
                exitCode.ShouldBe((int)ExitCode.Normal);
                provider.Messages.Count(x => x.FormattedMessage.StartsWith("Foo/Process")).ShouldBe(expected);
            }
Пример #15
0
        /// <summary>
        /// Loads the module using the bootstrapper
        /// </summary>
        /// <param name="Bootstrapper">Bootstrapper used to register various objects</param>
        public void Load(IBootstrapper Bootstrapper)
        {
            if (Bootstrapper == null)
                return;
            var TempRand = new System.Random();
            Bootstrapper.Register<TestObject>(() => TempRand.NextClass<TestObject>());
            Bootstrapper.Register<string>(() => @"{ ""BoolReference"" : true,
  ""ByteArrayReference"" : [ 1,
      2,
      3,
      4
    ],
  ""ByteReference"" : 200,
  ""CharReference"" : ""A"",
  ""DecimalReference"" : 1.234,
  ""DoubleReference"" : 1.234,
  ""FloatReference"" : 1.234,
  ""GuidReference"" : ""5bec9017-7c9e-4c52-a8d8-ac511c464370"",
  ""ID"" : 55,
  ""IntReference"" : 123,
  ""LongReference"" : 42134123,
  ""NullStringReference"" : null,
  ""ShortReference"" : 1234,
  ""StringReference"" : ""This is a test string""
}");
        }
Пример #16
0
 public Framework(IAssemblyManager assemblyManager, IModuleManager moduleManager, IServiceManager serviceManager, IBootstrapper bootstrapper)
 {
     this.assemblyManager = assemblyManager;
     this.moduleManager   = moduleManager;
     this.serviceManager  = serviceManager;
     this.bootstrapper    = bootstrapper;
 }
        public static IApplicationHost Build(this IApplicationHostBuilder hostBuilder)
        {
            //string environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");

            //if (String.IsNullOrWhiteSpace(environment))
            //    throw new ArgumentNullException("Environment not found in ASPNETCORE_ENVIRONMENT");

            var builder = new ConfigurationBuilder()
                          .SetBasePath(Path.Combine(Directory.GetCurrentDirectory()))
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          //.AddJsonFile($"appsettings.Development.json", optional: true, reloadOnChange: true)
            ;

            IConfiguration configuration = builder.Build();

            hostBuilder.ApplicationFramework.Services.AddTransient((sp) => configuration);

            IBootstrapper bootstrapper = (IBootstrapper)Activator.CreateInstance(hostBuilder.ApplicationFramework.BootstrapperType, new[] { configuration });

            bootstrapper.ConfigureServices(hostBuilder.ApplicationFramework.Services);

            hostBuilder.ApplicationFramework.BuildServiceProvider();

            ILoggingBuilder loggingBuilder = hostBuilder.ApplicationFramework.ServiceProvider.GetService <ILoggingBuilder>();

            bootstrapper.Configure(hostBuilder, loggingBuilder);

            return(new DefaultApplicationHost(hostBuilder.ApplicationFramework));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginManager"/> class.
 /// </summary>
 /// <param name="Repositories">The repositories.</param>
 /// <param name="Bootstrapper">The bootstrapper.</param>
 public PluginManager(IEnumerable <string> Repositories, IBootstrapper Bootstrapper)
 {
     Contract.Requires <ArgumentNullException>(Repositories != null, "Repositories");
     this.Bootstrapper   = Bootstrapper;
     PackageRepositories = Repositories.ForEach(x => PackageRepositoryFactory.Default.CreateRepository(x));
     Initialize();
 }
Пример #19
0
 /// <summary>
 /// Creates a new instance that implements the <see cref="IBridge" /> interface.
 /// </summary>
 /// <param name="segmentType">The current run segment type.</param>
 /// <param name="entityType">The current entity-representing type.</param>
 /// <param name="bootstrapper">
 /// The <see cref="IBootstrapper" /> instance to use.
 /// </param>
 /// <returns>
 /// A new instance that implements the <see cref="IBridge" /> interface.
 /// </returns>
 public IBridge CreateBridge(
     SegmentType segmentType,
     Type entityType,
     IBootstrapper bootstrapper)
 {
     return(new Bridge(segmentType, entityType, bootstrapper));
 }
Пример #20
0
 /// <summary>
 /// Loads the module using the bootstrapper
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper used to register various objects</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     if (Bootstrapper == null)
         return;
     Bootstrapper.RegisterAll<ITimedTask>();
     Bootstrapper.RegisterAll<IDataFormatter>();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginManager"/> class.
 /// </summary>
 /// <param name="Repositories">The repositories.</param>
 /// <param name="Bootstrapper">The bootstrapper.</param>
 public PluginManager(IEnumerable<string> Repositories, IBootstrapper Bootstrapper)
 {
     Contract.Requires<ArgumentNullException>(Repositories != null, "Repositories");
     this.Bootstrapper = Bootstrapper;
     PackageRepositories = Repositories.ForEach(x => PackageRepositoryFactory.Default.CreateRepository(x));
     Initialize();
 }
Пример #22
0
        protected FormsApp(IBootstrapper bootstrapper)
        {
            _bootstrapper = bootstrapper;

            // Init UI thread helper
            Execute.Initialize(new FormsMainThreadExecutor());
        }
Пример #23
0
 public CollectorController(
     IMainCollector mainCollector,
     IBootstrapper bootstrapper)
 {
     _mainCollector = mainCollector;
     _bootstrapper  = bootstrapper;
 }
Пример #24
0
 /// <summary>
 /// Loads the module using the bootstrapper
 /// </summary>
 /// <param name="bootstrapper">The bootstrapper.</param>
 public void Load(IBootstrapper bootstrapper)
 {
     bootstrapper?.RegisterAll <ITokenizerLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <ITokenizer>(ServiceLifetime.Singleton)
     .RegisterAll <IStemmerLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <IStemmer>(ServiceLifetime.Singleton)
     .RegisterAll <IDetector>(ServiceLifetime.Singleton)
     .RegisterAll <ISentenceDetector>(ServiceLifetime.Singleton)
     .RegisterAll <IPOSTagger>(ServiceLifetime.Singleton)
     .RegisterAll <IPOSTaggerLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <IEnglishTokenFinder>(ServiceLifetime.Singleton)
     .Register <FrequencyAnalyzer>(ServiceLifetime.Singleton)
     .RegisterAll <ITextSummarizer>(ServiceLifetime.Singleton)
     .RegisterAll <ITextSummarizerLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <IInflector>(ServiceLifetime.Singleton)
     .RegisterAll <IInflectorLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <ISynonymFinder>(ServiceLifetime.Singleton)
     .RegisterAll <ISynonymFinderLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <IFeatureExtractor>(ServiceLifetime.Singleton)
     .RegisterAll <IFeatureExtractorLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <IStopWordsManager>(ServiceLifetime.Singleton)
     .RegisterAll <IStopWordsLanguage>(ServiceLifetime.Singleton)
     .RegisterAll <INormalizer>(ServiceLifetime.Singleton)
     .RegisterAll <ITextNormalizer>(ServiceLifetime.Singleton)
     .RegisterAll <INormalizerManager>(ServiceLifetime.Singleton)
     .Register <Pipeline>(ServiceLifetime.Transient)
     .RegisterAll <IIndexer>(ServiceLifetime.Singleton)
     .RegisterAll <IIndexCreator>(ServiceLifetime.Singleton)
     .Register <Index>(ServiceLifetime.Transient)
     .RegisterAll <IFinder>(ServiceLifetime.Singleton)
     .RegisterAll <IEntityFinder>(ServiceLifetime.Singleton);
 }
Пример #25
0
 /// <summary>
 /// Loads the module using the bootstrapper
 /// </summary>
 /// <param name="bootstrapper">The bootstrapper.</param>
 public void Load(IBootstrapper bootstrapper)
 {
     bootstrapper?.RegisterAll <ICommandBuilder>()
     .RegisterAll <ISourceBuilder>()
     .RegisterAll <ISchemaGenerator>(ServiceLifetime.Singleton)
     .Register <DataModeler>(ServiceLifetime.Singleton);
 }
Пример #26
0
 protected Details(
     IBootstrapper bootstrapper,
     Option <RegistryCredentials> credentials,
     string iothubConnectionString,
     string eventhubCompatibleEndpointWithEntityPath,
     string imageTag,
     string deviceId,
     string hostname,
     Option <string> deploymentFileName,
     string deviceCaCert,
     string deviceCaPk,
     string deviceCaCerts
     )
 {
     this.bootstrapper           = bootstrapper;
     this.credentials            = credentials;
     this.iothubConnectionString = iothubConnectionString;
     this.eventhubCompatibleEndpointWithEntityPath = eventhubCompatibleEndpointWithEntityPath;
     this.imageTag           = imageTag;
     this.deviceId           = deviceId;
     this.hostname           = hostname;
     this.DeploymentFileName = deploymentFileName;
     this.deviceCaCert       = deviceCaCert;
     this.deviceCaPk         = deviceCaPk;
     this.deviceCaCerts      = deviceCaCerts;
 }
Пример #27
0
        protected Details(
            IBootstrapper bootstrapper,
            Option <RegistryCredentials> credentials,
            string iothubConnectionString,
            string eventhubCompatibleEndpointWithEntityPath,
            UpstreamProtocolType upstreamProtocol,
            Option <string> proxy,
            string imageTag,
            string deviceId,
            string hostname,
            Option <string> deploymentFileName,
            Option <string> twinTestFileName,
            string deviceCaCert,
            string deviceCaPk,
            string deviceCaCerts,
            bool optimizedForPerformance,
            bool initializeWithAgentArtifact,
            LogLevel runtimeLogLevel,
            bool cleanUpExistingDeviceOnSuccess,
            Option <DPSAttestation> dpsAttestation)
        {
            this.bootstrapper           = bootstrapper;
            this.credentials            = credentials;
            this.iothubConnectionString = iothubConnectionString;
            this.dpsAttestation         = dpsAttestation;
            this.eventhubCompatibleEndpointWithEntityPath = eventhubCompatibleEndpointWithEntityPath;

            switch (upstreamProtocol)
            {
            case UpstreamProtocolType.Amqp:
            case UpstreamProtocolType.Mqtt:
                this.serviceClientTransportType  = ServiceClientTransportType.Amqp;
                this.eventHubClientTransportType = EventHubClientTransportType.Amqp;
                break;

            case UpstreamProtocolType.AmqpWs:
            case UpstreamProtocolType.MqttWs:
                this.serviceClientTransportType  = ServiceClientTransportType.Amqp_WebSocket_Only;
                this.eventHubClientTransportType = EventHubClientTransportType.AmqpWebSockets;
                break;

            default:
                throw new Exception($"Unexpected upstream protocol type {upstreamProtocol}");
            }

            this.imageTag                       = imageTag;
            this.deviceId                       = deviceId;
            this.hostname                       = hostname;
            this.DeploymentFileName             = deploymentFileName;
            this.TwinTestFileName               = twinTestFileName;
            this.deviceCaCert                   = deviceCaCert;
            this.deviceCaPk                     = deviceCaPk;
            this.deviceCaCerts                  = deviceCaCerts;
            this.optimizedForPerformance        = optimizedForPerformance;
            this.initializeWithAgentArtifact    = initializeWithAgentArtifact;
            this.runtimeLogLevel                = runtimeLogLevel;
            this.cleanUpExistingDeviceOnSuccess = cleanUpExistingDeviceOnSuccess;
            this.proxy = proxy.Map(p => new WebProxy(p) as IWebProxy);
        }
Пример #28
0
        protected OrmTestBase()
        {
            SqlLocalDbHelper.CreateDatabaseIfNotExists();
            SqlDbSeeder.SeedCustomers();

            _bootstrapper = new Bootstrapper();
            _bootstrapper.UseSqlServer(_databaseConfigurator).WithOrm();
        }
Пример #29
0
 /// <summary>
 /// Creates the <see cref="Contract.IBootstrapper"/> instance.
 /// </summary>
 public void Initialize(ServerContext context, Contract.Type bootstrapperType, string[] args)
 {
     Logger.Initialize("log4net.config");
     Logger.Info(this, "Initializing " + bootstrapperType.FullName + "...");
     this._bootstrapper = ReflectionHelper.CreateInstance <IBootstrapper>(AppDomain.CurrentDomain, bootstrapperType);
     this._bootstrapper.Initialize(context, args);
     Logger.Info(this, "Initialized " + bootstrapperType.FullName);
 }
Пример #30
0
 /// <summary>
 /// Loads the module using the bootstrapper
 /// </summary>
 /// <param name="bootstrapper">The bootstrapper.</param>
 public void Load(IBootstrapper bootstrapper)
 {
     if (bootstrapper is null)
     {
         return;
     }
     bootstrapper.Register <SQLHelper>(ServiceLifetime.Transient);
 }
 public PreviewCommand(
     IEngineSettingsDictionary engineSettings,
     IConfigurationRoot configurationRoot,
     IServiceCollection serviceCollection,
     IBootstrapper bootstrapper)
     : base(engineSettings, configurationRoot, serviceCollection, bootstrapper)
 {
 }
Пример #32
0
 /// <summary>
 /// Constructor
 /// </summary>
 public DependencyResolver(IBootstrapper Container)
 {
     if (Container == null)
     {
         throw new ArgumentNullException(nameof(Container));
     }
     this.Container = Container;
 }
Пример #33
0
 /// <summary>
 /// Disposes of the object
 /// </summary>
 /// <param name="Managed">
 /// Determines if all objects should be disposed or just managed objects
 /// </param>
 protected virtual void Dispose(bool Managed)
 {
     if (InternalBootstrapper != null)
     {
         InternalBootstrapper.Dispose();
         InternalBootstrapper = null;
     }
 }
        protected internal BootstrapperBehavior(IBootstrapper bootstrapper)
        {
            if(bootstrapper == null)
                throw new ArgumentNullException("bootstrapper");

            this._bootstrapper = bootstrapper;
            this._bootstrapper.Initialize();
        }
        static BootstrapperLocator()
        {
            var selectedBootstrapperType = AppDomainScanner
                                           .Types <IBootstrapper>()
                                           .FirstOrDefault(type => type != typeof(DefaultBootstrapper)) ?? typeof(DefaultBootstrapper);

            Bootstrapper = Activator.CreateInstance(selectedBootstrapperType) as IBootstrapper;
        }
Пример #36
0
 private void RegisterModules(IBootstrapper bootstrapper)
 {
     bootstrapper.Register(new MasterDataModule());
     bootstrapper.Register(new ConsumableUsageModule());
     bootstrapper.Register(new EmployeeCostModule());
     bootstrapper.Register(new EggProductionModule());
     bootstrapper.Register(new HenDepreciationModule());
     bootstrapper.Register(new ReportsModule());
 }
Пример #37
0
 public ValidateCommand(
     IConfigurationManager configurationManager,
     IConsoleFormatter consoleFormatter,
     IBootstrapper bootstrapper)
 {
     this.configurationManager = configurationManager;
     this.consoleFormatter     = consoleFormatter;
     this.bootstrapper         = bootstrapper;
 }
Пример #38
0
 private void RegisterModules(IBootstrapper bootstrapper)
 {
     bootstrapper.Register(new MasterDataModule());
     bootstrapper.Register(new ConsumableUsageModule());
     bootstrapper.Register(new EmployeeCostModule());
     bootstrapper.Register(new EggProductionModule());
     bootstrapper.Register(new HenDepreciationModule());
     bootstrapper.Register(new ReportsModule());
 }
 /// <summary>
 /// Loads the module
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper to register with</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     if (Bootstrapper == null
         || ConfigurationManager.AppSettings == null
         || !ConfigurationManager.AppSettings.AllKeys.Contains("Ironman:PluginSource")
         || string.IsNullOrEmpty(ConfigurationManager.AppSettings["Ironman:PluginSource"]))
         return;
     Bootstrapper.Register(new PluginManager(ConfigurationManager.AppSettings["Ironman:PluginSource"].Split(','), Bootstrapper));
 }
Пример #40
0
        public MainWindow(IBootstrapper bootstrapper, IMessageBroker messageBroker, IClientContext clientContext)
        {
            InitializeComponent();

            this.bootstrapper = bootstrapper;
            this.messageBroker = messageBroker;
            this.clientContext = clientContext;

            this.Loaded += MainWindow_Loaded;
            this.PreviewMouseMove += MainWindow_PreviewMouseMove;
        }
Пример #41
0
        public void LogBootstrapperRun(IBootstrapper bootstrapper, IEnumerable<IActivator> activators)
        {
            var provenance = "Loaded by Bootstrapper:  " + bootstrapper;
            var bootstrapperLog = LogFor(bootstrapper);

            activators.Each(a =>
            {
                LogObject(a, provenance);
                bootstrapperLog.AddChild(a);
            });
        }
 /// <summary>
 /// Loads the module
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper to register with</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     Bootstrapper.RegisterAll<IAsymmetric>();
     Bootstrapper.RegisterAll<IHasher>();
     Bootstrapper.RegisterAll<IShift>();
     Bootstrapper.RegisterAll<ISymmetric>();
     Bootstrapper.Register(new Manager(Bootstrapper.ResolveAll<IAsymmetric>(),
         Bootstrapper.ResolveAll<IHasher>(),
         Bootstrapper.ResolveAll<IShift>(),
         Bootstrapper.ResolveAll<ISymmetric>()));
 }
Пример #43
0
 /// <summary>
 /// Loads the module using the bootstrapper
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper used to register various objects</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     if (Bootstrapper == null)
         return;
     Bootstrapper.RegisterAll<IParser>();
     Bootstrapper.RegisterAll<IOptimizer>();
     Bootstrapper.RegisterAll<IGenerator>();
     Bootstrapper.Register(new Compiler(Bootstrapper.ResolveAll<IParser>(),
                                         Bootstrapper.ResolveAll<IOptimizer>(),
                                         Bootstrapper.ResolveAll<IGenerator>(),
                                         Bootstrapper.ResolveAll<IValidator>()));
 }
Пример #44
0
		private void Application_OnStartup(object sender, StartupEventArgs e)
		{
			Constants.SetApplicationName("Appcast");

			AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
			Bootstrapper = new Bootstrapper();
			Bootstrapper.ShellClosing += OnShellClosing;
			Bootstrapper.ShellLoaded += OnShellLoaded;
			// the MainWindow will be created and, once on screen, will invoke the ServicesMayInitializeEvent
			if (!Bootstrapper.Run())
			{
				Current.Shutdown();
			}
		}
Пример #45
0
 /// <summary>
 /// Called at the start of the application
 /// </summary>
 public static void PreStart()
 {
     new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).LoadAssemblies(false).ForEach(x => x);
     Bootstrapper = AppDomain.CurrentDomain.GetAssemblies().Objects<IBootstrapper>().FirstOrDefault();
     Bootstrapper.Register<IBootstrapper>(Bootstrapper);
     AppDomain.CurrentDomain.GetAssemblies().Objects<IModule>().ForEach(x => x.Load(Bootstrapper));
     LogBase Logger = Bootstrapper.Resolve<LogBase>(new NullLogger());
     Logger.LogMessage("Batman starting", MessageType.Info);
     Logger.LogMessage("Current bootstrapper: {0}", MessageType.Debug, Bootstrapper.Name);
     Logger.LogMessage("Current file systems detected: {0}", MessageType.Debug, Bootstrapper.Resolve<FileManager>().ToString());
     Logger.LogMessage("Communication systems detected: {0}", MessageType.Debug, Bootstrapper.Resolve<CommunicationManager>().ToString());
     Logger.LogMessage("Profiler detected: {0}", MessageType.Debug, Bootstrapper.Resolve<IProfiler>().Name);
     Logger.LogMessage("Starting pre start tasks", MessageType.Info);
     Bootstrapper.Resolve<TaskManager>().Run(RunTime.PreStart);
 }
 /// <summary>
 /// Pre start task
 /// </summary>
 public static void PreStart()
 {
     Bootstrapper = Utilities.IoC.Manager.Bootstrapper;
     ILog Log = Utilities.IO.Log.Get();
     Log.LogMessage("Ironman starting", MessageType.Info);
     Log.LogMessage("{0}", MessageType.Info, Bootstrapper.ToString());
     Log.LogMessage("Starting pre start tasks", MessageType.Info);
     Bootstrapper.Resolve<TaskManager>().Run(RunTime.PreStart);
     DependencyResolver.SetResolver(new Bootstrapper.DependencyResolver(Bootstrapper));
     if (ViewEngines.Engines != null)
     {
         ViewEngines.Engines.Clear();
         ViewEngines.Engines.Add(new RazorViewEngine());
     }
 }
Пример #47
0
 /// <summary>
 /// End task
 /// </summary>
 public static void End()
 {
     if (Bootstrapper != null)
     {
         var Logger = Utilities.IO.Log.Get();
         if (Logger != null)
         {
             Logger.LogMessage("Application ending", MessageType.Info);
             Logger.LogMessage("Starting end tasks", MessageType.Info);
         }
         Bootstrapper.Resolve<TaskManager>().Run(RunTime.End);
         Bootstrapper.Dispose();
         Bootstrapper = null;
     }
 }
Пример #48
0
        public StyxHost(Uri location, IHostConfiguration hostConfiguration = null, ILogger logger = null, IBootstrapper bootstrapper = null)
        {
            if (location == null)
                throw new ArgumentNullException("location");

            hostConfiguration = hostConfiguration ?? new HostConfiguration();
            hostConfiguration.Port = location.Port;
            hostConfiguration.Scheme = location.Scheme;
            logger = logger ?? new DebuggerLogger();
            bootstrapper = bootstrapper ?? new TinyIoCBootstrapper(hostConfiguration, logger);
            _hostConfiguration = bootstrapper.HostConfiguration;
            _logger = bootstrapper.Logger;
            _engine = bootstrapper.Engine;
            _routeRegister = bootstrapper.RouteRegister;
            _listenerSocket = bootstrapper.SocketListener;
        }
 /// <summary>
 /// Loads the various managers
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     if (Bootstrapper == null)
         return;
     Bootstrapper.ResolveAll<IFilter>();
     Bootstrapper.ResolveAll<IContentFilter>();
     Bootstrapper.ResolveAll<ITranslator>();
     Bootstrapper.Register<AssetManager>(new AssetManager(Bootstrapper.ResolveAll<IFilter>(), Bootstrapper.ResolveAll<IContentFilter>(), Bootstrapper.ResolveAll<ITranslator>()));
     Bootstrapper.RegisterAll<VPFactoryBase>();
     Bootstrapper.RegisterAll<ITask>();
     Bootstrapper.Register<TaskManager>(new TaskManager(Bootstrapper.ResolveAll<ITask>()));
     Bootstrapper.RegisterAll<IAPIMapping>();
     Bootstrapper.RegisterAll<IService>();
     Bootstrapper.RegisterAll<IWorkflowModule>();
     Bootstrapper.Register<Manager>(new Manager(Bootstrapper.ResolveAll<IAPIMapping>(), Bootstrapper.ResolveAll<IService>(), Bootstrapper.ResolveAll<IWorkflowModule>(), Bootstrapper.Resolve<Utilities.Workflow.Manager.Manager>()));
 }
        /// <summary>
        /// Loads the module
        /// </summary>
        /// <param name="Bootstrapper">Bootstrapper to register with</param>
        public void Load(IBootstrapper Bootstrapper)
        {
            Bootstrapper.RegisterAll<IMapping>();
            Bootstrapper.Register(new Mapper.Manager(Bootstrapper.ResolveAll<IMapping>()));

            Bootstrapper.RegisterAll<Utilities.ORM.Manager.QueryProvider.Interfaces.IQueryProvider>();
            Bootstrapper.Register(new QueryProvider.Manager(Bootstrapper.ResolveAll<Utilities.ORM.Manager.QueryProvider.Interfaces.IQueryProvider>()));

            Bootstrapper.RegisterAll<IDatabase>();
            Bootstrapper.Register(new SourceProvider.Manager(Bootstrapper.ResolveAll<IDatabase>()));

            Bootstrapper.RegisterAll<ISchemaGenerator>();
            Bootstrapper.Register(new Schema.Manager(Bootstrapper.ResolveAll<ISchemaGenerator>()));

            Bootstrapper.Register(new ORMManager(Bootstrapper.Resolve<Mapper.Manager>(),
                Bootstrapper.Resolve<QueryProvider.Manager>(),
                Bootstrapper.Resolve<Schema.Manager>(),
                Bootstrapper.Resolve<SourceProvider.Manager>(),
                Bootstrapper.ResolveAll<IDatabase>()));

            ORMAspect.Mapper = Bootstrapper.Resolve<Mapper.Manager>();
            Bootstrapper.Resolve<Utilities.DataTypes.AOP.Manager>().Setup(ORMAspect.Mapper.Select(x => x.ObjectType).ToArray());
        }
        private static IContainer InitialiseContainerWithBootstrapper(IBootstrapper containerBootstrapper)
        {
            IContainer container = new Container();

            try
            {
                if (!ApplicationServiceLocator.IsInitializedSuccessfully)
                {
                    ApplicationServiceLocator.InitializeAsync(container, containerBootstrapper).Wait();
                }
                else
                {
                    container = ApplicationServiceLocator.Container;
                }
            }
            catch (Exception exception)
            {
                Trace.TraceError(exception.Message);
            }

            GlobalConfiguration.Configuration.DependencyResolver = new ContainerDependencyResolver(container);

            return container;
        }
Пример #52
0
 protected NinjectMVC3(IBootstrapper bootstrapper)
 {
     this.bootstrapper = bootstrapper;
 }
 /// <summary>
 /// Loads the module using the bootstrapper
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper used to register various objects</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     Contract.Requires<ArgumentNullException>(Bootstrapper != null);
 }
 /// <summary>
 /// Loads the module
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper to register with</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     Bootstrapper.RegisterAll<IAspect>();
     Bootstrapper.RegisterAll<IAOPModule>();
     Bootstrapper.Register(new Manager(Bootstrapper.Resolve<Compiler>(), Bootstrapper.ResolveAll<IAspect>(), Bootstrapper.ResolveAll<IAOPModule>()));
 }
Пример #55
0
 public void Bootstrapper(IBootstrapper bootstrapper)
 {
     addConfigurableAction(g => g.AddBootstrapper(bootstrapper));
 }
 /// <summary>
 /// Loads the module
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper to register with</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     Bootstrapper.RegisterAll<IDataMapper>();
     Bootstrapper.RegisterAll<IMapperModule>();
     Bootstrapper.Register(new Manager(Bootstrapper.ResolveAll<IDataMapper>(), Bootstrapper.ResolveAll<IMapperModule>()));
 }
 /// <summary>
 /// Loads the module
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper to register with</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     Bootstrapper.RegisterAll<IFormatter>();
     Bootstrapper.RegisterAll<IMessagingSystem>();
     Bootstrapper.Register(new Manager(Bootstrapper.ResolveAll<IFormatter>(), Bootstrapper.ResolveAll<IMessagingSystem>()));
 }
 public void AddBootstrapper(IBootstrapper bootstrapper)
 {
     _bootstrappers.Add(bootstrapper);
     _diagnostics.LogObject(bootstrapper, currentProvenance);
 }
 /// <summary>
 /// Loads the module
 /// </summary>
 /// <param name="Bootstrapper">Bootstrapper to register with</param>
 public void Load(IBootstrapper Bootstrapper)
 {
     Bootstrapper.RegisterAll<ICache>();
     Bootstrapper.Register(new Manager(Bootstrapper.ResolveAll<ICache>()));
 }
Пример #60
0
 /// <summary>
 /// Bootstraps the given bootstrapper using DependencyContainer.Current
 /// </summary>
 /// <param name="bootstrapper"></param>
 /// <returns></returns>
 public Bootstrapper Bootstrap(IBootstrapper bootstrapper)
 {
     bootstrapper.Bootstrap(DependencyContainer.Current);
     return this;
 }