コード例 #1
0
        public Type ResolveDateTimeMethod(string name)
        {
            var dtm = _dateTimeMethods.Get(name);

            if (dtm == null)
            {
                dtm = _dateTimeMethods.Get(name.ToLowerInvariant());
            }

            if (dtm == null)
            {
                return(null);
            }

            Type clazz;

            try {
                clazz = ClassForNameProvider.ClassForName(dtm.ForgeClassName);
            }
            catch (TypeLoadException ex) {
                throw new ImportException("Could not load date-time-method forge class by name '" + dtm.ForgeClassName + "'", ex);
            }

            return(clazz);
        }
コード例 #2
0
        public Type ResolveEnumMethod(string name)
        {
            var enumMethod = _enumMethods.Get(name);

            if (enumMethod == null)
            {
                enumMethod = _enumMethods.Get(name.ToLowerInvariant());
            }

            if (enumMethod == null)
            {
                return(null);
            }

            Type clazz;

            try {
                clazz = ClassForNameProvider.ClassForName(enumMethod.ForgeClassName);
            }
            catch (TypeLoadException ex) {
                throw new ImportException("Could not load enum-method forge class by name '" + enumMethod.ForgeClassName + "'", ex);
            }

            return(clazz);
        }
コード例 #3
0
        public Pair <Type, ImportSingleRowDesc> ResolveSingleRow(
            string name,
            ExtensionSingleRow classpathExtensionSingleRow)
        {
            var inlined = classpathExtensionSingleRow.ResolveSingleRow(name);

            if (inlined != null)
            {
                return(inlined);
            }

            var pair = _singleRowFunctions.Get(name);

            if (pair == null)
            {
                pair = _singleRowFunctions.Get(name.ToLowerInvariant());
            }

            if (pair == null)
            {
                throw new ImportUndefinedException("A function named '" + name + "' is not defined");
            }

            Type clazz;

            try {
                clazz = ClassForNameProvider.ClassForName(pair.ClassName);
            }
            catch (TypeLoadException ex) {
                throw new ImportException("Could not load single-row function class by name '" + pair.ClassName + "'", ex);
            }

            return(new Pair <Type, ImportSingleRowDesc>(clazz, pair));
        }
コード例 #4
0
        protected static ExceptionHandlingService InitExceptionHandling(
            string runtimeURI,
            ConfigurationRuntimeExceptionHandling exceptionHandling,
            ConfigurationRuntimeConditionHandling conditionHandling,
            ClassForNameProvider classForNameProvider)
        {
            IList<ExceptionHandler> exceptionHandlers;
            if (exceptionHandling.HandlerFactories == null || exceptionHandling.HandlerFactories.IsEmpty()) {
                exceptionHandlers = new EmptyList<ExceptionHandler>();
            }
            else {
                exceptionHandlers = new List<ExceptionHandler>();
                var context = new ExceptionHandlerFactoryContext(runtimeURI);
                foreach (var className in exceptionHandling.HandlerFactories) {
                    try {
                        var factory = TypeHelper.Instantiate<ExceptionHandlerFactory>(
                            className, classForNameProvider);
                        var handler = factory.GetHandler(context);
                        if (handler == null) {
                            Log.Warn("Exception handler factory '" + className + "' returned a null handler, skipping factory");
                            continue;
                        }

                        exceptionHandlers.Add(handler);
                    }
                    catch (Exception ex) {
                        throw new ConfigurationException(
                            "Exception initializing exception handler from exception handler factory '" + className + "': " + ex.Message, ex);
                    }
                }
            }

            IList<ConditionHandler> conditionHandlers;
            if (conditionHandling.HandlerFactories == null || conditionHandling.HandlerFactories.IsEmpty()) {
                conditionHandlers = new EmptyList<ConditionHandler>();
            }
            else {
                conditionHandlers = new List<ConditionHandler>();
                var context = new ConditionHandlerFactoryContext(runtimeURI);
                foreach (var className in conditionHandling.HandlerFactories) {
                    try {
                        var factory = TypeHelper.Instantiate<ConditionHandlerFactory>(
                            className, classForNameProvider);
                        var handler = factory.GetHandler(context);
                        if (handler == null) {
                            Log.Warn("Condition handler factory '" + className + "' returned a null handler, skipping factory");
                            continue;
                        }

                        conditionHandlers.Add(handler);
                    }
                    catch (Exception ex) {
                        throw new ConfigurationException(
                            "Exception initializing exception handler from exception handler factory '" + className + "': " + ex.Message, ex);
                    }
                }
            }

            return new ExceptionHandlingService(runtimeURI, exceptionHandlers, conditionHandlers);
        }
コード例 #5
0
ファイル: ImportType.cs プロジェクト: lanicon/nesper
        public override Type Resolve(
            string providedTypeName,
            ClassForNameProvider classForNameProvider)
        {
            try {
                if (Namespace == null)
                {
                    if (providedTypeName == TypeName)
                    {
                        return(classForNameProvider.ClassForName(providedTypeName));
                    }
                }
                else
                {
                    if (providedTypeName == TypeNameBase)
                    {
                        return(classForNameProvider.ClassForName(TypeName));
                    }
                }
            }
            catch (TypeLoadException e) {
                if (Log.IsDebugEnabled)
                {
                    Log.Debug($"TypeLoadException while resolving typeName = '{providedTypeName}'", e);
                }

                return(null);
            }

            return(null);
        }
コード例 #6
0
        public AggregationFunctionForge ResolveAggregationFunction(
            string functionName,
            ExtensionAggregationFunction extension)
        {
            var inlined = extension.ResolveAggregationFunction(functionName);

            Type   forgeClass;
            string className;

            if (inlined != null)
            {
                forgeClass = inlined;
                className  = inlined.Name;
            }
            else
            {
                var desc = _aggregationFunctions.Get(functionName);
                if (desc == null)
                {
                    desc = _aggregationFunctions.Get(functionName.ToLowerInvariant());
                }

                if (desc == null || desc.ForgeClassName == null)
                {
                    throw new ImportUndefinedException("A function named '" + functionName + "' is not defined");
                }

                className = desc.ForgeClassName;
                try {
                    forgeClass = ClassForNameProvider.ClassForName(className);
                }
                catch (TypeLoadException ex) {
                    throw new ImportException("Could not load aggregation factory class by name '" + className + "'", ex);
                }
            }

            object @object;

            try {
                @object = TypeHelper.Instantiate(forgeClass);
            }
            catch (TypeLoadException e) {
                throw new ImportException(
                          "Error instantiating aggregation factory class by name '" + className + "'",
                          e);
            }
            catch (MemberAccessException e) {
                throw new ImportException(
                          "Illegal access instatiating aggregation factory class by name '" + className + "'",
                          e);
            }

            if (!(@object is AggregationFunctionForge))
            {
                throw new ImportException("Class by name '" + className + "' does not implement the " + typeof(AggregationFunctionForge).Name + " interface");
            }

            return((AggregationFunctionForge)@object);
        }
コード例 #7
0
 public override Type Resolve(
     string providedTypeName,
     ClassForNameProvider classForNameProvider)
 {
     return(BuiltinAnnotation.BUILTIN.Get(providedTypeName.ToLowerInvariant()));
 }
コード例 #8
0
ファイル: EPServicesContext.cs プロジェクト: lanicon/nesper
 public EPServicesContext(
     IContainer container,
     AggregationServiceFactoryService aggregationServiceFactoryService,
     BeanEventTypeFactoryPrivate beanEventTypeFactoryPrivate,
     BeanEventTypeStemService beanEventTypeStemService,
     ClassForNameProvider classForNameProvider,
     ParentClassLoader classLoaderParent,
     PathRegistry <string, ClassProvided> classProvidedPathRegistry,
     Configuration configSnapshot,
     ContextManagementService contextManagementService,
     PathRegistry <string, ContextMetaData> contextPathRegistry,
     ContextServiceFactory contextServiceFactory,
     EPDataFlowServiceImpl dataflowService,
     DataFlowFilterServiceAdapter dataFlowFilterServiceAdapter,
     DatabaseConfigServiceRuntime databaseConfigServiceRuntime,
     DeploymentLifecycleService deploymentLifecycleService,
     DispatchService dispatchService,
     RuntimeEnvContext runtimeEnvContext,
     RuntimeSettingsService runtimeSettingsService,
     string runtimeURI,
     ImportServiceRuntime importServiceRuntime,
     EPStatementFactory epStatementFactory,
     PathRegistry <string, ExpressionDeclItem> exprDeclaredPathRegistry,
     IReaderWriterLock eventProcessingRWLock,
     EPServicesHA epServicesHA,
     EPRuntimeSPI epRuntime,
     EventBeanService eventBeanService,
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     EPRenderEventServiceImpl eventRenderer,
     EventSerdeFactory eventSerdeFactory,
     EventTableIndexService eventTableIndexService,
     EventTypeAvroHandler eventTypeAvroHandler,
     EventTypeFactory eventTypeFactory,
     EventTypeIdResolver eventTypeIdResolver,
     PathRegistry <string, EventType> eventTypePathRegistry,
     EventTypeRepositoryImpl eventTypeRepositoryBus,
     EventTypeResolvingBeanFactory eventTypeResolvingBeanFactory,
     EventTypeSerdeRepository eventTypeSerdeRepository,
     ExceptionHandlingService exceptionHandlingService,
     ExpressionResultCacheService expressionResultCacheService,
     FilterBooleanExpressionFactory filterBooleanExpressionFactory,
     FilterServiceSPI filterService,
     FilterSharedBoolExprRepository filterSharedBoolExprRepository,
     FilterSharedLookupableRepository filterSharedLookupableRepository,
     HistoricalDataCacheFactory historicalDataCacheFactory,
     InternalEventRouterImpl internalEventRouter,
     MetricReportingService metricReportingService,
     MultiMatchHandlerFactory multiMatchHandlerFactory,
     NamedWindowConsumerManagementService namedWindowConsumerManagementService,
     NamedWindowDispatchService namedWindowDispatchService,
     NamedWindowFactoryService namedWindowFactoryService,
     NamedWindowManagementService namedWindowManagementService,
     PathRegistry <string, NamedWindowMetaData> namedWindowPathRegistry,
     PatternFactoryService patternFactoryService,
     PatternSubexpressionPoolRuntimeSvc patternSubexpressionPoolEngineSvc,
     ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
     RowRecogStateRepoFactory rowRecogStateRepoFactory,
     RowRecogStatePoolRuntimeSvc rowRecogStatePoolEngineSvc,
     SchedulingServiceSPI schedulingService,
     PathRegistry <NameAndParamNum, ExpressionScriptProvided> scriptPathRegistry,
     ScriptCompiler scriptCompiler,
     StageRecoveryService stageRecoveryService,
     StatementLifecycleService statementLifecycleService,
     StatementAgentInstanceLockFactory statementAgentInstanceLockFactory,
     StatementResourceHolderBuilder statementResourceHolderBuilder,
     TableExprEvaluatorContext tableExprEvaluatorContext,
     TableManagementService tableManagementService,
     PathRegistry <string, TableMetaData> tablePathRegistry,
     ThreadingService threadingService,
     TimeAbacus timeAbacus,
     TimeSourceService timeSourceService,
     TimerService timerService,
     VariableManagementService variableManagementService,
     PathRegistry <string, VariableMetaData> variablePathRegistry,
     ViewableActivatorFactory viewableActivatorFactory,
     ViewFactoryService viewFactoryService,
     ViewServicePreviousFactory viewServicePreviousFactory,
     XMLFragmentEventTypeFactory xmlFragmentEventTypeFactory)
 {
     _container = container;
     _aggregationServiceFactoryService = aggregationServiceFactoryService;
     _beanEventTypeFactoryPrivate      = beanEventTypeFactoryPrivate;
     _beanEventTypeStemService         = beanEventTypeStemService;
     _classForNameProvider             = classForNameProvider;
     _classLoaderParent            = classLoaderParent;
     _classProvidedPathRegistry    = classProvidedPathRegistry;
     _configSnapshot               = configSnapshot;
     _contextManagementService     = contextManagementService;
     _contextPathRegistry          = contextPathRegistry;
     _contextServiceFactory        = contextServiceFactory;
     _dataflowService              = dataflowService;
     _dataFlowFilterServiceAdapter = dataFlowFilterServiceAdapter;
     _databaseConfigServiceRuntime = databaseConfigServiceRuntime;
     _deploymentLifecycleService   = deploymentLifecycleService;
     _dispatchService              = dispatchService;
     _runtimeEnvContext            = runtimeEnvContext;
     _runtimeSettingsService       = runtimeSettingsService;
     _runtimeUri               = runtimeURI;
     _importServiceRuntime     = importServiceRuntime;
     _epStatementFactory       = epStatementFactory;
     _exprDeclaredPathRegistry = exprDeclaredPathRegistry;
     _eventProcessingRWLock    = eventProcessingRWLock;
     _epServicesHA             = epServicesHA;
     _epRuntime                            = epRuntime;
     _eventBeanService                     = eventBeanService;
     _eventBeanTypedEventFactory           = eventBeanTypedEventFactory;
     _eventRenderer                        = eventRenderer;
     _eventSerdeFactory                    = eventSerdeFactory;
     _eventTableIndexService               = eventTableIndexService;
     _eventTypeAvroHandler                 = eventTypeAvroHandler;
     _eventTypeFactory                     = eventTypeFactory;
     _eventTypeIdResolver                  = eventTypeIdResolver;
     _eventTypePathRegistry                = eventTypePathRegistry;
     _eventTypeRepositoryBus               = eventTypeRepositoryBus;
     _eventTypeResolvingBeanFactory        = eventTypeResolvingBeanFactory;
     _eventTypeSerdeRepository             = eventTypeSerdeRepository;
     _exceptionHandlingService             = exceptionHandlingService;
     _expressionResultCacheService         = expressionResultCacheService;
     _filterBooleanExpressionFactory       = filterBooleanExpressionFactory;
     _filterService                        = filterService;
     _filterSharedBoolExprRepository       = filterSharedBoolExprRepository;
     _filterSharedLookupableRepository     = filterSharedLookupableRepository;
     _historicalDataCacheFactory           = historicalDataCacheFactory;
     _internalEventRouter                  = internalEventRouter;
     _metricReportingService               = metricReportingService;
     _multiMatchHandlerFactory             = multiMatchHandlerFactory;
     _namedWindowConsumerManagementService = namedWindowConsumerManagementService;
     _namedWindowDispatchService           = namedWindowDispatchService;
     _namedWindowFactoryService            = namedWindowFactoryService;
     _namedWindowManagementService         = namedWindowManagementService;
     _namedWindowPathRegistry              = namedWindowPathRegistry;
     _patternFactoryService                = patternFactoryService;
     _patternSubexpressionPoolEngineSvc    = patternSubexpressionPoolEngineSvc;
     _resultSetProcessorHelperFactory      = resultSetProcessorHelperFactory;
     _rowRecogStateRepoFactory             = rowRecogStateRepoFactory;
     _rowRecogStatePoolEngineSvc           = rowRecogStatePoolEngineSvc;
     _schedulingService                    = schedulingService;
     _scriptPathRegistry                   = scriptPathRegistry;
     _stageRecoveryService                 = stageRecoveryService;
     _statementLifecycleService            = statementLifecycleService;
     _statementAgentInstanceLockFactory    = statementAgentInstanceLockFactory;
     _statementResourceHolderBuilder       = statementResourceHolderBuilder;
     _tableExprEvaluatorContext            = tableExprEvaluatorContext;
     _tableManagementService               = tableManagementService;
     _tablePathRegistry                    = tablePathRegistry;
     _threadingService                     = threadingService;
     _timeAbacus                           = timeAbacus;
     _timeSourceService                    = timeSourceService;
     _timerService                         = timerService;
     _variableManagementService            = variableManagementService;
     _variablePathRegistry                 = variablePathRegistry;
     _viewableActivatorFactory             = viewableActivatorFactory;
     _viewFactoryService                   = viewFactoryService;
     _viewServicePreviousFactory           = viewServicePreviousFactory;
     _xmlFragmentEventTypeFactory          = xmlFragmentEventTypeFactory;
     _scriptCompiler                       = scriptCompiler;
 }
コード例 #9
0
ファイル: Import.cs プロジェクト: hahanonym/nesper
 public abstract Type Resolve(
     string providedTypeName,
     ClassForNameProvider classForNameProvider);