本文整理匯總了Java中com.espertech.esper.core.context.util.ContextPropertyRegistry類的典型用法代碼示例。如果您正苦於以下問題:Java ContextPropertyRegistry類的具體用法?Java ContextPropertyRegistry怎麽用?Java ContextPropertyRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ContextPropertyRegistry類屬於com.espertech.esper.core.context.util包,在下文中一共展示了ContextPropertyRegistry類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getNonAggregatedProps
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
public static Set<Pair<Integer, String>> getNonAggregatedProps(EventType[] types, List<ExprNode> exprNodes, ContextPropertyRegistry contextPropertyRegistry)
{
// Determine all event properties in the clause
Set<Pair<Integer, String>> nonAggProps = new HashSet<Pair<Integer, String>>();
for (ExprNode node : exprNodes)
{
ExprNodeIdentifierVisitor visitor = new ExprNodeIdentifierVisitor(false);
node.accept(visitor);
List<Pair<Integer, String>> propertiesNodes = visitor.getExprProperties();
for (Pair<Integer, String> pair : propertiesNodes) {
EventType originType = types.length > pair.getFirst() ? types[pair.getFirst()] : null;
if (originType == null || contextPropertyRegistry == null || !contextPropertyRegistry.isPartitionProperty(originType, pair.getSecond())) {
nonAggProps.add(pair);
}
}
}
return nonAggProps;
}
示例2: getNonAggregatedProps
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
public static ExprNodePropOrStreamSet getNonAggregatedProps(EventType[] types, List<ExprNode> exprNodes, ContextPropertyRegistry contextPropertyRegistry) {
// Determine all event properties in the clause
ExprNodePropOrStreamSet nonAggProps = new ExprNodePropOrStreamSet();
ExprNodeIdentifierAndStreamRefVisitor visitor = new ExprNodeIdentifierAndStreamRefVisitor(false);
for (ExprNode node : exprNodes) {
visitor.reset();
node.accept(visitor);
addNonAggregatedProps(nonAggProps, visitor.getRefs(), types, contextPropertyRegistry);
}
return nonAggProps;
}
示例3: addNonAggregatedProps
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
private static void addNonAggregatedProps(ExprNodePropOrStreamSet nonAggProps, List<ExprNodePropOrStreamDesc> refs, EventType[] types, ContextPropertyRegistry contextPropertyRegistry) {
for (ExprNodePropOrStreamDesc pair : refs) {
if (pair instanceof ExprNodePropOrStreamPropDesc) {
ExprNodePropOrStreamPropDesc propDesc = (ExprNodePropOrStreamPropDesc) pair;
EventType originType = types.length > pair.getStreamNum() ? types[pair.getStreamNum()] : null;
if (originType == null || contextPropertyRegistry == null || !contextPropertyRegistry.isPartitionProperty(originType, propDesc.getPropertyName())) {
nonAggProps.add(pair);
}
} else {
nonAggProps.add(pair);
}
}
}
示例4: planSubSelect
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
protected static SubSelectStrategyCollection planSubSelect(EPServicesContext services,
StatementContext statementContext,
boolean queryPlanLogging,
SubSelectActivationCollection subSelectStreamDesc,
String[] outerStreamNames,
EventType[] outerEventTypesSelect,
String[] outerEventTypeNamees,
ExprDeclaredNode[] declaredExpressions,
ContextPropertyRegistry contextPropertyRegistry)
throws ExprValidationException, ViewProcessingException {
int subqueryNum = -1;
SubSelectStrategyCollection collection = new SubSelectStrategyCollection();
Map<ExprDeclaredNode, List<ExprDeclaredNode>> declaredExpressionCallHierarchy = null;
if (declaredExpressions.length > 0) {
declaredExpressionCallHierarchy = ExprNodeUtilityRich.getDeclaredExpressionCallHierarchy(declaredExpressions);
}
for (Map.Entry<ExprSubselectNode, SubSelectActivationHolder> entry : subSelectStreamDesc.getSubqueries().entrySet()) {
subqueryNum++;
ExprSubselectNode subselect = entry.getKey();
SubSelectActivationHolder subSelectActivation = entry.getValue();
try {
SubSelectStrategyFactoryDesc factoryDesc = planSubSelectInternal(subqueryNum, subselect, subSelectActivation,
services, statementContext, queryPlanLogging, subSelectStreamDesc,
outerStreamNames, outerEventTypesSelect, outerEventTypeNamees,
declaredExpressions, contextPropertyRegistry, declaredExpressionCallHierarchy);
collection.add(subselect, factoryDesc);
} catch (Exception ex) {
throw new ExprValidationException("Failed to plan " + getSubqueryInfoText(subqueryNum, subselect) + ": " + ex.getMessage(), ex);
}
}
return collection;
}
示例5: onSplitValidate
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
private static EPStatementStartMethodOnTriggerItem onSplitValidate(StatementSpecCompiled statementSpec, StreamTypeService typeServiceTrigger, ContextPropertyRegistry contextPropertyRegistry, EPServicesContext services, StatementContext statementContext, PropertyEvaluator optionalPropertyEvaluator) throws ExprValidationException {
boolean isNamedWindowInsert = statementContext.getNamedWindowMgmtService().isNamedWindow(statementSpec.getInsertIntoDesc().getEventTypeName());
EPStatementStartMethodHelperValidate.validateNodes(statementSpec, statementContext, typeServiceTrigger, null);
ResultSetProcessorFactoryDesc factoryDescs = ResultSetProcessorFactoryFactory.getProcessorPrototype(
statementSpec, statementContext, typeServiceTrigger, null, new boolean[0], false, contextPropertyRegistry, null, services.getConfigSnapshot(), services.getResultSetProcessorHelperFactory(), false, true);
return new EPStatementStartMethodOnTriggerItem(statementSpec.getFilterRootNode(), isNamedWindowInsert, getOptionalInsertIntoTableName(statementSpec.getInsertIntoDesc(), services.getTableService()), factoryDescs, optionalPropertyEvaluator);
}
示例6: handleContextFactoryOnTriggerTable
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
private ContextFactoryResult handleContextFactoryOnTriggerTable(StatementContext statementContext, EPServicesContext services, OnTriggerWindowDesc onTriggerDesc, String contextName, StreamSpecCompiled streamSpec, ActivatorResult activatorResult, ContextPropertyRegistry contextPropertyRegistry, SubSelectActivationCollection subSelectStreamDesc)
throws ExprValidationException {
TableMetadata metadata = services.getTableService().getTableMetadata(onTriggerDesc.getWindowName());
// validate context
validateOnExpressionContext(contextName, metadata.getContextName(), "Table '" + onTriggerDesc.getWindowName() + "'");
InternalEventRouter routerService = null;
if (statementSpec.getInsertIntoDesc() != null || onTriggerDesc instanceof OnTriggerMergeDesc) {
routerService = services.getInternalEventRouter();
}
// validate expressions and plan subselects
TriggerValidationPlanResult validationResult = validateOnTriggerPlan(services, statementContext, onTriggerDesc, metadata.getInternalEventType(), streamSpec, activatorResult, contextPropertyRegistry, subSelectStreamDesc, metadata.getTableName());
// table on-action view factory
TableOnViewFactory onExprFactory = TableOnViewFactoryFactory.make(metadata, onTriggerDesc, activatorResult.activatorResultEventType, streamSpec.getOptionalStreamName(),
statementContext, statementContext.getEpStatementHandle().getMetricsHandle(), false, routerService);
// For on-delete/set/update/merge, create an output processor that passes on as a wildcard the underlying event
ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype = null;
if ((statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_DELETE) ||
(statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_UPDATE) ||
(statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_MERGE)) {
StatementSpecCompiled defaultSelectAllSpec = new StatementSpecCompiled();
defaultSelectAllSpec.getSelectClauseSpec().setSelectExprList(new SelectClauseElementWildcard());
// we'll be expecting public-type events as there is no copy op
StreamTypeService streamTypeService = new StreamTypeServiceImpl(new EventType[]{metadata.getPublicEventType()}, new String[]{"trigger_stream"}, new boolean[]{true}, services.getEngineURI(), false, false);
outputResultSetProcessorPrototype = ResultSetProcessorFactoryFactory.getProcessorPrototype(defaultSelectAllSpec, statementContext, streamTypeService, null, new boolean[0], true, contextPropertyRegistry, null, services.getConfigSnapshot(), services.getResultSetProcessorHelperFactory(), false, true);
}
EventType resultEventType = validationResult.resultSetProcessorPrototype.getResultEventType();
OutputProcessViewFactory outputViewFactory = OutputProcessViewFactoryFactory.make(statementSpec, services.getInternalEventRouter(), statementContext, resultEventType, null, services.getTableService(), validationResult.resultSetProcessorPrototype.getResultSetProcessorType(), services.getResultSetProcessorHelperFactory(), services.getStatementVariableRefService());
StatementAgentInstanceFactoryOnTriggerTable contextFactory = new StatementAgentInstanceFactoryOnTriggerTable(statementContext, statementSpec, services, activatorResult.activator, validationResult.getSubSelectStrategyCollection(), validationResult.getResultSetProcessorPrototype(), validationResult.validatedJoin, onExprFactory, activatorResult.activatorResultEventType, metadata, outputResultSetProcessorPrototype, outputViewFactory);
return new ContextFactoryResult(contextFactory, validationResult.getSubSelectStrategyCollection(), validationResult.resultSetProcessorPrototype);
}
示例7: handleContextFactorySplitStream
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
private ContextFactoryResult handleContextFactorySplitStream(StatementSpecCompiled statementSpec, StatementContext statementContext, EPServicesContext services, OnTriggerSplitStreamDesc desc, StreamSpecCompiled streamSpec, ContextPropertyRegistry contextPropertyRegistry, SubSelectActivationCollection subSelectStreamDesc, ActivatorResult activatorResult)
throws ExprValidationException {
if (statementSpec.getInsertIntoDesc() == null) {
throw new ExprValidationException("Required insert-into clause is not provided, the clause is required for split-stream syntax");
}
if ((statementSpec.getGroupByExpressions() != null && statementSpec.getGroupByExpressions().getGroupByNodes().length > 0) || (statementSpec.getHavingExprRootNode() != null) || (statementSpec.getOrderByList().length > 0)) {
throw new ExprValidationException("A group-by clause, having-clause or order-by clause is not allowed for the split stream syntax");
}
String streamName = streamSpec.getOptionalStreamName();
if (streamName == null) {
streamName = "stream_0";
}
StreamTypeService typeServiceTrigger = new StreamTypeServiceImpl(new EventType[]{activatorResult.activatorResultEventType}, new String[]{streamName}, new boolean[]{true}, services.getEngineURI(), false, false);
// materialize sub-select views
SubSelectStrategyCollection subSelectStrategyCollection = EPStatementStartMethodHelperSubselect.planSubSelect(services, statementContext, isQueryPlanLogging(services), subSelectStreamDesc, new String[]{streamSpec.getOptionalStreamName()}, new EventType[]{activatorResult.activatorResultEventType}, new String[]{activatorResult.triggerEventTypeName}, statementSpec.getDeclaredExpressions(), contextPropertyRegistry);
// compile top-level split
EPStatementStartMethodOnTriggerItem[] items = new EPStatementStartMethodOnTriggerItem[desc.getSplitStreams().size() + 1];
items[0] = onSplitValidate(statementSpec, typeServiceTrigger, contextPropertyRegistry, services, statementContext, null);
// compile each additional split
int index = 1;
Collection<Integer> assignedTypeNumberStack = new ArrayList<>();
for (OnTriggerSplitStream splits : desc.getSplitStreams()) {
StatementSpecCompiled splitSpec = new StatementSpecCompiled();
splitSpec.setInsertIntoDesc(splits.getInsertInto());
splitSpec.setSelectClauseSpec(StatementLifecycleSvcImpl.compileSelectAllowSubselect(splits.getSelectClause()));
splitSpec.setFilterExprRootNode(splits.getWhereClause());
PropertyEvaluator optionalPropertyEvaluator = null;
StreamTypeService typeServiceProperty;
if (splits.getFromClause() != null) {
optionalPropertyEvaluator = PropertyEvaluatorFactory.makeEvaluator(splits.getFromClause().getPropertyEvalSpec(), activatorResult.activatorResultEventType, streamName, services.getEventAdapterService(), services.getEngineImportService(), services.getSchedulingService(), services.getVariableService(), services.getTableService(), typeServiceTrigger.getEngineURIQualifier(), statementContext.getStatementId(), statementContext.getStatementName(), statementContext.getAnnotations(), assignedTypeNumberStack, services.getConfigSnapshot(), services.getNamedWindowMgmtService(), statementContext.getStatementExtensionServicesContext());
typeServiceProperty = new StreamTypeServiceImpl(new EventType[]{optionalPropertyEvaluator.getFragmentEventType()}, new String[]{splits.getFromClause().getOptionalStreamName()}, new boolean[]{true}, services.getEngineURI(), false, false);
} else {
typeServiceProperty = typeServiceTrigger;
}
items[index] = onSplitValidate(splitSpec, typeServiceProperty, contextPropertyRegistry, services, statementContext, optionalPropertyEvaluator);
index++;
}
StatementAgentInstanceFactoryOnTriggerSplit contextFactory = new StatementAgentInstanceFactoryOnTriggerSplit(statementContext, statementSpec, services, activatorResult.activator, subSelectStrategyCollection, items, activatorResult.activatorResultEventType);
return new ContextFactoryResult(contextFactory, subSelectStrategyCollection, null);
}
示例8: handleContextFactoryOnTriggerNamedWindow
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
private ContextFactoryResult handleContextFactoryOnTriggerNamedWindow(EPServicesContext services, StatementContext statementContext, OnTriggerWindowDesc onTriggerDesc, String contextName, StreamSpecCompiled streamSpec, ContextPropertyRegistry contextPropertyRegistry, SubSelectActivationCollection subSelectStreamDesc, ActivatorResult activatorResult, StreamSelector optionalStreamSelector, List<StopCallback> stopCallbacks)
throws ExprValidationException {
NamedWindowProcessor processor = services.getNamedWindowMgmtService().getProcessor(onTriggerDesc.getWindowName());
// validate context
validateOnExpressionContext(contextName, processor.getContextName(), "Named window '" + onTriggerDesc.getWindowName() + "'");
EventType namedWindowType = processor.getNamedWindowType();
services.getStatementEventTypeRefService().addReferences(statementContext.getStatementName(), new String[]{onTriggerDesc.getWindowName()});
// validate expressions and plan subselects
TriggerValidationPlanResult validationResult = validateOnTriggerPlan(services, statementContext, onTriggerDesc, namedWindowType, streamSpec, activatorResult, contextPropertyRegistry, subSelectStreamDesc, null);
InternalEventRouter routerService = null;
boolean addToFront = false;
String optionalInsertIntoTableName = null;
if (statementSpec.getInsertIntoDesc() != null || onTriggerDesc instanceof OnTriggerMergeDesc) {
routerService = services.getInternalEventRouter();
}
if (statementSpec.getInsertIntoDesc() != null) {
TableMetadata tableMetadata = services.getTableService().getTableMetadata(statementSpec.getInsertIntoDesc().getEventTypeName());
if (tableMetadata != null) {
optionalInsertIntoTableName = tableMetadata.getTableName();
routerService = null;
}
addToFront = statementContext.getNamedWindowMgmtService().isNamedWindow(statementSpec.getInsertIntoDesc().getEventTypeName());
}
boolean isDistinct = statementSpec.getSelectClauseSpec().isDistinct();
EventType selectResultEventType = validationResult.resultSetProcessorPrototype.getResultEventType();
StatementMetricHandle createNamedWindowMetricsHandle = processor.getCreateNamedWindowMetricsHandle();
NamedWindowOnExprFactory onExprFactory = NamedWindowOnExprFactoryFactory.make(namedWindowType, onTriggerDesc.getWindowName(), validationResult.zeroStreamAliasName,
onTriggerDesc,
activatorResult.activatorResultEventType, streamSpec.getOptionalStreamName(), addToFront, routerService,
selectResultEventType,
statementContext, createNamedWindowMetricsHandle, isDistinct, optionalStreamSelector, optionalInsertIntoTableName);
// For on-delete/set/update/merge, create an output processor that passes on as a wildcard the underlying event
ResultSetProcessorFactoryDesc outputResultSetProcessorPrototype = null;
if ((statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_DELETE) ||
(statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_UPDATE) ||
(statementSpec.getOnTriggerDesc().getOnTriggerType() == OnTriggerType.ON_MERGE)) {
StatementSpecCompiled defaultSelectAllSpec = new StatementSpecCompiled();
defaultSelectAllSpec.getSelectClauseSpec().setSelectExprList(new SelectClauseElementWildcard());
StreamTypeService streamTypeService = new StreamTypeServiceImpl(new EventType[]{namedWindowType}, new String[]{"trigger_stream"}, new boolean[]{true}, services.getEngineURI(), false, false);
outputResultSetProcessorPrototype = ResultSetProcessorFactoryFactory.getProcessorPrototype(defaultSelectAllSpec, statementContext, streamTypeService, null, new boolean[0], true, contextPropertyRegistry, null, services.getConfigSnapshot(), services.getResultSetProcessorHelperFactory(), false, true);
}
EventType resultEventType = validationResult.resultSetProcessorPrototype.getResultEventType();
OutputProcessViewFactory outputViewFactory = OutputProcessViewFactoryFactory.make(statementSpec, services.getInternalEventRouter(), statementContext, resultEventType, null, services.getTableService(), validationResult.resultSetProcessorPrototype.getResultSetProcessorType(), services.getResultSetProcessorHelperFactory(), services.getStatementVariableRefService());
StatementAgentInstanceFactoryOnTriggerNamedWindow contextFactory = new StatementAgentInstanceFactoryOnTriggerNamedWindow(statementContext, statementSpec, services, activatorResult.activator, validationResult.subSelectStrategyCollection, validationResult.resultSetProcessorPrototype, validationResult.validatedJoin, outputResultSetProcessorPrototype, onExprFactory, outputViewFactory, activatorResult.activatorResultEventType, processor, stopCallbacks);
return new ContextFactoryResult(contextFactory, validationResult.subSelectStrategyCollection, validationResult.resultSetProcessorPrototype);
}
示例9: validateOnTriggerPlan
import com.espertech.esper.core.context.util.ContextPropertyRegistry; //導入依賴的package包/類
private TriggerValidationPlanResult validateOnTriggerPlan(EPServicesContext services,
StatementContext statementContext,
OnTriggerWindowDesc onTriggerDesc,
EventType namedWindowType,
StreamSpecCompiled streamSpec,
ActivatorResult activatorResult,
ContextPropertyRegistry contextPropertyRegistry,
SubSelectActivationCollection subSelectStreamDesc,
String optionalTableName)
throws ExprValidationException {
String zeroStreamAliasName = onTriggerDesc.getOptionalAsName();
if (zeroStreamAliasName == null) {
zeroStreamAliasName = "stream_0";
}
String streamName = streamSpec.getOptionalStreamName();
if (streamName == null) {
streamName = "stream_1";
}
String namedWindowTypeName = onTriggerDesc.getWindowName();
// Materialize sub-select views
// 0 - named window stream
// 1 - arriving stream
// 2 - initial value before update
SubSelectStrategyCollection subSelectStrategyCollection = EPStatementStartMethodHelperSubselect.planSubSelect(services, statementContext, isQueryPlanLogging(services), subSelectStreamDesc, new String[]{zeroStreamAliasName, streamSpec.getOptionalStreamName()}, new EventType[]{namedWindowType, activatorResult.activatorResultEventType}, new String[]{namedWindowTypeName, activatorResult.triggerEventTypeName}, statementSpec.getDeclaredExpressions(), contextPropertyRegistry);
StreamTypeServiceImpl typeService = new StreamTypeServiceImpl(new EventType[]{namedWindowType, activatorResult.activatorResultEventType}, new String[]{zeroStreamAliasName, streamName}, new boolean[]{false, true}, services.getEngineURI(), true, false);
// allow "initial" as a prefix to properties
StreamTypeServiceImpl assignmentTypeService;
if (zeroStreamAliasName.equals(INITIAL_VALUE_STREAM_NAME) || streamName.equals(INITIAL_VALUE_STREAM_NAME)) {
assignmentTypeService = typeService;
} else {
assignmentTypeService = new StreamTypeServiceImpl(new EventType[]{namedWindowType, activatorResult.activatorResultEventType, namedWindowType}, new String[]{zeroStreamAliasName, streamName, INITIAL_VALUE_STREAM_NAME}, new boolean[]{false, true, true}, services.getEngineURI(), false, false);
assignmentTypeService.setStreamZeroUnambigous(true);
}
if (onTriggerDesc instanceof OnTriggerWindowUpdateDesc) {
OnTriggerWindowUpdateDesc updateDesc = (OnTriggerWindowUpdateDesc) onTriggerDesc;
ExprValidationContext validationContext = new ExprValidationContext(assignmentTypeService, statementContext.getEngineImportService(), statementContext.getStatementExtensionServicesContext(), null, statementContext.getSchedulingService(), statementContext.getVariableService(), statementContext.getTableService(), getDefaultAgentInstanceContext(statementContext), statementContext.getEventAdapterService(), statementContext.getStatementName(), statementContext.getStatementId(), statementContext.getAnnotations(), statementContext.getContextDescriptor(), false, false, true, false, null, false);
for (OnTriggerSetAssignment assignment : updateDesc.getAssignments()) {
ExprNode validated = ExprNodeUtilityRich.getValidatedAssignment(assignment, validationContext);
assignment.setExpression(validated);
EPStatementStartMethodHelperValidate.validateNoAggregations(validated, "Aggregation functions may not be used within an on-update-clause");
}
}
if (onTriggerDesc instanceof OnTriggerMergeDesc) {
OnTriggerMergeDesc mergeDesc = (OnTriggerMergeDesc) onTriggerDesc;
validateMergeDesc(mergeDesc, statementContext, namedWindowType, zeroStreamAliasName, activatorResult.activatorResultEventType, streamName);
}
// validate join expression
ExprNode validatedJoin = validateJoinNamedWindow(services.getEngineURI(), statementContext, ExprNodeOrigin.WHERE, statementSpec.getFilterRootNode(),
namedWindowType, zeroStreamAliasName, namedWindowTypeName,
activatorResult.activatorResultEventType, streamName, activatorResult.triggerEventTypeName,
optionalTableName);
// validate filter, output rate limiting
EPStatementStartMethodHelperValidate.validateNodes(statementSpec, statementContext, typeService, null);
// Construct a processor for results; for use in on-select to process selection results
// Use a wildcard select if the select-clause is empty, such as for on-delete.
// For on-select the select clause is not empty.
if (statementSpec.getSelectClauseSpec().getSelectExprList().length == 0) {
statementSpec.getSelectClauseSpec().setSelectExprList(new SelectClauseElementWildcard());
}
ResultSetProcessorFactoryDesc resultSetProcessorPrototype = ResultSetProcessorFactoryFactory.getProcessorPrototype(
statementSpec, statementContext, typeService, null, new boolean[0], true, contextPropertyRegistry, null, services.getConfigSnapshot(), services.getResultSetProcessorHelperFactory(), false, true);
return new TriggerValidationPlanResult(subSelectStrategyCollection, resultSetProcessorPrototype, validatedJoin, zeroStreamAliasName);
}