public static TableOnViewFactory Make( TableMetadata tableMetadata, OnTriggerDesc onTriggerDesc, EventType filterEventType, string filterStreamName, StatementContext statementContext, StatementMetricHandle metricsHandle, bool isDistinct, InternalEventRouter internalEventRouter) { if (onTriggerDesc.OnTriggerType == OnTriggerType.ON_DELETE) { return(new TableOnDeleteViewFactory(statementContext.StatementResultService, tableMetadata)); } else if (onTriggerDesc.OnTriggerType == OnTriggerType.ON_SELECT) { EventBeanReader eventBeanReader = null; if (isDistinct) { eventBeanReader = tableMetadata.InternalEventType.GetReader(); } var windowDesc = (OnTriggerWindowDesc)onTriggerDesc; return(new TableOnSelectViewFactory( tableMetadata, internalEventRouter, statementContext.EpStatementHandle, eventBeanReader, isDistinct, statementContext.StatementResultService, statementContext.InternalEventEngineRouteDest, windowDesc.IsDeleteAndSelect)); } else if (onTriggerDesc.OnTriggerType == OnTriggerType.ON_UPDATE) { var updateDesc = (OnTriggerWindowUpdateDesc)onTriggerDesc; var updateHelper = EventBeanUpdateHelperFactory.Make( tableMetadata.TableName, (EventTypeSPI)tableMetadata.InternalEventType, updateDesc.Assignments, updateDesc.OptionalAsName, filterEventType, false); TableUpdateStrategy updateStrategy = statementContext.TableService.GetTableUpdateStrategy( tableMetadata, updateHelper, false); var onUpdateViewFactory = new TableOnUpdateViewFactory( statementContext.StatementResultService, tableMetadata, updateHelper, updateStrategy); statementContext.TableService.AddTableUpdateStrategyReceiver( tableMetadata, statementContext.StatementName, onUpdateViewFactory, updateHelper, false); return(onUpdateViewFactory); } else if (onTriggerDesc.OnTriggerType == OnTriggerType.ON_MERGE) { var onMergeTriggerDesc = (OnTriggerMergeDesc)onTriggerDesc; var onMergeHelper = new TableOnMergeHelper( statementContext, onMergeTriggerDesc, filterEventType, filterStreamName, internalEventRouter, tableMetadata); return(new TableOnMergeViewFactory( tableMetadata, onMergeHelper, statementContext.StatementResultService, metricsHandle, statementContext.MetricReportingService)); } else { throw new IllegalStateException("Unknown trigger type " + onTriggerDesc.OnTriggerType); } }
public TableOnMergeViewFactory( TableMetadata tableMetadata, TableOnMergeHelper onMergeHelper, StatementResultService statementResultService, StatementMetricHandle metricsHandle, MetricReportingServiceSPI metricReportingService) { TableMetadata = tableMetadata; OnMergeHelper = onMergeHelper; StatementResultService = statementResultService; MetricsHandle = metricsHandle; MetricReportingService = metricReportingService; }