Ejemplo n.º 1
0
 public EPStatementObjectModel compileEPL(String eplStatement) throws EPException {
   StatementSpecRaw statementSpec =
       EPAdministratorHelper.compileEPL(
           eplStatement, eplStatement, true, null, services, defaultStreamSelector);
   StatementSpecUnMapResult unmapped = StatementSpecMapper.unmap(statementSpec);
   if (unmapped.getIndexedParams().size() != 0) {
     throw new EPException(SUBS_PARAM_INVALID_USE);
   }
   return unmapped.getObjectModel();
 }
Ejemplo n.º 2
0
 private EPStatement createPatternStmt(
     String expression, String statementName, Object userObject, String statementId)
     throws EPException {
   StatementSpecRaw rawPattern =
       EPAdministratorHelper.compilePattern(
           expression, expression, true, services, SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return services
       .getStatementLifecycleSvc()
       .createAndStart(
           rawPattern, expression, true, statementName, userObject, null, statementId, null);
 }
Ejemplo n.º 3
0
 public AnnotationPart compileAnnotationToSODA(String annotationExpression) {
   String toCompile = annotationExpression + " select * from java.lang.Object";
   StatementSpecRaw raw =
       EPAdministratorHelper.compileEPL(
           toCompile,
           annotationExpression,
           false,
           null,
           services,
           SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return StatementSpecMapper.unmap(raw.getAnnotations().get(0));
 }
Ejemplo n.º 4
0
 public ExprNode compileExpression(String expression) throws EPException {
   String toCompile = "select * from java.lang.Object.win:time(" + expression + ")";
   StatementSpecRaw raw =
       EPAdministratorHelper.compileEPL(
           toCompile,
           expression,
           false,
           null,
           services,
           SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return raw.getStreamSpecs().get(0).getViewSpecs().get(0).getObjectParameters().get(0);
 }
Ejemplo n.º 5
0
  public EPPreparedStatement prepareEPL(String eplExpression) throws EPException {
    // compile to specification
    StatementSpecRaw statementSpec =
        EPAdministratorHelper.compileEPL(
            eplExpression, eplExpression, true, null, services, defaultStreamSelector);

    // map to object model thus finding all substitution parameters and their indexes
    StatementSpecUnMapResult unmapped = StatementSpecMapper.unmap(statementSpec);

    // the prepared statement is the object model plus a list of substitution parameters
    // map to specification will refuse any substitution parameters that are unfilled
    return new EPPreparedStatementImpl(unmapped.getObjectModel(), unmapped.getIndexedParams());
  }
Ejemplo n.º 6
0
 public MatchRecognizeRegEx compileMatchRecognizePatternToSODA(
     String matchRecogPatternExpression) {
   String toCompile =
       "select * from java.lang.Object match_recognize(measures a.b as c pattern ("
           + matchRecogPatternExpression
           + ") define A as true)";
   StatementSpecRaw raw =
       EPAdministratorHelper.compileEPL(
           toCompile,
           matchRecogPatternExpression,
           false,
           null,
           services,
           SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return StatementSpecMapper.unmap(raw.getMatchRecognizeSpec().getPattern());
 }
Ejemplo n.º 7
0
  public EPPreparedStatement preparePattern(String patternExpression) throws EPException {
    StatementSpecRaw rawPattern =
        EPAdministratorHelper.compilePattern(
            patternExpression,
            patternExpression,
            true,
            services,
            SelectClauseStreamSelectorEnum.ISTREAM_ONLY);

    // map to object model thus finding all substitution parameters and their indexes
    StatementSpecUnMapResult unmapped = StatementSpecMapper.unmap(rawPattern);

    // the prepared statement is the object model plus a list of substitution parameters
    // map to specification will refuse any substitution parameters that are unfilled
    return new EPPreparedStatementImpl(unmapped.getObjectModel(), unmapped.getIndexedParams());
  }
Ejemplo n.º 8
0
  private EPStatement createEPLStmt(
      String eplStatement, String statementName, Object userObject, String statementId)
      throws EPException {
    StatementSpecRaw statementSpec =
        EPAdministratorHelper.compileEPL(
            eplStatement, eplStatement, true, statementName, services, defaultStreamSelector);
    EPStatement statement =
        services
            .getStatementLifecycleSvc()
            .createAndStart(
                statementSpec,
                eplStatement,
                false,
                statementName,
                userObject,
                null,
                statementId,
                null);

    log.debug(".createEPLStmt Statement created and started");
    return statement;
  }
Ejemplo n.º 9
0
 public EPStatementObjectModel compilePatternToSODAModel(String expression) throws EPException {
   StatementSpecRaw rawPattern =
       EPAdministratorHelper.compilePattern(
           expression, expression, true, services, SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return mapRawToSODA(rawPattern);
 }
Ejemplo n.º 10
0
 public EvalFactoryNode compilePatternToNode(String pattern) throws EPException {
   StatementSpecRaw raw =
       EPAdministratorHelper.compilePattern(
           pattern, pattern, false, services, SelectClauseStreamSelectorEnum.ISTREAM_ONLY);
   return ((PatternStreamSpecRaw) raw.getStreamSpecs().get(0)).getEvalFactoryNode();
 }
Ejemplo n.º 11
0
 public StatementSpecRaw compileEPLToRaw(String epl) {
   return EPAdministratorHelper.compileEPL(epl, epl, true, null, services, defaultStreamSelector);
 }