예제 #1
0
  public EPStatement create(
      EPStatementObjectModel sodaStatement,
      String statementName,
      Object userObject,
      String statementId)
      throws EPException {
    // Specifies the statement
    StatementSpecRaw statementSpec = mapSODAToRaw(sodaStatement);
    String eplStatement = sodaStatement.toEPL();

    EPStatement statement =
        services
            .getStatementLifecycleSvc()
            .createAndStart(
                statementSpec,
                eplStatement,
                false,
                statementName,
                userObject,
                null,
                statementId,
                sodaStatement);

    log.debug(".createEPLStmt Statement created and started");
    return statement;
  }
예제 #2
0
  /**
   * Constructor - takes the services context as argument.
   *
   * @param adminContext - administrative context
   */
  public EPAdministratorImpl(EPAdministratorContext adminContext) {
    this.services = adminContext.getServices();
    this.configurationOperations = adminContext.getConfigurationOperations();
    this.defaultStreamSelector = adminContext.getDefaultStreamSelector();

    ConfigurationEngineDefaults.AlternativeContext alternativeContext =
        adminContext.getServices().getConfigSnapshot().getEngineDefaults().getAlternativeContext();
    StatementIdGenerator statementIdGenerator = null;
    if (alternativeContext != null && alternativeContext.getStatementIdGeneratorFactory() != null) {
      StatementIdGeneratorFactory statementIdGeneratorFactory =
          (StatementIdGeneratorFactory)
              JavaClassHelper.instantiate(
                  StatementIdGeneratorFactory.class,
                  alternativeContext.getStatementIdGeneratorFactory());
      statementIdGenerator =
          statementIdGeneratorFactory.create(
              new StatementIdGeneratorFactoryContext(services.getEngineURI()));
    }
    this.deploymentAdminService =
        new EPDeploymentAdminImpl(
            this,
            adminContext.getServices().getDeploymentStateService(),
            adminContext.getServices().getStatementEventTypeRefService(),
            adminContext.getServices().getEventAdapterService(),
            adminContext.getServices().getStatementIsolationService(),
            statementIdGenerator,
            adminContext.getServices().getFilterService());
  }
예제 #3
0
 public StatementSpecRaw mapSODAToRaw(EPStatementObjectModel model) {
   return StatementSpecMapper.map(
       model,
       services.getEngineImportService(),
       services.getVariableService(),
       services.getConfigSnapshot(),
       services.getSchedulingService(),
       services.getEngineURI(),
       services.getPatternNodeFactory(),
       services.getNamedWindowService(),
       services.getContextManagementService(),
       services.getExprDeclaredService());
 }
예제 #4
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);
 }
예제 #5
0
  public EPStatement create(
      EPPreparedStatement prepared, String statementName, Object userObject, String statementId)
      throws EPException {
    EPPreparedStatementImpl impl = (EPPreparedStatementImpl) prepared;

    StatementSpecRaw statementSpec = mapSODAToRaw(impl.getModel());
    String eplStatement = impl.getModel().toEPL();

    return services
        .getStatementLifecycleSvc()
        .createAndStart(
            statementSpec,
            eplStatement,
            false,
            statementName,
            userObject,
            null,
            statementId,
            impl.getModel());
  }
예제 #6
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;
  }
예제 #7
0
 public void destroyAllStatements() throws EPException {
   services.getStatementLifecycleSvc().destroyAllStatements();
 }
예제 #8
0
 public void stopAllStatements() throws EPException {
   services.getStatementLifecycleSvc().stopAllStatements();
 }
예제 #9
0
 public String[] getStatementNames() {
   return services.getStatementLifecycleSvc().getStatementNames();
 }
예제 #10
0
 public String getStatementNameForId(String statementId) {
   return services.getStatementLifecycleSvc().getStatementNameById(statementId);
 }
예제 #11
0
 public EPStatement getStatement(String name) {
   return services.getStatementLifecycleSvc().getStatementByName(name);
 }