当前位置: 首页>>代码示例>>Java>>正文


Java OutputProcessViewFactoryFactory类代码示例

本文整理汇总了Java中com.espertech.esper.epl.view.OutputProcessViewFactoryFactory的典型用法代码示例。如果您正苦于以下问题:Java OutputProcessViewFactoryFactory类的具体用法?Java OutputProcessViewFactoryFactory怎么用?Java OutputProcessViewFactoryFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OutputProcessViewFactoryFactory类属于com.espertech.esper.epl.view包,在下文中一共展示了OutputProcessViewFactoryFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newContextInternal

import com.espertech.esper.epl.view.OutputProcessViewFactoryFactory; //导入依赖的package包/类
public StatementAgentInstanceFactoryCreateVariableResult newContextInternal(final AgentInstanceContext agentInstanceContext, boolean isRecoveringResilient) {
    StopCallback stopCallback = new StopCallback() {
        public void stop() {
            services.getVariableService().deallocateVariableState(variableMetaData.getVariableName(), agentInstanceContext.getAgentInstanceId());
        }
    };
    services.getVariableService().allocateVariableState(variableMetaData.getVariableName(), agentInstanceContext.getAgentInstanceId(), statementContext.getStatementExtensionServicesContext(), isRecoveringResilient);

    final CreateVariableView createView = new CreateVariableView(statementContext.getStatementId(), services.getEventAdapterService(), services.getVariableService(), createDesc.getVariableName(), statementContext.getStatementResultService(), agentInstanceContext.getAgentInstanceId());

    services.getVariableService().registerCallback(createDesc.getVariableName(), agentInstanceContext.getAgentInstanceId(), createView);
    statementContext.getStatementStopService().addSubscriber(new StatementStopCallback() {
        public void statementStopped() {
            services.getVariableService().unregisterCallback(createDesc.getVariableName(), 0, createView);
        }
    });

    // Create result set processor, use wildcard selection
    statementSpec.getSelectClauseSpec().setSelectExprList(new SelectClauseElementWildcard());
    statementSpec.setSelectStreamDirEnum(SelectClauseStreamSelectorEnum.RSTREAM_ISTREAM_BOTH);
    StreamTypeService typeService = new StreamTypeServiceImpl(new EventType[]{createView.getEventType()}, new String[]{"create_variable"}, new boolean[]{true}, services.getEngineURI(), false, false);
    OutputProcessViewBase outputViewBase;
    try {
        ResultSetProcessorFactoryDesc resultSetProcessorPrototype = ResultSetProcessorFactoryFactory.getProcessorPrototype(
                statementSpec, statementContext, typeService, null, new boolean[0], true, ContextPropertyRegistryImpl.EMPTY_REGISTRY, null, services.getConfigSnapshot(), services.getResultSetProcessorHelperFactory(), false, false);
        ResultSetProcessor resultSetProcessor = EPStatementStartMethodHelperAssignExpr.getAssignResultSetProcessor(agentInstanceContext, resultSetProcessorPrototype, false, null, false);

        // Attach output view
        OutputProcessViewFactory outputViewFactory = OutputProcessViewFactoryFactory.make(statementSpec, services.getInternalEventRouter(), agentInstanceContext.getStatementContext(), resultSetProcessorPrototype.getResultEventType(), null, services.getTableService(), resultSetProcessorPrototype.getResultSetProcessorType(), services.getResultSetProcessorHelperFactory(), services.getStatementVariableRefService());
        outputViewBase = outputViewFactory.makeView(resultSetProcessor, agentInstanceContext);
        createView.addView(outputViewBase);
    } catch (ExprValidationException ex) {
        throw new EPException("Unexpected exception in create-variable context allocation: " + ex.getMessage(), ex);
    }

    return new StatementAgentInstanceFactoryCreateVariableResult(outputViewBase, stopCallback, agentInstanceContext);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:38,代码来源:StatementAgentInstanceFactoryCreateVariable.java

示例2: handleContextFactoryOnTriggerTable

import com.espertech.esper.epl.view.OutputProcessViewFactoryFactory; //导入依赖的package包/类
private ContextFactoryResult handleContextFactoryOnTriggerTable(StatementContext statementContext, EPServicesContext services, OnTriggerWindowDesc onTriggerDesc, String contextName, StreamSpecCompiled streamSpec, ActivatorResult activatorResult, ContextPropertyRegistry contextPropertyRegistry, SubSelectActivationCollection subSelectStreamDesc)
        throws ExprValidationException {
    TableMetadata metadata = services.getTableService().getTableMetadata(onTriggerDesc.getWindowName());

    // validate context
    validateOnExpressionContext(contextName, metadata.getContextName(), "Table '" + onTriggerDesc.getWindowName() + "'");

    InternalEventRouter routerService = null;
    if (statementSpec.getInsertIntoDesc() != null || onTriggerDesc instanceof OnTriggerMergeDesc) {
        routerService = services.getInternalEventRouter();
    }

    // validate expressions and plan subselects
    TriggerValidationPlanResult validationResult = validateOnTriggerPlan(services, statementContext, onTriggerDesc, metadata.getInternalEventType(), streamSpec, activatorResult, contextPropertyRegistry, subSelectStreamDesc, metadata.getTableName());

    // table on-action view factory
    TableOnViewFactory onExprFactory = TableOnViewFactoryFactory.make(metadata, onTriggerDesc, activatorResult.activatorResultEventType, streamSpec.getOptionalStreamName(),
            statementContext, statementContext.getEpStatementHandle().getMetricsHandle(), false, routerService);

    // For on-delete/set/update/merge, create an output processor that passes on as a wildcard the underlying event
    ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype = null;
    if ((statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_DELETE) ||
            (statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_UPDATE) ||
            (statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_MERGE)) {
        StatementSpecCompiled defaultSelectAllSpec = new StatementSpecCompiled();
        defaultSelectAllSpec.getSelectClauseSpec().setSelectExprList(new SelectClauseElementWildcard());
        // we'll be expecting public-type events as there is no copy op
        StreamTypeService streamTypeService = new StreamTypeServiceImpl(new EventType[]{metadata.getPublicEventType()}, new String[]{"trigger_stream"}, new boolean[]{true}, services.getEngineURI(), false, false);
        outputResultSetProcessorPrototype = ResultSetProcessorFactoryFactory.getProcessorPrototype(defaultSelectAllSpec, statementContext, streamTypeService, null, new boolean[0], true, contextPropertyRegistry, null, services.getConfigSnapshot(), services.getResultSetProcessorHelperFactory(), false, true);
    }

    EventType resultEventType = validationResult.resultSetProcessorPrototype.getResultEventType();
    OutputProcessViewFactory outputViewFactory = OutputProcessViewFactoryFactory.make(statementSpec, services.getInternalEventRouter(), statementContext, resultEventType, null, services.getTableService(), validationResult.resultSetProcessorPrototype.getResultSetProcessorType(), services.getResultSetProcessorHelperFactory(), services.getStatementVariableRefService());

    StatementAgentInstanceFactoryOnTriggerTable contextFactory = new StatementAgentInstanceFactoryOnTriggerTable(statementContext, statementSpec, services, activatorResult.activator, validationResult.getSubSelectStrategyCollection(), validationResult.getResultSetProcessorPrototype(), validationResult.validatedJoin, onExprFactory, activatorResult.activatorResultEventType, metadata, outputResultSetProcessorPrototype, outputViewFactory);

    return new ContextFactoryResult(contextFactory, validationResult.getSubSelectStrategyCollection(), validationResult.resultSetProcessorPrototype);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:39,代码来源:EPStatementStartMethodOnTrigger.java

示例3: handleContextFactoryOnTriggerNamedWindow

import com.espertech.esper.epl.view.OutputProcessViewFactoryFactory; //导入依赖的package包/类
private ContextFactoryResult handleContextFactoryOnTriggerNamedWindow(EPServicesContext services, StatementContext statementContext, OnTriggerWindowDesc onTriggerDesc, String contextName, StreamSpecCompiled streamSpec, ContextPropertyRegistry contextPropertyRegistry, SubSelectActivationCollection subSelectStreamDesc, ActivatorResult activatorResult, StreamSelector optionalStreamSelector, List<StopCallback> stopCallbacks)
        throws ExprValidationException {
    NamedWindowProcessor processor = services.getNamedWindowMgmtService().getProcessor(onTriggerDesc.getWindowName());

    // validate context
    validateOnExpressionContext(contextName, processor.getContextName(), "Named window '" + onTriggerDesc.getWindowName() + "'");

    EventType namedWindowType = processor.getNamedWindowType();
    services.getStatementEventTypeRefService().addReferences(statementContext.getStatementName(), new String[]{onTriggerDesc.getWindowName()});

    // validate expressions and plan subselects
    TriggerValidationPlanResult validationResult = validateOnTriggerPlan(services, statementContext, onTriggerDesc, namedWindowType, streamSpec, activatorResult, contextPropertyRegistry, subSelectStreamDesc, null);

    InternalEventRouter routerService = null;
    boolean addToFront = false;
    String optionalInsertIntoTableName = null;
    if (statementSpec.getInsertIntoDesc() != null || onTriggerDesc instanceof OnTriggerMergeDesc) {
        routerService = services.getInternalEventRouter();
    }
    if (statementSpec.getInsertIntoDesc() != null) {
        TableMetadata tableMetadata = services.getTableService().getTableMetadata(statementSpec.getInsertIntoDesc().getEventTypeName());
        if (tableMetadata != null) {
            optionalInsertIntoTableName = tableMetadata.getTableName();
            routerService = null;
        }
        addToFront = statementContext.getNamedWindowMgmtService().isNamedWindow(statementSpec.getInsertIntoDesc().getEventTypeName());
    }
    boolean isDistinct = statementSpec.getSelectClauseSpec().isDistinct();
    EventType selectResultEventType = validationResult.resultSetProcessorPrototype.getResultEventType();
    StatementMetricHandle createNamedWindowMetricsHandle = processor.getCreateNamedWindowMetricsHandle();

    NamedWindowOnExprFactory onExprFactory = NamedWindowOnExprFactoryFactory.make(namedWindowType, onTriggerDesc.getWindowName(), validationResult.zeroStreamAliasName,
            onTriggerDesc,
            activatorResult.activatorResultEventType, streamSpec.getOptionalStreamName(), addToFront, routerService,
            selectResultEventType,
            statementContext, createNamedWindowMetricsHandle, isDistinct, optionalStreamSelector, optionalInsertIntoTableName);

    // For on-delete/set/update/merge, create an output processor that passes on as a wildcard the underlying event
    ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype = null;
    if ((statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_DELETE) ||
            (statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_UPDATE) ||
            (statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_MERGE)) {
        StatementSpecCompiled defaultSelectAllSpec = new StatementSpecCompiled();
        defaultSelectAllSpec.getSelectClauseSpec().setSelectExprList(new SelectClauseElementWildcard());
        StreamTypeService streamTypeService = new StreamTypeServiceImpl(new EventType[]{namedWindowType}, new String[]{"trigger_stream"}, new boolean[]{true}, services.getEngineURI(), false, false);
        outputResultSetProcessorPrototype = ResultSetProcessorFactoryFactory.getProcessorPrototype(defaultSelectAllSpec, statementContext, streamTypeService, null, new boolean[0], true, contextPropertyRegistry, null, services.getConfigSnapshot(), services.getResultSetProcessorHelperFactory(), false, true);
    }

    EventType resultEventType = validationResult.resultSetProcessorPrototype.getResultEventType();
    OutputProcessViewFactory outputViewFactory = OutputProcessViewFactoryFactory.make(statementSpec, services.getInternalEventRouter(), statementContext, resultEventType, null, services.getTableService(), validationResult.resultSetProcessorPrototype.getResultSetProcessorType(), services.getResultSetProcessorHelperFactory(), services.getStatementVariableRefService());

    StatementAgentInstanceFactoryOnTriggerNamedWindow contextFactory = new StatementAgentInstanceFactoryOnTriggerNamedWindow(statementContext, statementSpec, services, activatorResult.activator, validationResult.subSelectStrategyCollection, validationResult.resultSetProcessorPrototype, validationResult.validatedJoin, outputResultSetProcessorPrototype, onExprFactory, outputViewFactory, activatorResult.activatorResultEventType, processor, stopCallbacks);
    return new ContextFactoryResult(contextFactory, validationResult.subSelectStrategyCollection, validationResult.resultSetProcessorPrototype);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:55,代码来源:EPStatementStartMethodOnTrigger.java


注:本文中的com.espertech.esper.epl.view.OutputProcessViewFactoryFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。