Beispiel #1
0
        private NamedWindowOnMergeActionIns SetupInsert(string namedWindowName, InternalEventRouter internalEventRouter, EventTypeSPI eventTypeNamedWindow, int selectClauseNumber, OnTriggerMergeActionInsert desc, EventType triggeringEventType, string triggeringStreamName, StatementContext statementContext)
        {
            // Compile insert-into INFO
            string streamName     = desc.OptionalStreamName ?? eventTypeNamedWindow.Name;
            var    insertIntoDesc = InsertIntoDesc.FromColumns(streamName, desc.Columns);

            // rewrite any wildcards to use "stream.wildcard"
            if (triggeringStreamName == null)
            {
                triggeringStreamName = UuidGenerator.Generate();
            }
            var selectNoWildcard = CompileSelectNoWildcard(triggeringStreamName, desc.SelectClauseCompiled);

            // Set up event types for select-clause evaluation: The first type does not contain anything as its the named window row which is not present for insert
            var dummyTypeNoProperties = new MapEventType(EventTypeMetadata.CreateAnonymous("merge_named_window_insert", ApplicationType.MAP), "merge_named_window_insert", 0, null, Collections.EmptyDataMap, null, null, null);
            var eventTypes            = new EventType[] { dummyTypeNoProperties, triggeringEventType };
            var streamNames           = new string[] { UuidGenerator.Generate(), triggeringStreamName };
            var streamTypeService     = new StreamTypeServiceImpl(eventTypes, streamNames, new bool[1], statementContext.EngineURI, false);

            // Get select expr processor
            var selectExprEventTypeRegistry = new SelectExprEventTypeRegistry(statementContext.StatementName, statementContext.StatementEventTypeRef);
            var exprEvaluatorContext        = new ExprEvaluatorContextStatement(statementContext, false);
            var insertHelper = SelectExprProcessorFactory.GetProcessor(
                statementContext.Container,
                Collections.SingletonList(selectClauseNumber),
                selectNoWildcard.ToArray(), false,
                insertIntoDesc, null, null, streamTypeService,
                statementContext.EventAdapterService,
                statementContext.StatementResultService,
                statementContext.ValueAddEventService,
                selectExprEventTypeRegistry,
                statementContext.EngineImportService,
                exprEvaluatorContext,
                statementContext.VariableService,
                statementContext.ScriptingService,
                statementContext.TableService,
                statementContext.TimeProvider,
                statementContext.EngineURI,
                statementContext.StatementId,
                statementContext.StatementName,
                statementContext.Annotations,
                statementContext.ContextDescriptor,
                statementContext.ConfigSnapshot, null,
                statementContext.NamedWindowMgmtService, null, null,
                statementContext.StatementExtensionServicesContext);
            var filterEval = desc.OptionalWhereClause == null ? null : desc.OptionalWhereClause.ExprEvaluator;

            var routerToUser = streamName.Equals(namedWindowName) ? null : internalEventRouter;
            var audit        = AuditEnum.INSERT.GetAudit(statementContext.Annotations) != null;

            string insertIntoTableName = null;

            if (statementContext.TableService.GetTableMetadata(insertIntoDesc.EventTypeName) != null)
            {
                insertIntoTableName = insertIntoDesc.EventTypeName;
            }

            return(new NamedWindowOnMergeActionIns(filterEval, insertHelper, routerToUser, insertIntoTableName, statementContext.TableService, statementContext.EpStatementHandle, statementContext.InternalEventEngineRouteDest, audit));
        }
Beispiel #2
0
        public static ObjectArrayEventType MakeTransientOAType(string enumMethod, string propertyName, Type type, EventAdapterService eventAdapterService)
        {
            var propsResult = new Dictionary <string, object>();

            propsResult.Put(propertyName, type);
            var typeName = enumMethod + "__" + propertyName;

            return(new ObjectArrayEventType(EventTypeMetadata.CreateAnonymous(typeName), typeName, 0, eventAdapterService, propsResult, null, null, null));
        }
Beispiel #3
0
        static ExcludePlanHintExprUtil()
        {
            var properties = new LinkedHashMap <String, Object>();

            properties.Put("from_streamnum", typeof(int));
            properties.Put("to_streamnum", typeof(int));
            properties.Put("from_streamname", typeof(String));
            properties.Put("to_streamname", typeof(String));
            properties.Put("opname", typeof(String));
            properties.Put("exprs", typeof(String[]));
            OAEXPRESSIONTYPE = new ObjectArrayEventType(EventTypeMetadata.CreateAnonymous(typeof(ExcludePlanHintExprUtil).Name),
                                                        typeof(ExcludePlanHintExprUtil).Name, 0, null, properties, null, null, null);
        }
        static ExcludePlanHintExprUtil()
        {
            var properties = new Dictionary <string, Object>();

            properties.Put("from_streamnum", typeof(int));
            properties.Put("to_streamnum", typeof(int));
            properties.Put("from_streamname", typeof(string));
            properties.Put("to_streamname", typeof(string));
            properties.Put("opname", typeof(string));
            properties.Put("exprs", typeof(string[]));
            OAEXPRESSIONTYPE =
                new ObjectArrayEventType(
                    EventTypeMetadata.CreateAnonymous(typeof(ExcludePlanHintExprUtil).Name, ApplicationType.OBJECTARR),
                    typeof(ExcludePlanHintExprUtil).Name, 0, null, properties, null, null, null);
        }
        private static ObjectArrayEventType CreateExpressionTypeInstance(IContainer container)
        {
            var properties = new Dictionary <string, Object>();

            properties.Put("from_streamnum", typeof(int));
            properties.Put("to_streamnum", typeof(int));
            properties.Put("from_streamname", typeof(string));
            properties.Put("to_streamname", typeof(string));
            properties.Put("opname", typeof(string));
            properties.Put("exprs", typeof(string[]));
            var eventAdapterService = container.Resolve <EventAdapterService>();

            return(new ObjectArrayEventType(
                       EventTypeMetadata.CreateAnonymous(typeof(ExcludePlanHintExprUtil).Name, ApplicationType.OBJECTARR),
                       typeof(ExcludePlanHintExprUtil).Name, 0, eventAdapterService, properties, null, null, null));
        }