/// <summary> /// Create engine /// </summary> /// <param name="messageTrigger"></param> /// <param name="encoder"></param> /// <param name="messageSink"></param> /// <param name="engineConfiguration"></param> /// <param name="logger"></param> public DataFlowProcessingEngine(IMessageTrigger messageTrigger, IMessageEncoder encoder, IMessageSink messageSink, IEngineConfiguration engineConfiguration, ILogger logger) { _messageTrigger = messageTrigger; _messageSink = messageSink; _messageEncoder = encoder; _logger = logger; _messageTrigger.OnMessage += MessageTriggerMessageReceived; if (engineConfiguration.DiagnosticsInterval.HasValue && engineConfiguration.DiagnosticsInterval > TimeSpan.Zero) { _diagnosticsOutputTimer = new Timer(DiagnosticsOutputTimer_Elapsed, null, 0, (int)engineConfiguration.DiagnosticsInterval.Value.TotalMilliseconds); } if (engineConfiguration.BatchSize.HasValue && engineConfiguration.BatchSize.Value > 1) { _dataSetMessageBufferSize = engineConfiguration.BatchSize.Value; } if (engineConfiguration.MaxMessageSize.HasValue && engineConfiguration.MaxMessageSize.Value > 0) { _maxEncodedMessageSize = engineConfiguration.MaxMessageSize.Value; } }
/// <summary> /// Create engine /// </summary> /// <param name="messageTrigger"></param> /// <param name="encoder"></param> /// <param name="messageSink"></param> /// <param name="engineConfiguration"></param> /// <param name="logger"></param> /// <param name="identity"></param> public DataFlowProcessingEngine(IMessageTrigger messageTrigger, IMessageEncoder encoder, IMessageSink messageSink, IEngineConfiguration engineConfiguration, ILogger logger, IIdentity identity) { _config = engineConfiguration; _messageTrigger = messageTrigger; _messageSink = messageSink; _messageEncoder = encoder; _logger = logger; _identity = identity; if (_config.BatchSize.HasValue && _config.BatchSize.Value > 1) { _dataSetMessageBufferSize = _config.BatchSize.Value; } if (_config.MaxMessageSize.HasValue && _config.MaxMessageSize.Value > 0) { _maxEncodedMessageSize = _config.MaxMessageSize.Value; } _diagnosticInterval = _config.DiagnosticsInterval.GetValueOrDefault(TimeSpan.Zero); _batchTriggerInterval = _config.BatchTriggerInterval.GetValueOrDefault(TimeSpan.Zero); _diagnosticsOutputTimer = new Timer(DiagnosticsOutputTimer_Elapsed); _batchTriggerIntervalTimer = new Timer(BatchTriggerIntervalTimer_Elapsed); }
public GenerationConfiguration(IEngineConfiguration configuration, IEngineConventionProvider conventionProvider, int recursionLimit) { mConfiguration = configuration; mConventions = conventionProvider; RecursionLimit = recursionLimit; }
public void AddTypesAndBuild() { this.Builder.Include<SimpleUser>(); this.Builder.Include<SimplePropertyClass>(); this.Builder.Include<SimpleFieldClass>(); this.Configuration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); }
/// <summary> /// Create engine /// </summary> /// <param name="messageTrigger"></param> /// <param name="encoder"></param> /// <param name="messageSink"></param> /// <param name="engineConfiguration"></param> /// <param name="logger"></param> /// <param name="identity"></param> public DataFlowProcessingEngine(IMessageTrigger messageTrigger, IMessageEncoder encoder, IMessageSink messageSink, IEngineConfiguration engineConfiguration, ILogger logger, IIdentity identity) { _config = engineConfiguration; _messageTrigger = messageTrigger; _messageSink = messageSink; _messageEncoder = encoder; _logger = logger; _identity = identity; if (_config.BatchSize.HasValue && _config.BatchSize.Value > 1) { _dataSetMessageBufferSize = _config.BatchSize.Value; } if (_config.MaxMessageSize.HasValue && _config.MaxMessageSize.Value > 0) { _maxEncodedMessageSize = _config.MaxMessageSize.Value; } _diagnosticInterval = _config.DiagnosticsInterval.GetValueOrDefault(TimeSpan.Zero); _batchTriggerInterval = _config.BatchTriggerInterval.GetValueOrDefault(TimeSpan.Zero); _diagnosticsOutputTimer = new Timer(DiagnosticsOutputTimer_Elapsed); _batchTriggerIntervalTimer = new Timer(BatchTriggerIntervalTimer_Elapsed); _maxEgressMessageQueue = _config.MaxEgressMessageQueue.GetValueOrDefault(4096); // = 2 GB / 2 / (256 * 1024) _logger.Information($"Max. egress message queue: {_maxEgressMessageQueue} messages ({_maxEgressMessageQueue * 256 / 1024} MB)"); }
public SchedulerConsoleSettings(IApplicationContext context, IEngineConfiguration engineConfig, IApplicationConfiguration appConfig) { InstanceId = context.InstanceId.ToString(); InstanceName = appConfig.ApplicationName; StartEngineImmediately = engineConfig.IsImmediateEngineStartEnabled; EnableJobsDirectoryTracking = engineConfig.IsJobsDirectoryTrackingEnabled; JobsDirectory = engineConfig.JobsDirectory; EngineStarted = (sender, e) => { ConsoleApi.WriteLine("The engine has been started..."); }; EnginePaused = (sender, e) => { ConsoleApi.WriteLine("The engine has been paused..."); }; EngineTerminated = (sender, e) => { ConsoleApi.WriteLine("The engine has been terminated..."); }; JobScheduled = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has been scheduled"); }; JobUnscheduled = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has been unscheduled"); }; JobPaused = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has been put on hold"); }; JobResumed = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has been resumed"); }; JobTriggered = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has been triggered"); }; JobExecutionSucceeded = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has finished with status: SUCCESS"); }; JobExecutionFailed = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has finished with status: FAILED"); }; JobExecutionSkipped = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) execution has been skipped"); }; BeforeJobExecution = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) is going to be executed"); }; AfterJobExecution = (sender, e) => { ConsoleApi.WriteLine($"The job (Name:{e.Job.Name}, Group:{e.Job.Group}) has been executed"); }; }
public IEngine Setup(Func <IMutableEngineConfiguration> creator, Action <IMutableEngineConfiguration> configurator) { if (creator == null) { throw new ArgumentNullException("creator"); } if (configurator == null) { throw new ArgumentNullException("configurator"); } IMutableEngineConfiguration config = creator(); if (config == null) { throw new InvalidOperationException("config from creator() is null"); } _config = config; configurator(config); _globalContext = config.ContextProvider(); _plan = config.PlanProvider(); foreach (var action in _config.Actions) { action.SetEngine(this); } return(this); }
public IPlan GetPlan(IEngineConfiguration config) { if (config == null) { throw new ArgumentNullException("config"); } ActionGraph graph = new ActionGraph(config); IEnumerable <IAction> actionsInOrder = graph.GetActionsInDependencyOrder(); IObservable <IElement> root = System.Linq.Enumerable.Empty <IElement>().AsObservable(); IList <IEnumerable <IElement> > finals = new List <IEnumerable <IElement> >(); foreach (IAction action in actionsInOrder) { if (graph.GetPrevActionsCount(action) > 0) { var outputs = graph.GetPrevActions(action).Select(x => x.Output.AsEnumerable()); action.SetInput(outputs.Merge().AsObservable()); } else { action.SetInput(root); } if (graph.GetNextActionsCount(action) == 0) { finals.Add(action.Output.AsEnumerable()); } } return(new EnumerablePlan(finals.Merge())); }
/// <summary> /// Creates a <see cref="RazorLightEngine"/> that resolves templates inside given type assembly as a EmbeddedResource /// with a given <see cref="IEngineConfiguration"/> /// </summary> /// <param name="rootType">Root type where resource is located</param> /// <param name="configuration">Engine configuration</param> public static RazorLightEngine CreateEmbedded(Type rootType, IEngineConfiguration configuration) { ITemplateManager manager = new EmbeddedResourceTemplateManager(rootType); var dependencies = CreateDefaultDependencies(manager, configuration); return(new RazorLightEngine(dependencies.Item1, dependencies.Item2)); }
public void AddTypesAndBuild() { this.Builder.Include <SimpleUser>(); this.Builder.Include <SimplePropertyClass>(); this.Builder.Include <SimpleFieldClass>(); this.Configuration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); }
protected virtual IEnumerable<IEngineConfigurationTypeMember> GetAllTypeHierarchyMembers(IEngineConfiguration baseConfiguration, IEngineConfigurationType sourceType) { Stack<IEngineConfigurationType> configurationStack = new Stack<IEngineConfigurationType>(); Type currentType = sourceType.RegisteredType; IEngineConfigurationType currentTypeConfiguration = null; // Get all the base types into a stack, where the base-most type is at the top while (currentType != null) { currentTypeConfiguration = baseConfiguration.GetRegisteredType(currentType); if (currentTypeConfiguration != null) { configurationStack.Push(currentTypeConfiguration); } currentType = currentType.BaseType; } // Put all the implemented interfaces on top of that foreach (var interfaceType in sourceType.RegisteredType.GetInterfaces()) { currentTypeConfiguration = baseConfiguration.GetRegisteredType(interfaceType); if (currentTypeConfiguration != null) { configurationStack.Push(currentTypeConfiguration); } } var membersToApply = (from typeConfig in configurationStack from memberConfig in typeConfig.GetRegisteredMembers() select memberConfig).ToArray(); return membersToApply; }
/// <summary> /// Create converter /// </summary> /// <param name="logger"></param> /// <param name="config"></param> /// <param name="cryptoProvider"></param> public PublishedNodesJobConverter(ILogger logger, IEngineConfiguration config = null, ISecureElement cryptoProvider = null) { _config = config; _cryptoProvider = cryptoProvider; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public void Ensure_Passed_Configuration_Is_Applided_OnPhysical() { IEngineConfiguration configuration = EngineConfiguration.Default; var engine = EngineFactory.CreatePhysical(viewsRoot, configuration); Assert.Same(configuration, engine.Configuration); }
public RazorEngineCore(ReadOnlyEngineConfiguration config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } this.Configuration = config; }
public EngineService(IActionService actionService, IEngineConfiguration engineConfiguration) { _actionService = actionService; _engineConfiguration = engineConfiguration; _runtime = WorkflowRuntimeFactory(); }
public MailConfiguration(IEngineConfiguration engineConfiguration, string integrationPointName) : this() { var config = engineConfiguration.IntegrationPoints.Mail.Single(x => x.IntegrationPointName == integrationPointName); IntegrationPointName = integrationPointName; HostName = config.HostName; Port = config.Port; }
public void Ensure_Passed_Configuration_Is_Applided_OnEmbedded() { IEngineConfiguration configuration = EngineConfiguration.Default; var engine = EngineFactory.CreateEmbedded(typeof(TestViewModel), configuration); Assert.Same(configuration, engine.Configuration); }
public EngineConfigurationProviderLoaderContext( IEngineConfiguration configuration, IEngineConfigurationProvider configurationProvider, IEngineConventionProvider conventionProvider) { this.Configuration = configuration; this.ConfigurationProvider = configurationProvider; this.ConventionProvider = conventionProvider; }
public void AddSimpleUser() { this.Builder.Include<SimpleUser>() .Setup(x => x.EmailAddress).Default() .Setup(x => x.FirstName).Default() .Setup(x => x.LastName).Default(); Configuration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); }
public void AddSimpleUser() { this.Builder.Include <SimpleUser>() .Setup(x => x.EmailAddress).Default() .Setup(x => x.FirstName).Default() .Setup(x => x.LastName).Default(); Configuration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); }
public MainWindowViewModel(IEngineConfiguration aEngineConfiguration) { var xEngine = new FullEngine(aEngineConfiguration); xEngine.SetOutputHandler( new OutputHandler( m => TestRunnerLog += m + Environment.NewLine)); new Thread(() => xEngine.Execute()).Start(); }
/// <summary> /// Create converter /// </summary> /// <param name="logger"></param> /// <param name="serializer"></param> /// <param name="config"></param> /// <param name="cryptoProvider"></param> /// <param name="identity"></param> public PublishedNodesJobConverter(ILogger logger, IJsonSerializer serializer, IIdentity identity, IEngineConfiguration config = null, ISecureElement cryptoProvider = null) { _config = config; _cryptoProvider = cryptoProvider; _serializer = serializer ?? throw new ArgumentNullException(nameof(logger)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _identity = identity ?? throw new ArgumentNullException(nameof(identity)); }
public JsonServiceConfiguration(IEngineConfiguration engineConfiguration, string integrationPointName) : this() { var config = engineConfiguration.IntegrationPoints.JsonService.Single(x => x.IntegrationPointName == integrationPointName); IntegrationPointName = integrationPointName; BaseUri = config.BaseUri; UserName = config.UserName; Password = config.Password; AlwaysSendBasicAuthHeader = config.AlwaysSendBasicAuthHeader; }
/// <summary> /// Create instance of MonitoredItemMessageEncoder. /// </summary> /// <param name="logger"> Logger to be used for reporting. </param> /// <param name="standaloneConfig"> injected configuration. </param> /// <param name="engineConfig"> injected configuration. </param> public MonitoredItemMessageEncoder(ILogger logger, IStandaloneCliModelProvider standaloneConfig, IEngineConfiguration engineConfig) { _logger = logger; _jsonContentType = standaloneConfig.StandaloneCliModel.LegacyCompatibility ? ContentMimeType.UaLegacyPublisher : ContentMimeType.Json; _enableRoutingInfo = engineConfig.EnableRoutingInfo.GetValueOrDefault(false); }
public ElasticsearchConfiguration(IEngineConfiguration engineConfiguration, string integrationPointName) : this() { var config = engineConfiguration.IntegrationPoints.Elasticsearch.Single(x => x.IntegrationPointName == integrationPointName); IntegrationPointName = integrationPointName; Protocol = config.Protocol; HostName = config.HostName; Port = config.Port; DefaultIndex = config.DefaultIndex; }
public void Setup() { this.Builder.Conventions(x => { x.Register <TestTypeConvention>(); }); this.Builder.Include <TestTypeClass>(); mConfiguration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); mType = mConfiguration.GetRegisteredType(typeof(TestTypeClass)); }
/// <summary> /// Initialises a new instance of <see cref="RazorEngineHost" /> /// </summary> /// <param name="config">The template service configuration.</param> internal RazorEngineHost(IEngineConfiguration config) { if (config == null) { throw new ArgumentNullException(nameof(config)); } //if (config.Debug && config.DisableTempFileLocking) // throw new InvalidOperationException("Debug && DisableTempFileLocking is not supported, you need to disable one of them. When Roslyn has been released and you are seeing this, open an issue as this might be possible now."); this.Configuration = config; this.Core = new RazorEngineCore(new ReadOnlyEngineConfiguration(config)); }
private static Tuple <IEngineCore, IPageLookup> CreateDefaultDependencies( ITemplateManager manager, IEngineConfiguration configuration) { IEngineCore core = new EngineCore(manager, configuration); IPageFactoryProvider pageFactory = new DefaultPageFactory(core.KeyCompile); IPageLookup lookup = new DefaultPageLookup(pageFactory); return(new Tuple <IEngineCore, IPageLookup>(core, lookup)); }
public Engine(IEngineConfiguration configuration) { _configuration = configuration; foreach (string plugin in _plugins) { Bass.PluginLoad(plugin); } _eq = new PeakEQParameters(); _eqHandle = GCHandle.Alloc(_eq, GCHandleType.Pinned); _maxfft = (int)(DataFlags.Available | DataFlags.FFT2048); }
public void Setup() { this.Builder.Conventions(x => { x.Register<TestTypeConvention>(); }); this.Builder.Include<TestTypeClass>(); mConfiguration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); mType = mConfiguration.GetRegisteredType(typeof(TestTypeClass)); }
public RabbitMQConfiguration(IEngineConfiguration engineConfiguration, string integrationPointName) : this() { var config = engineConfiguration.IntegrationPoints.RabbitMQ.Single(x => x.IntegrationPointName == integrationPointName); IntegrationPointName = integrationPointName; QueueName = config.QueueName; ExchangeName = config.ExchangeName; UserName = config.UserName; Password = config.Password; HostName = config.HostName; VirtualHost = config.VirtualHost; }
/// <summary> /// Creates <see cref="EngineCore" /> with specified <seealso cref="EngineConfiguration"/>/> /// </summary> /// <param name="templateManager">Template manager</param> /// <param name="configuration">Engine configuration options</param> public EngineCore( ITemplateManager templateManager, IEngineConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } this.TemplateManager = templateManager; this.Configuration = configuration; }
public void Create_WithEmptySetup_ReturnsConfiguration() { var configurationProviderMock = new Mock <IEngineConfigurationProvider>(); var conventionProviderMock = new Mock <IEngineConventionProvider>(); var factory = new EngineConfigurationFactory(); IEngineConfiguration configuration = factory.Create( configurationProviderMock.Object, conventionProviderMock.Object); Assert.NotNull(configuration); }
/// <summary> /// Create converter /// </summary> /// <param name="logger"></param> /// <param name="serializer"></param> /// <param name="engineConfig"></param> /// <param name="clientConfig"></param> /// <param name="cryptoProvider"></param> public PublishedNodesJobConverter( ILogger logger, IJsonSerializer serializer, IEngineConfiguration engineConfig, IClientServicesConfig clientConfig, ISecureElement cryptoProvider = null) { _engineConfig = engineConfig ?? throw new ArgumentNullException(nameof(engineConfig)); _clientConfig = clientConfig ?? throw new ArgumentNullException(nameof(clientConfig)); _cryptoProvider = cryptoProvider; _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public MainWindowViewModel(IEngineConfiguration aEngineConfiguration) { var xEngine = new Engine(aEngineConfiguration) { OutputHandler = new OutputHandler( m => { TestRunnerLog += m + Environment.NewLine; OnPropertyChanged(nameof(TestRunnerLog)); }) }; new Thread(() => xEngine.Execute()).Start(); }
public void Setup() { this.Builder.Conventions(x => { x.Register<TestPropertyConvention>(); }); this.Builder.Include<TestPropertyClass>() .Setup(x => x.Test).Default() .Setup(x => x.TestIgnore); mConfiguration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); mType = mConfiguration.GetRegisteredType(typeof(TestPropertyClass)); mTestProperty = mType.GetRegisteredMembers().Where(x => x.Member.Name == "Test").Single(); mTestIgnoreProperty = mType.GetRegisteredMembers().Where(x => x.Member.Name == "TestIgnore").Single(); }
public CascadeBaseTypeConfigurationAction(IEngineConfiguration configuration) { mConfiguration = configuration; }
public GenerationSessionFactory(IEngineConfiguration config, IEngineConventionProvider conventionProvider) { mConfig = config; mConventionProvider = conventionProvider; }
public Engine(IEngineConfiguration configuration) { this.parser = configuration.Parser; this.urlBuilder = configuration.UrlBuilder; this.spider = configuration.Spider; }
/// <summary> /// Initializes a new instance of the <see cref="FiddlerCoreEngine"/> class. /// </summary> /// <param name="engineConfiguration">The engine configuration.</param> public FiddlerCoreEngine(ILogger engineLogger, IEngineConfiguration engineConfiguration) { configuration = engineConfiguration; logger = engineLogger; }
public TypeFieldConventionContext(IEngineConfiguration config, IEngineConfigurationTypeMember member) : base(config, member) { }
protected virtual void TryRegisterType(IEngineConfiguration configuration, Type configType) { IEngineConfigurationType configuredType = configuration.GetRegisteredType(configType); if (configuredType == null) { configuration.RegisterType(configType); configuredType = configuration.GetRegisteredType(configType); } foreach (Type interfaceType in configType.GetInterfaces()) { TryRegisterType(configuration, interfaceType); } Type baseType = configType.BaseType; if (baseType != null) { TryRegisterType(configuration, baseType); } }
public ApplyTypeMemberConventionsAction(IEngineConfiguration configuration, IEngineConventionProvider conventions) { mConfiguration = configuration; mConventionProvider = conventions; }
public void SetupObjects() { this.Builder.Include<SimpleMethodClass>() .Invoke(x=>x.SetSomething("Literal")) .Invoke(x=>x.SetSomething( Use.Source<String, FirstNameSource>(), Use.Source<String, LastNameSource>())); Configuration = new EngineConfigurationFactory().Create(this.Builder, this.Builder.ConventionProvider); // Get some info for the tests mEngineConfigurationType = Configuration.GetRegisteredType(typeof(SimpleMethodClass)); mSingleArgMethod = (EngineTypeMethodMember)ReflectionHelper.GetMember( typeof(SimpleMethodClass).GetMethod("SetSomething", new Type[] { typeof(string) })); mDoubleArgMethod = (EngineTypeMethodMember)ReflectionHelper.GetMember( typeof(SimpleMethodClass).GetMethod("SetSomething", new Type[] { typeof(string), typeof(string) })); }