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


Java SiddhiCompiler.parse方法代码示例

本文整理汇总了Java中org.wso2.siddhi.query.compiler.SiddhiCompiler.parse方法的典型用法代码示例。如果您正苦于以下问题:Java SiddhiCompiler.parse方法的具体用法?Java SiddhiCompiler.parse怎么用?Java SiddhiCompiler.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.siddhi.query.compiler.SiddhiCompiler的用法示例。


在下文中一共展示了SiddhiCompiler.parse方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addExecutionPlan

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
public ExecutionPlanReference addExecutionPlan(String executionPlan) throws SiddhiParserException {
    List<ExecutionPlan> executionPlanList = SiddhiCompiler.parse(executionPlan);
    ExecutionPlanReference executionPlanReference = new ExecutionPlanReference();
    for (ExecutionPlan plan : executionPlanList) {
        if (plan instanceof Query) {
            executionPlanReference.addQueryReference(addQuery((Query) plan));
        } else if (plan instanceof StreamDefinition) {
            executionPlanReference.addInputHandler(defineStream((StreamDefinition) plan));
        } else if (plan instanceof TableDefinition) {
            defineTable((TableDefinition) plan);
        } else if (plan instanceof PartitionDefinition) {
            definePartition((PartitionDefinition) plan);
        } else {
            throw new OperationNotSupportedException(plan.getClass().getName() + " is not supported as an execution plan element ");
        }
    }

    return executionPlanReference;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:20,代码来源:SiddhiManager.java

示例2: Test1

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test1() throws RecognitionException, SiddhiParserException {
    SiddhiCompiler.parse("from (\n" +
                         "\tfrom cseEventStream[ price >= 20]#window.length(50)\n" +
                         "select symbol, avg(price) as avgPrice\n" +
                         "group by symbol\n" +
                         "return) [symbol==\"IBM\"]\n" +
                         "select symbol, avgPrice\n" +
                         "insert into IBMStockQuote ");
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:11,代码来源:NestedQueryTestCase.java

示例3: Test2

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test2() throws RecognitionException, SiddhiParserException {
    SiddhiCompiler.parse("from (\n" +
                         "from MyStream [price >10]\n" +
                         "return \n" +
                         ") #window.length(1000)\n" +
                         "select symbol ,  avg(price) as avgPrice " +
                         "insert into StockQuote");
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:10,代码来源:NestedQueryTestCase.java

示例4: Test2

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test2() throws RecognitionException, SiddhiParserException {
    List<ExecutionPlan> executionPlans = SiddhiCompiler.parse("define stream cseStream ( symbol string, price int, volume float );" +
                                                              "from  cseStream#window.lenghtBatch(50) " +
                                                              "select symbol, avg(price) as avgPrice " +
                                                              "group by symbol " +
                                                              "having (price >= 20) " +
                                                              "insert into StockQuote for all-events ; "
    );
    Assert.assertEquals(2, executionPlans.size());
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:12,代码来源:ExecutionPlaneTestCase.java

示例5: Test3

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test3() throws RecognitionException, SiddhiParserException {
    List<ExecutionPlan> executionPlans = SiddhiCompiler.parse("from  cseStream#window.lenghtBatch(50) " +
                                                              "select symbol, avg(price) as avgPrice " +
                                                              "group by symbol " +
                                                              "having (price >= 20) " +
                                                              "insert into StockQuote for all-events ; "
    );
    Assert.assertEquals(1, executionPlans.size());
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:11,代码来源:ExecutionPlaneTestCase.java

示例6: Test2

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test2() throws RecognitionException, SiddhiParserException {
    SiddhiCompiler.parse("from  cseEventStream [price >= 20]#window.length(50) " +
                         "select symbol, avg(price) as avgPricegroup " +
                         "group by symbol " +
                         "having avgPrice>50 " +
                         "insert into StockQuote; ");
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:9,代码来源:FilterTestCase.java

示例7: Test3

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
    public void Test3() throws RecognitionException, SiddhiParserException {
        SiddhiCompiler.parse("from allStockQuotes#window.time(600000)\n" +
                             "select symbol as symbol, price, avg(price) as averagePrice \n" +
                             "group by symbol \n" +
                             "having ( price > ( averagePrice*1.02) ) or ( averagePrice > price ) " +
                             "insert into fastMovingStockQuotes \n;");
//                             "having ( price > ( averagePrice*1.02) ) or ( averagePrice*0.98 > price ); ");
//                             "having ( price >  (averagePrice +5)) or ( averagePrice > price ); ");
        ;
    }
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:12,代码来源:FilterTestCase.java

示例8: Test1

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test1() throws RecognitionException, SiddhiParserException {
    List<ExecutionPlan> executionPlans = SiddhiCompiler.parse("define stream cseStream ( symbol string, price int, volume float )");
    Assert.assertEquals(1, executionPlans.size());
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:6,代码来源:ExecutionPlaneTestCase.java

示例9: siddhiArtifactDeployPost

import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Override
public Response siddhiArtifactDeployPost(String siddhiApp) throws NotFoundException {

    log.info("SiddhiApp = " + siddhiApp);
    String jsonString = new Gson().toString();
    try {
        SiddhiApp parsedSiddhiApp = SiddhiCompiler.parse(siddhiApp);
        String siddhiAppName = AnnotationHelper.getAnnotationElement(
                SiddhiServiceConstants.ANNOTATION_NAME_NAME, null, parsedSiddhiApp.
                        getAnnotations()).getValue();
        if (!siddhiAppRunTimeMap.containsKey(siddhiApp)) {
            SiddhiAppConfiguration siddhiAppConfiguration = new SiddhiAppConfiguration();
            siddhiAppConfiguration.setName(siddhiAppName);
            siddhiAppConfigurationMap.put(siddhiAppName, siddhiAppConfiguration);

            SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);

            if (siddhiAppRuntime != null) {
                Set<String> streamNames = siddhiAppRuntime.getStreamDefinitionMap().keySet();
                Map<String, InputHandler> inputHandlerMap = new ConcurrentHashMap<>(streamNames.size());

                for (String streamName : streamNames) {
                    inputHandlerMap.put(streamName, siddhiAppRuntime.getInputHandler(streamName));
                }

                siddhiAppSpecificInputHandlerMap.put(siddhiAppName, inputHandlerMap);

                siddhiAppRunTimeMap.put(siddhiAppName, siddhiAppRuntime);
                siddhiAppRuntime.start();

                jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.OK,
                        "Siddhi app is deployed " +
                                "and runtime is created"));
            }
        } else {
            jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.ERROR,
                    "There is a Siddhi app already " +
                            "exists with same name"));
        }

    } catch (Exception e) {
        jsonString = new Gson().toJson(new ApiResponseMessage(ApiResponseMessage.ERROR, e.getMessage()));
    }

    return Response.ok()
            .entity(jsonString)
            .build();
}
 
开发者ID:wso2,项目名称:siddhi,代码行数:49,代码来源:SiddhiApiServiceImpl.java


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