Example #1
0
        protected override async Task <Int32> UseRestorerInParallelWithCancellationWatchingAsync(
            ConfigurationInformation <TConfiguration> info,
            CancellationToken token,
            BoundRestoreCommandUser restorer,
            String sdkPackageID,
            String sdkPackageVersion
            )
        {
            var config        = info.Configuration;
            var specialValues = new Dictionary <Type, Func <Object> >()
            {
                { typeof(Func <String>), () => config.ProjectFilePath }
            };

            var maybeResult = await config.ExecuteMethodAndSerializeReturnValue(
                token,
                restorer,
                type =>
            {
                return(specialValues.TryGetValue(type, out var factory) ?
                       factory() :
                       JsonConvert.DeserializeObject(config.InputProperties, type)
                       );
            },
#if NET46
                null
#else
                sdkPackageID,
                sdkPackageVersion
#endif
                , getFiles : restorer.ThisFramework.CreateMSBuildExecGetFilesDelegate()
                );

            return(maybeResult.IsFirst ? 0 : -4);
        }
Example #2
0
        private void Settings_Reply(object sender, EventArgs e)
        {
            string result;

            ConfigurationInformation inConfigurationInformation;

            try
            {
                inConfigurationInformation = (ConfigurationInformation)e;

                if (inConfigurationInformation == null)
                {
                    Audit($"שגיאת עדכון הגדרות. אובייקט הגדרות ריק", AuditSeverity.Critical);

                    return;
                }

                if (!SaveToAppConfig(inConfigurationInformation, out result))
                {
                    Audit($"שגיאת עדכון הגדרות: {result}", AuditSeverity.Critical);

                    return;
                }

                configurationInformation = inConfigurationInformation;
            }
            catch (Exception ex)
            {
                Audit($"שגיאת חיפוש לפי זמן: {ex.Message}", AuditSeverity.Critical);
            }
        }
Example #3
0
        private async Task <bool> Initialize()
        {
            try
            {
                if (string.IsNullOrEmpty(VideoMDFetcher.TheMovieDbApiKey))
                {
                    return(configured);
                }

                var client = new HttpClient();

                var url      = $"http://api.themoviedb.org/3/configuration?api_key={VideoMDFetcher.TheMovieDbApiKey}";
                var response = await client.GetStringAsync(new Uri(url));

                var config = JsonConvert.DeserializeObject <ConfigurationInformation>(response);

                if (config != null)
                {
                    this.configuration = config;
                    this.configured    = true;
                }
            }
            catch (Exception)
            {
                Debug.WriteLine("Failed to get configuration information from MovieDB Client");
            }
            return(configured);
        }
Example #4
0
        public static string AddHardware(this IHardware hardware, ConfigurationInformation configInfo)
        {
            var name = hardware.GetID();
            var msg  = configInfo.details;

            switch (hardware.HardwareType)
            {
            case HardwareType.CPU:
                configInfo.CPUtype = hardware.Name;
                break;

            case HardwareType.GpuAti:
            case HardwareType.GpuNvidia:
                configInfo.GPUType = hardware.Name;
                break;

            case HardwareType.Mainboard:
                configInfo.MainboardType = hardware.Name;
                break;
            }
            // add the object to the dictionary
            string descriptionString = String.Empty;

            descriptionString = hardware.GetReport();

            msg.Add(name, descriptionString);
            return(name);
        }
Example #5
0
        private bool SaveToAppConfig(ConfigurationInformation inConfigurationInformation, out string result)
        {
            result = string.Empty;

            try
            {
                if (inConfigurationInformation == null)
                {
                    result = "אובייקט הגדרות אינו מוגדר";

                    return(false);
                }

                Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

                configuration.AppSettings.Settings["JsonFilePath"].Value = inConfigurationInformation.JsonFilePath;
                configuration.AppSettings.Settings["JsonFileName"].Value = inConfigurationInformation.JsonFileName;
                configuration.AppSettings.Settings["LogFilePath"].Value  = inConfigurationInformation.LogFilePath;

                configuration.AppSettings.Settings["LogToFile"].Value = inConfigurationInformation.LogToFile.ToString();

                configuration.Save();

                ConfigurationManager.RefreshSection("appSettings");

                return(true);
            }
            catch (Exception e)
            {
                result = e.Message;

                return(false);
            }
        }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="container">The container.</param>
 /// <param name="engineImportService">engine imports</param>
 /// <param name="variableService">variable names</param>
 /// <param name="configuration">the configuration</param>
 /// <param name="schedulingService">The scheduling service.</param>
 /// <param name="engineURI">The engine URI.</param>
 /// <param name="patternNodeFactory">The pattern node factory.</param>
 /// <param name="namedWindowMgmtService">The named window service.</param>
 /// <param name="contextManagementService">The context management service.</param>
 /// <param name="exprDeclaredService">The expr declared service.</param>
 /// <param name="contextDescriptor">optional context description</param>
 /// <param name="tableService">The table service.</param>
 public StatementSpecMapContext(
     IContainer container,
     EngineImportService engineImportService,
     VariableService variableService,
     ConfigurationInformation configuration,
     SchedulingService schedulingService,
     string engineURI,
     PatternNodeFactory patternNodeFactory,
     NamedWindowMgmtService namedWindowMgmtService,
     ContextManagementService contextManagementService,
     ExprDeclaredService exprDeclaredService,
     ContextDescriptor contextDescriptor,
     TableService tableService)
 {
     Container                = container;
     PlugInAggregations       = new LazyAllocatedMap <ConfigurationPlugInAggregationMultiFunction, PlugInAggregationMultiFunctionFactory>();
     TableExpressions         = new HashSet <ExprTableAccessNode>();
     EngineImportService      = engineImportService;
     VariableService          = variableService;
     Configuration            = configuration;
     VariableNames            = new HashSet <string>();
     SchedulingService        = schedulingService;
     EngineURI                = engineURI;
     PatternNodeFactory       = patternNodeFactory;
     NamedWindowMgmtService   = namedWindowMgmtService;
     ContextManagementService = contextManagementService;
     ExprDeclaredService      = exprDeclaredService;
     ContextDescriptor        = contextDescriptor;
     TableService             = tableService;
 }
Example #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string result;

            try
            {
                if (!ValidateSettings(out result))
                {
                    OnAudit($"שגיאת הגדרות : {result}", AuditSeverity.Error);

                    return;
                }

                if (Reply != null)
                {
                    ConfigurationInformation configurationInformation = new ConfigurationInformation();

                    configurationInformation.JsonFileName = txtJsonFileName.Text;
                    configurationInformation.JsonFilePath = txtJsonFilePath.Text;
                    configurationInformation.LogFilePath  = txtLogFilePath.Text;

                    configurationInformation.LogToFile = chkLogToFile.Checked;

                    Reply(null, configurationInformation);

                    Close();
                }
            }
            catch (Exception ex)
            {
                OnAudit($"תקלת הגדרות: {ex.Message}", AuditSeverity.Error);
            }
        }
 public FilterSpecCompilerArgs(
     IDictionary<string, Pair<EventType, string>> taggedEventTypes,
     IDictionary<string, Pair<EventType, string>> arrayEventTypes,
     ExprEvaluatorContext exprEvaluatorContext,
     string statementName,
     string statementId,
     StreamTypeService streamTypeService,
     MethodResolutionService methodResolutionService,
     TimeProvider timeProvider,
     VariableService variableService,
     TableService tableService,
     EventAdapterService eventAdapterService,
     ScriptingService scriptingService,
     Attribute[] annotations,
     ContextDescriptor contextDescriptor,
     ConfigurationInformation configurationInformation)
 {
     TaggedEventTypes = taggedEventTypes;
     ArrayEventTypes = arrayEventTypes;
     ExprEvaluatorContext = exprEvaluatorContext;
     StatementName = statementName;
     StatementId = statementId;
     StreamTypeService = streamTypeService;
     MethodResolutionService = methodResolutionService;
     TimeProvider = timeProvider;
     VariableService = variableService;
     TableService = tableService;
     EventAdapterService = eventAdapterService;
     ScriptingService = scriptingService;
     Annotations = annotations;
     ContextDescriptor = contextDescriptor;
     ConfigurationInformation = configurationInformation;
 }
Example #9
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="lookupable">is the lookup-able</param>
        /// <param name="filterOperator">is expected to be the BOOLEAN_EXPR operator</param>
        /// <param name="exprNode">represents the boolean expression</param>
        /// <param name="taggedEventTypes">is null if the expression doesn't need other streams, or is filled with a ordered list of stream names and types</param>
        /// <param name="arrayEventTypes">is a map of name tags and event type per tag for repeat-expressions that generate an array of events</param>
        /// <param name="variableService">provides access to variables</param>
        /// <param name="tableService">The table service.</param>
        /// <param name="eventAdapterService">for creating event types and event beans</param>
        /// <param name="configurationInformation">The configuration information.</param>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="hasSubquery">if set to <c>true</c> [has subquery].</param>
        /// <param name="hasTableAccess">if set to <c>true</c> [has table access].</param>
        /// <exception cref="System.ArgumentException">Invalid filter operator for filter expression node</exception>
        /// <throws>IllegalArgumentException for illegal args</throws>
        public FilterSpecParamExprNode(
            FilterSpecLookupable lookupable,
            FilterOperator filterOperator,
            ExprNode exprNode,
            IDictionary <string, Pair <EventType, string> > taggedEventTypes,
            IDictionary <string, Pair <EventType, string> > arrayEventTypes,
            VariableService variableService,
            TableService tableService,
            EventAdapterService eventAdapterService,
            ConfigurationInformation configurationInformation,
            string statementName,
            bool hasSubquery,
            bool hasTableAccess)
            : base(lookupable, filterOperator)
        {
            if (filterOperator != FilterOperator.BOOLEAN_EXPRESSION)
            {
                throw new ArgumentException("Invalid filter operator for filter expression node");
            }
            _exprNode                 = exprNode;
            _taggedEventTypes         = taggedEventTypes;
            _arrayEventTypes          = arrayEventTypes;
            _variableService          = variableService;
            _tableService             = tableService;
            _eventAdapterService      = eventAdapterService;
            _useLargeThreadingProfile = configurationInformation.EngineDefaults.ExecutionConfig.ThreadingProfile == ConfigurationEngineDefaults.ThreadingProfile.LARGE;
            _hasFilterStreamSubquery  = hasSubquery;
            _hasTableAccess           = hasTableAccess;

            var visitor = new ExprNodeVariableVisitor();

            exprNode.Accept(visitor);
            _hasVariable = visitor.HasVariables;
        }
Example #10
0
        public static bool IsMap(Attribute[] annotations, ConfigurationInformation configs, AssignedType assignedType)
        {
            // assigned type has priority
            if (assignedType == AssignedType.OBJECTARRAY)
            {
                return(false);
            }
            if (assignedType == AssignedType.MAP)
            {
                return(true);
            }
            if (assignedType == AssignedType.VARIANT || assignedType != AssignedType.NONE)
            {
                throw new IllegalStateException("Not handled by event representation: " + assignedType);
            }

            // annotation has second priority
            Attribute annotation = epl.annotation.AnnotationUtil.FindAttribute((IEnumerable <Attribute>)annotations, typeof(EventRepresentationAttribute));

            if (annotation != null)
            {
                var eventRepresentation = (EventRepresentationAttribute)annotation;
                return(!eventRepresentation.Array);
            }

            // use engine-wide default
            return(configs.EngineDefaults.EventMetaConfig.DefaultEventRepresentation == EventRepresentation.MAP);
        }
Example #11
0
 protected override Boolean ValidateConfiguration(
     ConfigurationInformation <TConfiguration> info
     )
 {
     return(info.Configuration.ValidateDiscoverConfiguration() &&
            (info.Configuration.PackageIDIsSelf || info.Configuration.ValidateConfiguration()));
 }
Example #12
0
 protected override Boolean ValidateConfiguration(
     ConfigurationInformation <TConfiguration> info
     )
 {
     return(info.Configuration.ValidateInspectConfiguration() &&
            info.Configuration.ValidateConfiguration());
 }
Example #13
0
        public static StatementSpecRaw CompileEPL(
            string eplStatement,
            string eplStatementForErrorMsg,
            bool addPleaseCheck,
            string statementName,
            SelectClauseStreamSelectorEnum defaultStreamSelector,
            EngineImportService engineImportService,
            VariableService variableService,
            SchedulingService schedulingService,
            string engineURI,
            ConfigurationInformation configSnapshot,
            PatternNodeFactory patternNodeFactory,
            ContextManagementService contextManagementService,
            ExprDeclaredService exprDeclaredService,
            TableService tableService)
        {
            if (Log.IsDebugEnabled)
            {
                Log.Debug(".createEPLStmt statementName=" + statementName + " eplStatement=" + eplStatement);
            }

            ParseResult parseResult = ParseHelper.Parse(
                eplStatement, eplStatementForErrorMsg, addPleaseCheck, EPLParseRule, true);
            ITree ast = parseResult.Tree;

            var walker = new EPLTreeWalkerListener(
                parseResult.TokenStream, engineImportService, variableService, schedulingService, defaultStreamSelector,
                engineURI, configSnapshot, patternNodeFactory, contextManagementService, parseResult.Scripts,
                exprDeclaredService, tableService);

            try
            {
                ParseHelper.Walk(ast, walker, eplStatement, eplStatementForErrorMsg);
            }
            catch (ASTWalkException ex)
            {
                Log.Error(".createEPL Error validating expression", ex);
                throw new EPStatementException(ex.Message, ex, eplStatementForErrorMsg);
            }
            catch (EPStatementSyntaxException ex)
            {
                throw;
            }
            catch (Exception ex)
            {
                string message = "Error in expression";
                Log.Debug(message, ex);
                throw new EPStatementException(GetNullableErrortext(message, ex.Message), ex, eplStatementForErrorMsg);
            }

            if (Log.IsDebugEnabled)
            {
                ASTUtil.DumpAST(ast);
            }

            StatementSpecRaw raw = walker.StatementSpec;

            raw.ExpressionNoAnnotations = parseResult.ExpressionWithoutAnnotations;
            return(raw);
        }
Example #14
0
 public StatementContextEngineServices(
     IContainer container,
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowMgmtService namedWindowMgmtService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory,
     ContextManagementService contextManagementService,
     ViewServicePreviousFactory viewServicePreviousFactory,
     EventTableIndexService eventTableIndexService,
     PatternNodeFactory patternNodeFactory,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     TimeSourceService timeSourceService,
     EngineImportService engineImportService,
     AggregationFactoryFactory aggregationFactoryFactory,
     SchedulingService schedulingService,
     ExprDeclaredService exprDeclaredService)
 {
     Container                           = container;
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowMgmtService              = namedWindowMgmtService;
     VariableService                     = variableService;
     TableService                        = tableService;
     EngineSettingsService               = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
     ContextManagementService            = contextManagementService;
     ViewServicePreviousFactory          = viewServicePreviousFactory;
     EventTableIndexService              = eventTableIndexService;
     PatternNodeFactory                  = patternNodeFactory;
     FilterBooleanExpressionFactory      = filterBooleanExpressionFactory;
     TimeSourceService                   = timeSourceService;
     EngineImportService                 = engineImportService;
     AggregationFactoryFactory           = aggregationFactoryFactory;
     SchedulingService                   = schedulingService;
     ExprDeclaredService                 = exprDeclaredService;
 }
Example #15
0
        private bool ReadFromAppConfig(out string result)
        {
            result = string.Empty;

            try
            {
                configurationInformation = new ConfigurationInformation();

                configurationInformation.JsonFileName = ConfigurationManager.AppSettings["JsonFileName"];
                if (string.IsNullOrEmpty(configurationInformation.JsonFileName))
                {
                    result = " 'JsonFileName' אינו מוגדר";

                    return(false);
                }

                string LogToFileString = ConfigurationManager.AppSettings["LogToFile"];
                if (string.IsNullOrEmpty(LogToFileString))
                {
                    result = " 'LogToFile' אינו מוגדר";

                    return(false);
                }

                bool logToFile;
                configurationInformation.LogToFile = bool.TryParse(LogToFileString, out logToFile) ? logToFile : false;

                configurationInformation.LogFilePath = ConfigurationManager.AppSettings["LogFilePath"];
                if (string.IsNullOrEmpty(configurationInformation.LogFilePath))
                {
                    configurationInformation.LogFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                }

                configurationInformation.JsonFilePath = ConfigurationManager.AppSettings["JsonFilePath"];
                if (string.IsNullOrEmpty(configurationInformation.JsonFilePath))
                {
                    configurationInformation.JsonFilePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                }

                locationServiceInformation                    = new LocationServiceInformation();
                locationServiceInformation.Country            = ConfigurationManager.AppSettings["LocationServiceCountry"];
                locationServiceInformation.City               = ConfigurationManager.AppSettings["LocationServiceCity"];
                locationServiceInformation.BingKey            = ConfigurationManager.AppSettings["LocationServiceBingKey"];
                locationServiceInformation.LocationServiceUrl = ConfigurationManager.AppSettings["LocationServiceUrl"];

                PingTestAddress = ConfigurationManager.AppSettings["PingTestAddress"];
                string pingTestIntervalInSecondsString = ConfigurationManager.AppSettings["PingTestIntervalInSeconds"];
                PingTestIntervalInSeconds = int.TryParse(pingTestIntervalInSecondsString, out PingTestIntervalInSeconds) ? PingTestIntervalInSeconds : Constants.DEFAULT_PING_INTERVAL_IN_SECONDS;

                return(true);
            }
            catch (Exception e)
            {
                result = e.Message;

                return(false);
            }
        }
Example #16
0
 /// <summary>Makes the time source provider. </summary>
 /// <param name="configSnapshot">the configuration</param>
 /// <returns>time source provider</returns>
 internal static TimeSourceService MakeTimeSource(ConfigurationInformation configSnapshot)
 {
     if (configSnapshot.EngineDefaults.TimeSourceConfig.TimeSourceType == ConfigurationEngineDefaults.TimeSourceType.NANO)
     {
         // this is a static variable to keep overhead down for getting a current time
         TimeSourceServiceImpl.IS_SYSTEM_CURRENT_TIME = false;
     }
     return(new TimeSourceServiceImpl());
 }
Example #17
0
        protected override Boolean ValidateConfiguration(
            ConfigurationInformation <NuGetRestoreConfiguration> info
            )
        {
            var config         = info.Configuration;
            var isMultiPackage = String.IsNullOrEmpty(config.PackageID);

            return(isMultiPackage ^ config.PackageIDs.IsNullOrEmpty() &&
                   (isMultiPackage ? String.IsNullOrEmpty(config.PackageVersion) : config.PackageVersions.IsNullOrEmpty()));
        }
        /// <summary>
        /// Validate the view.
        /// </summary>
        /// <param name="engineImportService">The engine import service.</param>
        /// <param name="streamTypeService">supplies the types of streams against which to validate</param>
        /// <param name="methodResolutionService">for resolving imports and classes and methods</param>
        /// <param name="timeProvider">for providing current time</param>
        /// <param name="variableService">for access to variables</param>
        /// <param name="tableService"></param>
        /// <param name="scriptingService">The scripting service.</param>
        /// <param name="exprEvaluatorContext">The expression evaluator context.</param>
        /// <param name="configSnapshot">The config snapshot.</param>
        /// <param name="schedulingService">The scheduling service.</param>
        /// <param name="engineURI">The engine URI.</param>
        /// <param name="sqlParameters">The SQL parameters.</param>
        /// <param name="eventAdapterService">The event adapter service.</param>
        /// <param name="statementName">Name of the statement.</param>
        /// <param name="statementId">The statement id.</param>
        /// <param name="annotations">The annotations.</param>
        /// <throws>  ExprValidationException is thrown to indicate an exception in validating the view </throws>
        public void Validate(
            EngineImportService engineImportService,
            StreamTypeService streamTypeService,
            MethodResolutionService methodResolutionService,
            TimeProvider timeProvider,
            VariableService variableService,
            TableService tableService,
            ScriptingService scriptingService,
            ExprEvaluatorContext exprEvaluatorContext,
            ConfigurationInformation configSnapshot,
            SchedulingService schedulingService,
            string engineURI,
            IDictionary <int, IList <ExprNode> > sqlParameters,
            EventAdapterService eventAdapterService,
            string statementName,
            string statementId,
            Attribute[] annotations)
        {
            _evaluators           = new ExprEvaluator[_inputParameters.Count];
            _subordinateStreams   = new SortedSet <int>();
            _exprEvaluatorContext = exprEvaluatorContext;

            int count             = 0;
            var validationContext = new ExprValidationContext(
                streamTypeService, methodResolutionService, null, timeProvider, variableService, tableService,
                exprEvaluatorContext, eventAdapterService, statementName, statementId, annotations, null, scriptingService,
                false, false, true, false, null, false);

            foreach (string inputParam in _inputParameters)
            {
                ExprNode raw = FindSQLExpressionNode(_myStreamNumber, count, sqlParameters);
                if (raw == null)
                {
                    throw new ExprValidationException(
                              "Internal error find expression for historical stream parameter " + count + " stream " +
                              _myStreamNumber);
                }
                ExprNode evaluator = ExprNodeUtility.GetValidatedSubtree(ExprNodeOrigin.DATABASEPOLL, raw, validationContext);
                _evaluators[count++] = evaluator.ExprEvaluator;

                ExprNodeIdentifierCollectVisitor visitor = new ExprNodeIdentifierCollectVisitor();
                visitor.Visit(evaluator);
                foreach (ExprIdentNode identNode in visitor.ExprProperties)
                {
                    if (identNode.StreamId == _myStreamNumber)
                    {
                        throw new ExprValidationException("Invalid expression '" + inputParam +
                                                          "' resolves to the historical data itself");
                    }
                    _subordinateStreams.Add(identNode.StreamId);
                }
            }
        }
        /// <summary>Constructs the auto import service. </summary>
        /// <param name="configSnapshot">config info</param>
        /// <returns>service</returns>
        internal static EngineImportService MakeEngineImportService(
            ConfigurationInformation configSnapshot,
            AggregationFactoryFactory aggregationFactoryFactory)
        {
            var expression          = configSnapshot.EngineDefaults.ExpressionConfig;
            var engineImportService = new EngineImportServiceImpl(
                expression.IsExtendedAggregation,
                expression.IsUdfCache,
                expression.IsDuckTyping,
                configSnapshot.EngineDefaults.LanguageConfig.IsSortUsingCollator,
                expression.MathContext,
                expression.TimeZone,
                configSnapshot.EngineDefaults.ExecutionConfig.ThreadingProfile,
                aggregationFactoryFactory);

            engineImportService.AddMethodRefs(configSnapshot.MethodInvocationReferences);

            // Add auto-imports
            try
            {
                foreach (var importName in configSnapshot.Imports)
                {
                    engineImportService.AddImport(importName);
                }

                foreach (var importName in configSnapshot.AnnotationImports)
                {
                    engineImportService.AddAnnotationImport(importName);
                }

                foreach (ConfigurationPlugInAggregationFunction config in configSnapshot.PlugInAggregationFunctions)
                {
                    engineImportService.AddAggregation(config.Name, config);
                }

                foreach (ConfigurationPlugInAggregationMultiFunction config in configSnapshot.PlugInAggregationMultiFunctions)
                {
                    engineImportService.AddAggregationMultiFunction(config);
                }

                foreach (ConfigurationPlugInSingleRowFunction config in configSnapshot.PlugInSingleRowFunctions)
                {
                    engineImportService.AddSingleRow(config.Name, config.FunctionClassName, config.FunctionMethodName, config.ValueCache, config.FilterOptimizable, config.RethrowExceptions);
                }
            }
            catch (EngineImportException ex)
            {
                throw new ConfigurationException("Error configuring engine: " + ex.Message, ex);
            }

            return(engineImportService);
        }
Example #20
0
        public static ExprTimePeriod TimePeriodGetExprJustSeconds(
            EsperEPL2GrammarParser.ExpressionContext expression,
            IDictionary <ITree, ExprNode> astExprNodeMap,
            ConfigurationInformation config,
            TimeAbacus timeAbacus)
        {
            var node     = ExprCollectSubNodes(expression, 0, astExprNodeMap)[0];
            var timeNode = new ExprTimePeriodImpl(
                config.EngineDefaults.Expression.TimeZone,
                false, false, false, false, false, false, true, false, false, timeAbacus);

            timeNode.AddChildNode(node);
            return(timeNode);
        }
Example #21
0
        /// <summary>
        /// Constructor - initializes services.
        /// </summary>
        /// <param name="configuration">is the engine configuration</param>
        /// <param name="engineURI">is the engine URI or "default" (or null which it assumes as "default") if this is the default provider</param>
        /// <param name="runtimes">map of URI and runtime</param>
        /// <exception cref="ConfigurationException">is thrown to indicate a configuraton error</exception>
        public EPServiceProviderImpl(
            Configuration configuration,
            string engineURI,
            IDictionary <string, EPServiceProviderSPI> runtimes)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration), "Unexpected null value received for configuration");
            }

            _runtimes  = runtimes;
            _engineURI = engineURI ?? throw new ArgumentNullException(nameof(engineURI), "Engine URI should not be null at this stage");
            VerifyConfiguration(configuration);

            _configSnapshot = TakeSnapshot(configuration);
            DoInitialize(null);
        }
Example #22
0
        /// <summary>Constructor - initializes services. </summary>
        /// <param name="configuration">is the engine configuration</param>
        /// <param name="engineURI">is the engine URI or "default" (or null which it assumes as "default") if this is the default provider</param>
        /// <param name="runtimes">map of URI and runtime</param>
        /// <throws>ConfigurationException is thrown to indicate a configuraton error</throws>
        public EPServiceProviderImpl(Configuration configuration, String engineURI, IDictionary <String, EPServiceProviderSPI> runtimes)
        {
            if (configuration == null)
            {
                throw new NullReferenceException("Unexpected null value received for configuration");
            }
            if (engineURI == null)
            {
                throw new NullReferenceException("Engine URI should not be null at this stage");
            }
            _runtimes = runtimes;
            URI       = engineURI;
            VerifyConfiguration(configuration);

            _configSnapshot = TakeSnapshot(configuration);
            DoInitialize(null);
        }
Example #23
0
        /// <summary>Creates the database config service. </summary>
        /// <param name="configSnapshot">is the config snapshot</param>
        /// <param name="schedulingService">is the timer stuff</param>
        /// <param name="schedulingMgmtService">for statement schedule management</param>
        /// <returns>database config svc</returns>
        internal static DatabaseConfigService MakeDatabaseRefService(ConfigurationInformation configSnapshot,
                                                                     SchedulingService schedulingService,
                                                                     SchedulingMgmtService schedulingMgmtService)
        {
            DatabaseConfigService databaseConfigService;

            // Add auto-imports
            try
            {
                ScheduleBucket allStatementsBucket = schedulingMgmtService.AllocateBucket();
                databaseConfigService = new DatabaseConfigServiceImpl(configSnapshot.DatabaseReferences, schedulingService, allStatementsBucket);
            }
            catch (ArgumentException ex)
            {
                throw new ConfigurationException("Error configuring engine: " + ex.Message, ex);
            }

            return(databaseConfigService);
        }
Example #24
0
        protected override async Task <Int32> UseRestorerAsync(
            ConfigurationInformation <NuGetRestoreConfiguration> info,
            CancellationToken token,
            BoundRestoreCommandUser restorer,
            String sdkPackageID,
            String sdkPackageVersion
            )
        {
            if (!info.Configuration.SkipRestoringSDKPackage)
            {
                await restorer.RestoreIfNeeded(sdkPackageID, sdkPackageVersion, token);
            }

            var config          = info.Configuration;
            var packageID       = config.PackageID;
            var packageVersions = config.PackageVersions;
            await restorer.RestoreIfNeeded(
                token,
                String.IsNullOrEmpty( packageID )?
                config.PackageIDs.Select((pID, idx) => (pID, packageVersions.GetElementOrDefault(idx))).ToArray() :
                    new[] { (packageID, config.PackageVersion) }
Example #25
0
        protected override async Task <Int32> UseRestorerAsync(
            ConfigurationInformation <NuGetExecutionConfigurationImpl> info,
            CancellationToken token,
            BoundRestoreCommandUser restorer,
            String sdkPackageID,
            String sdkPackageVersion
            )
        {
            var config      = info.Configuration;
            var maybeResult = await config.ExecuteMethodAndSerializeReturnValue(
                token,
                restorer,
                info.GetAdditonalTypeProvider(config.ProcessArguments),
                sdkPackageID,
                sdkPackageVersion
                );

            return(maybeResult.IsFirst ?
                   (maybeResult.First is Int32 actualInt ? actualInt : 0)
            : -3);
        }
Example #26
0
 public FilterSpecCompilerArgs(
     IContainer container,
     IDictionary<string, Pair<EventType, string>> taggedEventTypes,
     IDictionary<string, Pair<EventType, string>> arrayEventTypes,
     ExprEvaluatorContext exprEvaluatorContext,
     string statementName,
     int statementId,
     StreamTypeService streamTypeService,
     EngineImportService engineImportService,
     TimeProvider timeProvider,
     VariableService variableService,
     TableService tableService,
     EventAdapterService eventAdapterService,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     ScriptingService scriptingService,
     Attribute[] annotations,
     ContextDescriptor contextDescriptor,
     ConfigurationInformation configurationInformation,
     StatementExtensionSvcContext statementExtensionSvcContext)
 {
     Container = container;
     TaggedEventTypes = taggedEventTypes;
     ArrayEventTypes = arrayEventTypes;
     ExprEvaluatorContext = exprEvaluatorContext;
     StatementName = statementName;
     StatementId = statementId;
     StreamTypeService = streamTypeService;
     EngineImportService = engineImportService;
     TimeProvider = timeProvider;
     VariableService = variableService;
     TableService = tableService;
     EventAdapterService = eventAdapterService;
     FilterBooleanExpressionFactory = filterBooleanExpressionFactory;
     ScriptingService = scriptingService;
     Annotations = annotations;
     ContextDescriptor = contextDescriptor;
     ConfigurationInformation = configurationInformation;
     StatementExtensionSvcContext = statementExtensionSvcContext;
 }
Example #27
0
        protected override async Task <Int32> UseRestorerInParallelWithCancellationWatchingAsync(
            ConfigurationInformation <TConfiguration> info,
            CancellationToken token,
            BoundRestoreCommandUser restorer,
            String sdkPackageID,
            String sdkPackageVersion
            )
        {
            var config = info.Configuration;

            await WriteEnvironmentInformationToFileAsync(
                config.DiscoverFilePath,
                new EnvironmentInspector(
                    config.PackageID,
                    config.PackageVersion,
                    config.PackageIDIsSelf,
                    config.ProjectFilePath
                    ).InspectEnvironment(restorer, sdkPackageID, sdkPackageVersion)
                );

            return(0);
        }
Example #28
0
        protected override async Task <Int32> UseRestorerInParallelWithCancellationWatchingAsync(
            ConfigurationInformation <TConfiguration> info,
            CancellationToken token,
            BoundRestoreCommandUser restorer,
            String sdkPackageID,
            String sdkPackageVersion
            )
        {
            var config = info.Configuration;

            // Call WriteMethodInformationToFileAsync *inside* lambda, *before* the assembly loade is disposed.
            await config.FindMethodForExecutingWithinNuGetAssemblyAsync(
                token,
                restorer,
                async ( assemblyLoader, theAssembly, suitableMethod ) =>
            {
                await WriteMethodInformationToFileAsync(
                    token,
                    restorer,
                    config.PackageID,
                    config.PackageVersion,
                    config.InspectFilePath,
                    theAssembly
                    );

                return((Object)null);
            },
#if NET46
                null
#else
                sdkPackageID,
                sdkPackageVersion
#endif
                , getFiles : restorer.ThisFramework.CreateMSBuildExecGetFilesDelegate()
                );

            return(0);
        }
Example #29
0
        protected override async Task <Int32> UseRestorerAsync(
            ConfigurationInformation <NuGetDeploymentConfigurationImpl> info,
            CancellationToken token,
            BoundRestoreCommandUser restorer,
            String sdkPackageID,
            String sdkPackageVersion
            )
        {
            (var epAssembly, var packageFramework) = await info.Configuration.DeployAsync(
                restorer,
                token,
                sdkPackageID,
                sdkPackageVersion
                );

            if (!String.IsNullOrEmpty(epAssembly) && packageFramework != null)
            {
                restorer.NuGetLogger.Log(NuGet.Common.LogLevel.Information, $"Deployed assembly to {epAssembly} (package framework is {packageFramework}).");
            }


            return(0);
        }
Example #30
0
 public StatementContextEngineServices(
     String engineURI,
     EventAdapterService eventAdapterService,
     NamedWindowService namedWindowService,
     VariableService variableService,
     TableService tableService,
     EngineSettingsService engineSettingsService,
     ValueAddEventService valueAddEventService,
     ConfigurationInformation configSnapshot,
     MetricReportingServiceSPI metricReportingService,
     ViewService viewService,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     StatementEventTypeRef statementEventTypeRef,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     EngineLevelExtensionServicesContext engineLevelExtensionServicesContext,
     RegexHandlerFactory regexHandlerFactory,
     StatementLockFactory statementLockFactory)
 {
     EngineURI                           = engineURI;
     EventAdapterService                 = eventAdapterService;
     NamedWindowService                  = namedWindowService;
     VariableService                     = variableService;
     TableService                        = tableService;
     _engineSettingsService              = engineSettingsService;
     ValueAddEventService                = valueAddEventService;
     ConfigSnapshot                      = configSnapshot;
     MetricReportingService              = metricReportingService;
     ViewService                         = viewService;
     ExceptionHandlingService            = exceptionHandlingService;
     ExpressionResultCacheService        = expressionResultCacheService;
     StatementEventTypeRef               = statementEventTypeRef;
     TableExprEvaluatorContext           = tableExprEvaluatorContext;
     EngineLevelExtensionServicesContext = engineLevelExtensionServicesContext;
     RegexHandlerFactory                 = regexHandlerFactory;
     StatementLockFactory                = statementLockFactory;
 }