Пример #1
0
 public boolean canProvideCapability(ViewCapability viewCapability) {
   for (ViewFactory viewFactory : viewFactories) {
     if (!viewFactory.canProvideCapability(viewCapability)) {
       return false;
     }
   }
   return viewCapability instanceof RemoveStreamViewCapability;
 }
Пример #2
0
 public View makeView(StatementContext statementContext) {
   boolean hasAsymetric = false;
   List<View> views = new ArrayList<View>();
   for (ViewFactory viewFactory : viewFactories) {
     views.add(viewFactory.makeView(statementContext));
     hasAsymetric |= viewFactory instanceof AsymetricDataWindowViewFactory;
   }
   if (hasAsymetric) {
     return new UnionAsymetricView(this, parentEventType, views);
   }
   return new UnionView(this, parentEventType, views);
 }
Пример #3
0
  public void setProvideCapability(
      ViewCapability viewCapability, ViewResourceCallback resourceCallback) {
    if (!canProvideCapability(viewCapability)) {
      throw new UnsupportedOperationException(
          "View capability " + viewCapability.getClass().getSimpleName() + " not supported");
    }

    if (viewCapability instanceof RemoveStreamViewCapability) {
      for (ViewFactory viewFactory : viewFactories) {
        viewFactory.setProvideCapability(viewCapability, resourceCallback);
      }
    }
  }
  public static PriorEventViewFactory getPriorEventViewFactory(
      StatementContext statementContext, int streamNum, int viewFactoryNum, boolean unboundStream) {
    try {
      String namespace = ViewEnum.PRIOR_EVENT_VIEW.getNamespace();
      String name = ViewEnum.PRIOR_EVENT_VIEW.getName();
      ViewFactory factory = statementContext.getViewResolutionService().create(namespace, name);

      ViewFactoryContext context =
          new ViewFactoryContext(statementContext, streamNum, viewFactoryNum, namespace, name);
      factory.setViewParameters(
          context, Arrays.asList((ExprNode) new ExprConstantNodeImpl(unboundStream)));

      return (PriorEventViewFactory) factory;
    } catch (ViewProcessingException ex) {
      String text = "Exception creating prior event view factory";
      throw new EPException(text, ex);
    } catch (ViewParameterException ex) {
      String text = "Exception creating prior event view factory";
      throw new EPException(text, ex);
    }
  }