Exemple #1
0
 public InsertAction(IMetadataStore metadataStore, TEntity entity,
                     IHydrator hydrator, IDbConnection connection,
                     IDialect dialect, IEnvironmentSettings environment) :
     base(metadataStore, entity, connection, dialect, environment)
 {
     this._hydrator = hydrator;
 }
        private static IUnityContainer ConfigureTracer(
            this IUnityContainer container,
            IEnvironmentSettings environmentSettings,
            IConnectionStringSettings connectionStringSettings)
        {
            var tracerContextEntryProviders =
                    new ITracerContextEntryProvider[]
                    {
                        new TracerContextConstEntryProvider(TracerContextKeys.Required.Environment, environmentSettings.EnvironmentName),
                        new TracerContextConstEntryProvider(TracerContextKeys.Required.EntryPoint, environmentSettings.EntryPointName),
                        new TracerContextConstEntryProvider(TracerContextKeys.Required.EntryPointHost, NetworkInfo.ComputerFQDN),
                        new TracerContextConstEntryProvider(TracerContextKeys.Required.EntryPointInstanceId, Guid.NewGuid().ToString()),
                        new TracerContextSelfHostedEntryProvider(TracerContextKeys.Required.UserAccount) // TODO {all, 08.05.2015}: Если появится авторизация, надо будет доработать логирование
                    };

            var tracerContextManager = new TracerContextManager(tracerContextEntryProviders);
            var tracer = Log4NetTracerBuilder.Use
                                             .ApplicationXmlConfig
                                             .EventLog
                                             .Logstash(new Uri(connectionStringSettings.GetConnectionString(LoggingConnectionStringIdentity.Instance)))
                                             .Build;

            return container.RegisterInstance(tracer)
                            .RegisterInstance(tracerContextManager)
                            .RegisterType<IExceptionLogger, ExceptionTracer>("log4net", Lifetime.Singleton);
        }
 public CacheDistributed(DefaultCacheOptions options, IDistributedCache l2Cache, IEnvironmentSettings env, ISignalR signalR)
 {
     Options = options.Item;
     L2Cache = l2Cache;
     Env     = env;
     SignalR = signalR;
 }
Exemple #4
0
 public StoredProcedureToListAction(IMetadataStore metadataStore,
                                    IHydrator hydrator, IDbConnection connection,
                                    IDialect dialect, IEnvironmentSettings environment)
     : base(metadataStore, default(TEntity), connection, dialect, environment)
 {
     this._hydrator = hydrator;
 }
        public static IUnityContainer ConfigureTracer(
            this IUnityContainer container,
            IEnvironmentSettings environmentSettings,
            IConnectionStringSettings connectionStringSettings)
        {
            var tracerContextEntryProviders =
                new ITracerContextEntryProvider[]
            {
                new TracerContextConstEntryProvider(TracerContextKeys.Required.Environment, environmentSettings.EnvironmentName),
                new TracerContextConstEntryProvider(TracerContextKeys.Required.EntryPoint, environmentSettings.EntryPointName),
                new TracerContextConstEntryProvider(TracerContextKeys.Required.EntryPointHost, NetworkInfo.ComputerFQDN),
                new TracerContextConstEntryProvider(TracerContextKeys.Required.EntryPointInstanceId, Guid.NewGuid().ToString()),
                new TracerContextSelfHostedEntryProvider(TracerContextKeys.Required.UserAccount)         // TODO {all, 08.05.2015}: Если появится авторизация, надо будет доработать логирование
            };

            var tracerContextManager = new TracerContextManager(tracerContextEntryProviders);
            var tracer = Log4NetTracerBuilder.Use
                         .DefaultXmlConfig
                         .EventLog
                         .Logstash(new Uri(connectionStringSettings.GetConnectionString(LoggingConnectionStringIdentity.Instance)))
                         .Build;

            return(container.RegisterInstance(tracer)
                   .RegisterInstance(tracerContextManager));
        }
 public DefaultCacheOptions(IEnvironmentSettings env)
 {
     Item ??= new CacheOptions
     {
         UseDistributedCache = SettingsEnvironmental.Get(env, "Cache:Distributed", "true").ToBool(true),
         UseLocalCache       = SettingsEnvironmental.Get(env, "Cache:Local", "true").ToBool(true)
     };
 }
Exemple #7
0
        internal static int GetAnalysisTimeoutInMilliseconds(IEnvironmentSettings environmentSettings = null)
        {
            environmentSettings = environmentSettings ?? new EnvironmentSettings();
            var userSuppliedTimeout           = environmentSettings.AnalysisTimeoutInMs();
            var analysisTimeoutInMilliseconds = userSuppliedTimeout > 0 ? userSuppliedTimeout : DefaultAnalysisTimeoutMs;

            return(analysisTimeoutInMilliseconds);
        }
Exemple #8
0
 public HealthCheck(HealthReport r, IEnvironmentSettings env)
 {
     Status  = r.Status.ToString();
     Version = SafeTry.IgnoreException(() =>
                                       SettingsEnvironmental.Get(env, "version") ?? Assembly.GetEntryAssembly()?.GetName().Version.ToString(),
                                       "Unknown"
                                       );
     Errors = r.Entries.Select(e => new { key = e.Key, value = e.Value.Status.ToString() });
 }
 public ProgramServiceConfigDependent(
     IConsoleSettings consoleSettings,
     IEnvironmentSettings envSettings,
     IApplicationConfiguration applicationConfiguration)
 {
     _consoleSettings          = consoleSettings;
     _envSettings              = envSettings;
     _applicationConfiguration = applicationConfiguration;
 }
 public UserSignUpSteps(
     IGitHubHomepage gitHubHomePage,
     IGitHubSignUpPage gitHubSignUpPage,
     IEnvironmentSettings settings)
 {
     this.gitHubHomePage   = gitHubHomePage;
     this.gitHubSignUpPage = gitHubSignUpPage;
     this.settings         = settings;
 }
Exemple #11
0
 public Session(IDbConnection connection, IMetadataStore metadataStore,
                IDialect dialect, IEnvironmentSettings environment)
     : this()
 {
     this._connection    = connection;
     this._metadataStore = metadataStore;
     _dialect            = dialect;
     _environment        = environment;
     this.InitializeSession(this._metadataStore, this._connection);
 }
Exemple #12
0
 protected DatabaseAction(IMetadataStore metadataStore,
                          IHydrator hydrator,
                          IDbConnection connection,
                          IEnvironmentSettings environment)
 {
     this.MetadataStore = metadataStore;
     this.Hydrator      = hydrator;
     Connection         = connection;
     Environment        = environment;
 }
Exemple #13
0
 public QueryByStoredProcedure(IMetadataStore metadatastore,
                               IHydrator hydrator, IDbConnection connection,
                               IDialect dialect, IEnvironmentSettings environment)
 {
     this._metadatastore = metadatastore;
     this.hydrator       = hydrator;
     this.connection     = connection;
     _dialect            = dialect;
     _environment        = environment;
 }
 public static HealthCheckOptions Options(IEnvironmentSettings env) =>
 new HealthCheckOptions
 {
     ResponseWriter = async(c, r) =>
     {
         c.Response.ContentType = MediaTypeNames.Application.Json;
         var result = new HealthCheck(r, env).SerializeJson();
         await c.Response.WriteAsync(result);
     }
 };
Exemple #15
0
 public MessageFileProcessorManager(
     ILogger <MessageFileProcessorManager> logger,
     IEnvironmentSettings environmentSettings,
     IJobsRepository jobsRepository,
     IMessageFileProcessorComponent messageFileProcessorComponent)
 {
     _logger = logger;
     _environmentSettings           = environmentSettings;
     _jobsRepository                = jobsRepository;
     _messageFileProcessorComponent = messageFileProcessorComponent;
 }
        public KafkaSettingsFactory(
            IReadOnlyDictionary <IMessageFlow, string> messageFlows2CoonectionStringsMap,
            IEnvironmentSettings environmentSettings,
            Offset offset)
        {
            _offset = offset;

            const string KafkaTargetTopicToken = "targetTopic";
            const string KafkaPollTimeoutToken = "pollTimeout";
            const string KafkaInfoTimeoutToken = "infoTimeout";

            _flows2ConsumerSettingsMap = new Dictionary <IMessageFlow, KafkaConfigSettings>();
            foreach (var entry in messageFlows2CoonectionStringsMap)
            {
                var messageFlow      = entry.Key;
                var connectionString = entry.Value;

                var kafkaConfig = new KafkaConfigSettings();

                var configuredKafkaSettings = JsonConvert.DeserializeObject <Dictionary <string, object> >(connectionString);
                if (!configuredKafkaSettings.TryGetValue(KafkaTargetTopicToken, out var rawtargetTopic))
                {
                    throw new InvalidOperationException($"Kafka config is invalid for message flow {messageFlow.GetType().Name}. Required parameter \"{KafkaTargetTopicToken}\" was not found. ConnectionString: {connectionString}");
                }

                kafkaConfig.Topic       = (string)rawtargetTopic;
                kafkaConfig.PoolTimeout = !configuredKafkaSettings.TryGetValue(KafkaPollTimeoutToken, out object rawPollTimeout)
                                              ? TimeSpan.FromSeconds(5)
                                              : TimeSpan.Parse((string)rawPollTimeout);
                kafkaConfig.InfoTimeout = !configuredKafkaSettings.TryGetValue(KafkaInfoTimeoutToken, out object rawInfoTimeout)
                                              ? TimeSpan.FromSeconds(5)
                                              : TimeSpan.Parse((string)rawInfoTimeout);
                var explicitlyProcessedTokens = new[] { KafkaTargetTopicToken, KafkaPollTimeoutToken, KafkaInfoTimeoutToken };
                var kafkaClientSpecific       = configuredKafkaSettings.Where(e => !explicitlyProcessedTokens.Contains(e.Key))
                                                .ToDictionary(x => x.Key, x => x.Value);

                kafkaClientSpecific["group.id"] = messageFlow.Id.ToString() + '-' + environmentSettings.EnvironmentName;

                foreach (var defaultSetting in _defaultKafkaClientSpecificSettings)
                {
                    if (kafkaClientSpecific.ContainsKey(defaultSetting.Key))
                    {
                        continue;
                    }

                    kafkaClientSpecific.Add(defaultSetting.Key, defaultSetting.Value);
                }

                kafkaConfig.KafkaClientSpecific = kafkaClientSpecific;

                _flows2ConsumerSettingsMap.Add(messageFlow, kafkaConfig);
            }
        }
 private static ITracer CreateTracer(IEnvironmentSettings environmentSettings)
 {
     return(Log4NetTracerBuilder.Use
            .ApplicationXmlConfig
            .Console
            .WithGlobalProperties(x =>
                                  x.Property("Environment", environmentSettings.EnvironmentName)
                                  .Property(TracerContextKeys.EntryPoint, environmentSettings.EntryPointName)
                                  .Property(TracerContextKeys.EntryPointHost, NetworkInfo.ComputerFQDN)
                                  .Property(TracerContextKeys.EntryPointInstanceId, Guid.NewGuid().ToString()))
            .Build);
 }
Exemple #18
0
        private string ConstructKeyValueMapUrl(string orgName, IEnvironmentSettings settings)
        {
            var url = baseUri + $"v1/organizations/{orgName}";

            if (settings != null && settings.Environment != null)
            {
                url += $"/environments/{settings.Environment}";
            }

            url += "/keyvaluemaps";
            return(url);
        }
Exemple #19
0
        public QueryOver(IMetadataStore metadatastore,
                         IHydrator hydrator, IDbConnection connection,
                         IDialect dialect, IEnvironmentSettings environment)
        {
            _metadatastore = metadatastore;
            _hydrator      = hydrator;
            _connection    = connection;
            _dialect       = dialect;
            _environment   = environment;

            _queryDefinition = new QueryOverDefinition <TEntity>(typeof(TEntity),
                                                                 _connection, _metadatastore, _hydrator, _dialect, _environment);
        }
        public VariableWebService(
            IHttpClientFactory factory,
            IHttpClientSettings settings,
            IIdentityHelper identity,

            IEnvironmentSettings env,
            IApplicationSettings app
            )
            : base(factory, settings, identity, new NonLogger())
        {
            Env = env;
            App = app;
        }
        public SphyrnidaeApiAuthenticationWebService(
            IHttpClientFactory factory,
            IHttpClientSettings settings,
            IIdentityHelper identity,
            ILogger logger,

            IEnvironmentSettings env,
            IApplicationSettings app
            ) : base(factory, settings, identity, logger)
        {
            Env = env;
            App = app;
        }
Exemple #22
0
        public UserPreferenceWebService(
            IHttpClientFactory factory,
            IHttpClientSettings settings,
            IIdentityHelper identity,
            ILogger logger,

            IEnvironmentSettings env,
            IApplicationSettings app
            ) : base(factory, settings, identity, logger)
        {
            Env = env;
            App = app;
        }
Exemple #23
0
 public QueryOverDefinition(Type queryOverEntity,
                            IDbConnection connection,
                            IMetadataStore metadatastore,
                            IHydrator hydrator,
                            IDialect dialect,
                            IEnvironmentSettings environment)
 {
     _queryOverEntity = queryOverEntity;
     _connection      = connection;
     _metadatastore   = metadatastore;
     _hydrator        = hydrator;
     _dialect         = dialect;
     _environment     = environment;
 }
Exemple #24
0
        public KafkaSettingsFactory(
            IReadOnlyDictionary <IMessageFlow, string> messageFlows2ConnectionStringsMap,
            IEnvironmentSettings environmentSettings)
        {
            foreach (var entry in messageFlows2ConnectionStringsMap)
            {
                var kafkaConfig = ParseConnectionString(entry.Value);

                // example group.id: '4f04437a-2f10-4a37-bb49-03810346ae84-Test.11'
                kafkaConfig.Config["group.id"] = string.Concat(entry.Key.Id.ToString(), "-", environmentSettings.EnvironmentName);

                _flows2ConsumerSettingsMap.Add(entry.Key, kafkaConfig);
            }
        }
        private static IUnityContainer ConfigureOperationsProcessing(this IUnityContainer container,
                                                                     IEnvironmentSettings environmentSettings,
                                                                     IConnectionStringSettings connectionStringSettings)
        {
            var kafkaSettingsFactory =
                new KafkaSettingsFactory(new Dictionary <IMessageFlow, string>
            {
                [AliasForAmsFactsFlow.Instance] = connectionStringSettings.GetConnectionString(AmsConnectionStringIdentity.Instance)
            },
                                         environmentSettings);

            return(container.RegisterInstance <IKafkaSettingsFactory>(kafkaSettingsFactory)
                   .RegisterType <KafkaMessageFlowInfoProvider>(new ContainerControlledLifetimeManager()));
        }
Exemple #26
0
        public SessionFactory(IEnvironmentSettings environment,
                              IMetadataStore metadataStore,
                              string connectionString = "")
        {
            _environment      = environment;
            _metadataStore    = metadataStore;
            _connectionString = connectionString;

            if (_metadataStore == null)
            {
                _metadataStore = new MetadataStore();
            }

            _sessions = new ConcurrentBag <ISession>();
        }
Exemple #27
0
 public QueryContext(IMetadataStore metadataStore,
                     IHydrator hydrator,
                     IDbConnection connection,
                     IDialect dialect,
                     IEnvironmentSettings environment)
 {
     _metadataStore   = metadataStore;
     _hydrator        = hydrator;
     _connection      = connection;
     _dialect         = dialect;
     _environment     = environment;
     this._builder    = new StringBuilder();
     this._buffer     = new StringWriterReader(this._builder);
     this._tableInfo  = this._metadataStore.GetTableInfo <T>();
     this._parameters = new Dictionary <string, object>();
 }
Exemple #28
0
        internal PreCompiledHeadersEventListener(ICFamilyAnalyzer cFamilyAnalyzer,
                                                 IActiveDocumentTracker activeDocumentTracker,
                                                 IScheduler scheduler,
                                                 ISonarLanguageRecognizer sonarLanguageRecognizer,
                                                 IEnvironmentSettings environmentSettings,
                                                 IPchCacheCleaner pchCacheCleaner)
        {
            this.cFamilyAnalyzer         = cFamilyAnalyzer;
            this.activeDocumentTracker   = activeDocumentTracker;
            this.scheduler               = scheduler;
            this.sonarLanguageRecognizer = sonarLanguageRecognizer;
            this.pchCacheCleaner         = pchCacheCleaner;

            pchJobTimeoutInMilliseconds = environmentSettings.PCHGenerationTimeoutInMs(60 * 1000);

            activeDocumentTracker.OnDocumentFocused += OnActiveDocumentFocused;
        }
Exemple #29
0
 public QueryClause(QueryOverDefinition <TParent> definition,
                    Type queriedOverEntity,
                    IDbConnection connection,
                    IMetadataStore metadataStore,
                    IHydrator hydrator,
                    IDialect dialect,
                    IEnvironmentSettings environment,
                    Expression <Func <TEntity, bool> > clause)
     : base(metadataStore, clause)
 {
     _definition        = definition;
     _queriedOverEntity = queriedOverEntity;
     _connection        = connection;
     _hydrator          = hydrator;
     _dialect           = dialect;
     _environment       = environment;
 }
Exemple #30
0
 public Query(IMetadataStore metadatastore,
              IHydrator hydrator, IDbConnection connection,
              IDialect dialect, IEnvironmentSettings environment)
 {
     this._metadatastore   = metadatastore;
     this._hydrator        = hydrator;
     this._connection      = connection;
     _dialect              = dialect;
     _environment          = environment;
     _selectionOptions     = new List <ISelectOption>();
     _groupingOptions      = new List <IGroupByOption>();
     _orderOptions         = new List <IOrderOption>();
     _criteriaRestrictions = new List <ICriteriaRestriction>();
     _queryParameters      = new HashSet <QueryParameter>();
     _eagerFetchProperties = new Dictionary <Type, string>();
     _parentEntity         = typeof(TParentEntity);
 }
Exemple #31
0
 public MessageFileProcessorComponent(
     ILogger <MessageFileProcessorComponent> logger,
     IEnvironmentSettings environmentSettings,
     IJobsRepository jobsRepository,
     IActivityStreamRepository activityStreamRepository,
     IXmlFileProcessor xmlFileProcessor,
     IIntegrationEventComponent integrationEventComponent,
     BlobServiceClient blobServiceClient)
 {
     _logger                       = logger;
     _jobsRepository               = jobsRepository;
     _activityStreamRepository     = activityStreamRepository;
     _xmlFileProcessor             = xmlFileProcessor;
     _integrationEventComponent    = integrationEventComponent;
     _filesBlobContainerClient     = blobServiceClient.GetBlobContainerClient(environmentSettings.GetSetting("FILES_BLOB_CONTAINER_NAME", "files"));
     _processedBlobContainerClient = blobServiceClient.GetBlobContainerClient(environmentSettings.GetSetting("PROCESSED_BLOB_CONTAINER_NAME", "processed"));
 }
 public WebApplicationApi(IEnvironmentSettings settings)
 {
     m_BaseUri = settings.LoadBalancedApplicationUrl;
 }
 public EnvironmentController(IEnvironmentSettings environment)
 {
     this.environment = environment;
 }
Exemple #34
0
 public WebFarm(IEnvironmentSettings settings)
 {
     m_Settings = settings;
 }
Exemple #35
0
 public TeamCityApi(IEnvironmentSettings settings)
 {
     m_Settings = settings;
 }