本文整理汇总了Java中com.espertech.esper.epl.variable.VariableServiceImpl类的典型用法代码示例。如果您正苦于以下问题:Java VariableServiceImpl类的具体用法?Java VariableServiceImpl怎么用?Java VariableServiceImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VariableServiceImpl类属于com.espertech.esper.epl.variable包,在下文中一共展示了VariableServiceImpl类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate3Stream
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static void validate3Stream(ExprNode topNode) throws Exception {
SupportStreamTypeSvc3Stream streamTypeService = new SupportStreamTypeSvc3Stream();
ViewFactoryChain[] factoriesPerStream = new ViewFactoryChain[3];
for (int i = 0; i < factoriesPerStream.length; i++) {
List<ViewFactory> factories = new LinkedList<ViewFactory>();
factories.add(new LengthWindowViewFactory());
factoriesPerStream[i] = new ViewFactoryChain(streamTypeService.getEventTypes()[i], factories);
}
ViewResourceDelegateUnverified viewResources = new ViewResourceDelegateUnverified();
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable(null, "intPrimitive", Integer.class.getName(), false, false, false, 10, SupportEngineImportServiceFactory.make());
variableService.allocateVariableState("intPrimitive", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
variableService.createNewVariable(null, "var1", String.class.getName(), false, false, false, "my_variable_value", SupportEngineImportServiceFactory.make());
variableService.allocateVariableState("var1", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
ExprNodeUtilityRich.getValidatedSubtree(ExprNodeOrigin.SELECT, topNode, new ExprValidationContext(streamTypeService, SupportEngineImportServiceFactory.make(), null, viewResources, null, variableService, null, new SupportExprEvaluatorContext(null), null, null, 1, null, null, false, false, false, false, null, false));
}
示例2: validate3Stream
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static void validate3Stream(ExprNode topNode) throws Exception {
SupportStreamTypeSvc3Stream streamTypeService = new SupportStreamTypeSvc3Stream();
ViewFactoryChain[] factoriesPerStream = new ViewFactoryChain[3];
for (int i = 0; i < factoriesPerStream.length; i++) {
List<ViewFactory> factories = new LinkedList<ViewFactory>();
factories.add(new LengthWindowViewFactory());
factoriesPerStream[i] = new ViewFactoryChain(streamTypeService.getEventTypes()[i], factories);
}
ViewResourceDelegateUnverified viewResources = new ViewResourceDelegateUnverified();
EngineImportService engineImportService = SupportEngineImportServiceFactory.make();
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable(null, "intPrimitive", Integer.class.getName(), false, false, false, 10, engineImportService);
variableService.allocateVariableState("intPrimitive", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
variableService.createNewVariable(null, "var1", String.class.getName(), false, false, false, "my_variable_value", engineImportService);
variableService.allocateVariableState("var1", EPStatementStartMethod.DEFAULT_AGENT_INSTANCE_ID, null, false);
ExprNodeUtilityRich.getValidatedSubtree(ExprNodeOrigin.SELECT, topNode, new ExprValidationContext(streamTypeService, SupportEngineImportServiceFactory.make(), null, viewResources, null, variableService, null, new SupportExprEvaluatorContext(null), null, null, 1, null, null, false, false, false, false, null, false));
}
示例3: validate3Stream
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static void validate3Stream(ExprNode topNode) throws Exception
{
SupportStreamTypeSvc3Stream streamTypeService = new SupportStreamTypeSvc3Stream();
ViewFactoryChain[] factoriesPerStream = new ViewFactoryChain[3];
for (int i = 0; i < factoriesPerStream.length; i++)
{
List<ViewFactory> factories = new LinkedList<ViewFactory>();
factories.add(new LengthWindowViewFactory());
factoriesPerStream[i] = new ViewFactoryChain(streamTypeService.getEventTypes()[i], factories);
}
ViewResourceDelegateUnverified viewResources = new ViewResourceDelegateUnverified();
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable("intPrimitive", Integer.class.getName(), 10, false, false, null, null);
variableService.createNewVariable("var1", String.class.getName(), "my_variable_value", false, false, null, null);
ExprNodeUtility.getValidatedSubtree(topNode, new ExprValidationContext(streamTypeService, getMethodResService(), viewResources, null, variableService, null, null, null, null, null, null));
}
示例4: setUp
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public void setUp() throws Exception {
EngineImportService engineImportService = SupportEngineImportServiceFactory.make();
variableService = new VariableServiceImpl(100, null, null, null);
variableService.createNewVariable(null, "var1", "string", true, false, false, null, engineImportService);
variableService.createNewVariable(null, "dummy", "string", true, false, false, null, engineImportService);
variableService.createNewVariable(null, "intPrimitive", "int", true, false, false, null, engineImportService);
varNode = new ExprVariableNodeImpl(variableService.getVariableMetaData("var1"), null);
}
示例5: testWalkOnSet
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public void testWalkOnSet() throws Exception
{
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable("var1", Long.class.getName(), 100L, false, false, null, null);
String expression = "on com.MyClass as myevent set var1 = 'a', var2 = 2*3, var3 = var1";
EPLTreeWalker walker = parseAndWalkEPL(expression, null, variableService);
StatementSpecRaw raw = walker.getStatementSpec();
FilterStreamSpecRaw streamSpec = (FilterStreamSpecRaw) raw.getStreamSpecs().get(0);
assertEquals("com.MyClass", streamSpec.getRawFilterSpec().getEventTypeName());
assertEquals(0, streamSpec.getRawFilterSpec().getFilterExpressions().size());
assertEquals("myevent", streamSpec.getOptionalStreamName());
OnTriggerSetDesc setDesc = (OnTriggerSetDesc) raw.getOnTriggerDesc();
assertTrue(setDesc.getOnTriggerType() == OnTriggerType.ON_SET);
assertEquals(3, setDesc.getAssignments().size());
OnTriggerSetAssignment assign = setDesc.getAssignments().get(0);
assertEquals("var1", assign.getVariableName());
assertTrue(assign.getExpression() instanceof ExprConstantNode);
assign = setDesc.getAssignments().get(1);
assertEquals("var2", assign.getVariableName());
assertTrue(assign.getExpression() instanceof ExprMathNode);
assign = setDesc.getAssignments().get(2);
assertEquals("var3", assign.getVariableName());
ExprVariableNode varNode = (ExprVariableNode) assign.getExpression();
assertEquals("var1", varNode.getVariableName());
assertTrue(raw.isHasVariables());
// try a subquery
expression = "select (select var1 from MyEvent) from MyEvent2";
walker = parseAndWalkEPL(expression, null, variableService);
raw = walker.getStatementSpec();
assertTrue(raw.isHasVariables());
}
示例6: parseAndWalkEPL
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static EPLTreeWalkerListener parseAndWalkEPL(String expression) throws Exception {
return parseAndWalkEPL(expression, SupportEngineImportServiceFactory.make(), new VariableServiceImpl(0, null, SupportEventAdapterService.getService(), null));
}
示例7: makeWalker
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static EPLTreeWalkerListener makeWalker(CommonTokenStream tokenStream) {
return makeWalker(tokenStream, SupportEngineImportServiceFactory.make(), new VariableServiceImpl(0, null, SupportEventAdapterService.getService(), null));
}
示例8: testWalkOnSet
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public void testWalkOnSet() throws Exception {
VariableService variableService = new VariableServiceImpl(0, new SchedulingServiceImpl(new TimeSourceServiceImpl()), SupportEventAdapterService.getService(), null);
variableService.createNewVariable(null, "var1", Long.class.getName(), false, false, false, 100L, SupportEngineImportServiceFactory.make());
variableService.allocateVariableState("var1", 0, null, false);
String expression = "on com.MyClass as myevent set var1 = 'a', var2 = 2*3, var3 = var1";
EPLTreeWalkerListener walker = SupportParserHelper.parseAndWalkEPL(expression, null, variableService);
StatementSpecRaw raw = walker.getStatementSpec();
FilterStreamSpecRaw streamSpec = (FilterStreamSpecRaw) raw.getStreamSpecs().get(0);
assertEquals("com.MyClass", streamSpec.getRawFilterSpec().getEventTypeName());
assertEquals(0, streamSpec.getRawFilterSpec().getFilterExpressions().size());
assertEquals("myevent", streamSpec.getOptionalStreamName());
OnTriggerSetDesc setDesc = (OnTriggerSetDesc) raw.getOnTriggerDesc();
assertTrue(setDesc.getOnTriggerType() == OnTriggerType.ON_SET);
assertEquals(3, setDesc.getAssignments().size());
OnTriggerSetAssignment assign = setDesc.getAssignments().get(0);
assertEquals("var1", ((ExprVariableNode) (assign.getExpression().getChildNodes()[0])).getVariableName());
assertTrue(assign.getExpression() instanceof ExprEqualsNode);
assertTrue(assign.getExpression().getChildNodes()[1] instanceof ExprConstantNode);
assign = setDesc.getAssignments().get(1);
assertEquals("var2", ((ExprIdentNode) (assign.getExpression().getChildNodes()[0])).getFullUnresolvedName());
assertTrue(assign.getExpression() instanceof ExprEqualsNode);
assertTrue(assign.getExpression().getChildNodes()[1] instanceof ExprMathNode);
assign = setDesc.getAssignments().get(2);
assertEquals("var3", ((ExprIdentNode) (assign.getExpression().getChildNodes()[0])).getFullUnresolvedName());
ExprVariableNode varNode = (ExprVariableNode) assign.getExpression().getChildNodes()[1];
assertEquals("var1", varNode.getVariableName());
assertTrue(raw.isHasVariables());
// try a subquery
expression = "select (select var1 from MyEvent) from MyEvent2";
walker = SupportParserHelper.parseAndWalkEPL(expression, null, variableService);
raw = walker.getStatementSpec();
assertTrue(raw.isHasVariables());
}
示例9: makeContext
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static StatementContext makeContext(SchedulingService stub)
{
VariableServiceImpl variableService = new VariableServiceImpl(1000, null, SupportEventAdapterService.getService(), null);
Configuration config = new Configuration();
config.getEngineDefaults().getViewResources().setAllowMultipleExpiryPolicies(true);
StatementContextEngineServices stmtEngineServices = new StatementContextEngineServices("engURI",
SupportEventAdapterService.getService(),
new NamedWindowServiceImpl(null, variableService, false, new ManagedReadWriteLock("dummyeplock", true), new ExceptionHandlingService("engURI", Collections.<ExceptionHandler>emptyList(), Collections.<ConditionHandler>emptyList()), false, null),
null,
new EngineSettingsService(new Configuration().getEngineDefaults(), new URI[0]),
new ValueAddEventServiceImpl(),
config,
null,
null,
null,
null);
return new StatementContext(stmtEngineServices,
"stmtId",
null,
"stmtName",
"exprHere",
stub,
new ScheduleBucket(1),
null,
new ViewResolutionServiceImpl(new PluggableObjectRegistryImpl(new PluggableObjectCollection[] {ViewEnumHelper.getBuiltinViews()}), null, null),
new PatternObjectResolutionServiceImpl(null),
null,
null,
new MethodResolutionServiceImpl(new EngineImportServiceImpl(true, true, true), null),
null,
null,
new StatementResultServiceImpl("name", null, null, new ThreadingServiceImpl(new ConfigurationEngineDefaults.Threading())), // statement result svc
null,
null,
null,
null,
null,
null,
false,
null,
null,
AggregationServiceFactoryServiceImpl.DEFAULT_FACTORY);
}
示例10: makeWalker
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static EPLTreeWalker makeWalker(Tree tree, CommonTokenStream tokenStream)
{
return makeWalker(tree, tokenStream, new EngineImportServiceImpl(true, true, true), new VariableServiceImpl(0, null, SupportEventAdapterService.getService(), null));
}
示例11: parseAndWalkEPL
import com.espertech.esper.epl.variable.VariableServiceImpl; //导入依赖的package包/类
public static EPLTreeWalker parseAndWalkEPL(String expression) throws Exception
{
return parseAndWalkEPL(expression, new EngineImportServiceImpl(true, true, true), new VariableServiceImpl(0, null, SupportEventAdapterService.getService(), null));
}