示例#1
0
  public void open(DataFlowOpOpenContext openContext) {
    FilterValueSet valueSet;
    try {
      List<ExprNode> filters = Collections.emptyList();
      if (filter != null) {
        filters = Collections.singletonList(filter);
      }
      FilterSpecCompiled spec =
          FilterSpecCompiler.makeFilterSpec(
              eventType,
              eventType.getName(),
              filters,
              null,
              null,
              null,
              new StreamTypeServiceImpl(
                  eventType, eventType.getName(), true, agentInstanceContext.getEngineURI()),
              null,
              agentInstanceContext.getStatementContext(),
              new ArrayList<Integer>());
      valueSet = spec.getValueSet(null, agentInstanceContext, null);
    } catch (ExprValidationException ex) {
      throw new EPException("Failed to open filter: " + ex.getMessage(), ex);
    }

    EPStatementAgentInstanceHandle handle =
        new EPStatementAgentInstanceHandle(
            agentInstanceContext.getStatementContext().getEpStatementHandle(),
            agentInstanceContext.getAgentInstanceLock(),
            0,
            new StatementAgentInstanceFilterVersion());
    callbackHandle = new EPStatementHandleCallback(handle, this);
    agentInstanceContext.getStatementContext().getFilterService().add(valueSet, callbackHandle);
  }
  public AggregationService makeService(
      AgentInstanceContext agentInstanceContext, MethodResolutionService methodResolutionService) {

    AggregationMethod[] aggregatorsAgentInstance =
        methodResolutionService.newAggregators(
            super.aggregators, agentInstanceContext.getAgentInstanceId());
    return new AggSvcGroupAllNoAccessImpl(evaluators, aggregatorsAgentInstance);
  }
示例#3
0
 public synchronized void close(DataFlowOpCloseContext openContext) {
   if (callbackHandle != null) {
     agentInstanceContext.getStatementContext().getFilterService().remove(callbackHandle);
     callbackHandle = null;
   }
 }
示例#4
0
 public String getStatementId() {
   return agentInstanceContext.getStatementId();
 }
  public StatementAgentInstanceFactoryOnTriggerResult newContext(
      final AgentInstanceContext agentInstanceContext, boolean isRecoveringResilient) {
    List<StopCallback> stopCallbacks = new ArrayList<StopCallback>();
    View view;
    Map<ExprSubselectNode, SubSelectStrategyHolder> subselectStrategies;
    AggregationService aggregationService;
    EvalRootState optPatternRoot;
    Map<ExprTableAccessNode, ExprTableAccessEvalStrategy> tableAccessStrategies;
    final ViewableActivationResult activationResult;

    try {
      if (services.getSchedulableAgentInstanceDirectory() != null) {
        services
            .getSchedulableAgentInstanceDirectory()
            .add(agentInstanceContext.getEpStatementAgentInstanceHandle());
      }

      OnExprViewResult onExprViewResult = determineOnExprView(agentInstanceContext, stopCallbacks);
      view = onExprViewResult.getOnExprView();
      aggregationService = onExprViewResult.getOptionalAggregationService();

      // attach stream to view
      activationResult = activator.activate(agentInstanceContext, false, isRecoveringResilient);
      activationResult.getViewable().addView(view);
      stopCallbacks.add(activationResult.getStopCallback());
      optPatternRoot = activationResult.getOptionalPatternRoot();

      // determine final output view
      view = determineFinalOutputView(agentInstanceContext, view);

      // start subselects
      subselectStrategies =
          EPStatementStartMethodHelperSubselect.startSubselects(
              services, subSelectStrategyCollection, agentInstanceContext, stopCallbacks);

      // plan table access
      tableAccessStrategies =
          EPStatementStartMethodHelperTableAccess.attachTableAccess(
              services, agentInstanceContext, statementSpec.getTableNodes());
    } catch (RuntimeException ex) {
      StopCallback stopCallback =
          StatementAgentInstanceUtil.getStopCallback(stopCallbacks, agentInstanceContext);
      StatementAgentInstanceUtil.stopSafe(stopCallback, statementContext);
      throw ex;
    }

    StatementAgentInstanceFactoryOnTriggerResult onTriggerResult =
        new StatementAgentInstanceFactoryOnTriggerResult(
            view,
            null,
            agentInstanceContext,
            aggregationService,
            subselectStrategies,
            optPatternRoot,
            tableAccessStrategies,
            activationResult);
    if (statementContext.getStatementExtensionServicesContext() != null) {
      statementContext
          .getStatementExtensionServicesContext()
          .contributeStopCallback(onTriggerResult, stopCallbacks);
    }

    log.debug(".start Statement start completed");
    StopCallback stopCallback =
        StatementAgentInstanceUtil.getStopCallback(stopCallbacks, agentInstanceContext);
    onTriggerResult.setStopCallback(stopCallback);

    return onTriggerResult;
  }