本文整理汇总了Java中com.espertech.esper.epl.expression.ExprValidationException类的典型用法代码示例。如果您正苦于以下问题:Java ExprValidationException类的具体用法?Java ExprValidationException怎么用?Java ExprValidationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExprValidationException类属于com.espertech.esper.epl.expression包,在下文中一共展示了ExprValidationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyCompileScript
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public static CompiledScript verifyCompileScript(ExpressionScriptProvided script, String dialect) throws ExprValidationException {
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName(dialect);
if (engine == null) {
throw new ExprValidationException("Failed to obtain script engine for dialect '" + dialect + "' for script '" + script.getName() + "'");
}
engine.put(ScriptEngine.FILENAME, script.getName());
Compilable compilingEngine = (Compilable)engine;
try {
return compilingEngine.compile(script.getExpression());
}
catch (ScriptException ex) {
String message = "Exception compiling script '" + script.getName() + "' of dialect '" + dialect + "': " + getScriptCompileMsg(ex);
log.info(message, ex);
throw new ExprValidationException(message, ex);
}
}
示例2: walkClassIdent
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
private static Object walkClassIdent(Tree child, EngineImportService engineImportService)
{
String enumValueText = child.getText();
Object enumValue;
try
{
enumValue = JavaClassHelper.resolveIdentAsEnumConst(enumValueText, null, engineImportService);
}
catch (ExprValidationException e)
{
throw new ASTWalkException("Annotation value '" + enumValueText + "' is not recognized as an enumeration value, please check imports or use a primitive or string type");
}
if (enumValue != null)
{
return enumValue;
}
throw new ASTWalkException("Annotation enumeration value '" + enumValueText + "' not recognized as an enumeration class, please check imports or type used");
}
示例3: ReformatOpBetweenConstantParams
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public ReformatOpBetweenConstantParams(List<ExprNode> parameters) throws ExprValidationException {
long paramFirst = getLongValue(parameters.get(0));
long paramSecond = getLongValue(parameters.get(1));
if (paramFirst > paramSecond) {
this.second = paramFirst;
this.first = paramSecond;
}
else {
this.first = paramFirst;
this.second = paramSecond;
}
if (parameters.size() > 2) {
if (!getBooleanValue(parameters.get(2))) {
first = first + 1;
}
if (!getBooleanValue(parameters.get(3))) {
second = second - 1;
}
}
}
示例4: EvalInsertBeanRecast
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public EvalInsertBeanRecast(EventType targetType, EventAdapterService eventAdapterService, int streamNumber, EventType[] typesPerStream)
throws ExprValidationException
{
this.eventType = targetType;
this.eventAdapterService = eventAdapterService;
this.streamNumber = streamNumber;
EventType sourceType = typesPerStream[streamNumber];
Class sourceClass = sourceType.getUnderlyingType();
Class targetClass = targetType.getUnderlyingType();
if (!JavaClassHelper.isSubclassOrImplementsInterface(sourceClass, targetClass)) {
throw new ExprValidationException("Expression-returned event type '" + sourceType.getName() +
"' with underlying type '" + sourceType.getUnderlyingType().getName() +
"' cannot be converted target event type '" + targetType.getName() +
"' with underlying type '" + targetType.getUnderlyingType().getName() + "'");
}
}
示例5: testGetProcessorInvalid
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public void testGetProcessorInvalid() throws Exception
{
List<SelectClauseElementCompiled> selectionList = new LinkedList<SelectClauseElementCompiled>();
ExprNode identNode = SupportExprNodeFactory.makeIdentNode("doubleBoxed", "s0");
ExprNode mathNode = SupportExprNodeFactory.makeMathNode();
selectionList.add(new SelectClauseExprCompiledSpec(identNode, "result", "result"));
selectionList.add(new SelectClauseExprCompiledSpec(mathNode, "result", "result"));
try
{
SelectExprProcessorFactory.getProcessor(Collections.<Integer>emptyList(), selectionList, false, null, null,
new SupportStreamTypeSvc3Stream(), null, null, null, null, null, null, null, null, null, null, null, null, null, new Configuration(), null);
fail();
}
catch (ExprValidationException ex)
{
// Expected
}
}
示例6: startInternal
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public EPStatementStartResult startInternal(final EPServicesContext services, StatementContext statementContext, boolean isNewStatement, boolean isRecoveringStatement, boolean isRecoveringResilient) throws ExprValidationException, ViewProcessingException {
final CreateDataFlowDesc createGraphDesc = statementSpec.getCreateGraphDesc();
final AgentInstanceContext agentInstanceContext = getDefaultAgentInstanceContext(statementContext);
// define output event type
String typeName = "EventType_Graph_" + createGraphDesc.getGraphName();
EventType resultType = services.getEventAdapterService().createAnonymousMapType(typeName, Collections.<String, Object>emptyMap());
services.getDataFlowService().addStartGraph(createGraphDesc, statementContext, services, agentInstanceContext, isNewStatement);
EPStatementStopMethod stopMethod = new EPStatementStopMethod() {
public void stop() {
services.getDataFlowService().stopGraph(createGraphDesc.getGraphName());
}
};
EPStatementDestroyMethod destroyMethod = new EPStatementDestroyMethod() {
public void destroy() {
services.getDataFlowService().removeGraph(createGraphDesc.getGraphName());
}
};
return new EPStatementStartResult(new ZeroDepthStream(resultType), stopMethod, destroyMethod);
}
示例7: startInternal
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public EPStatementStartResult startInternal(final EPServicesContext services, StatementContext statementContext, boolean isNewStatement, boolean isRecoveringStatement, boolean isRecoveringResilient) throws ExprValidationException, ViewProcessingException {
String expressionName = services.getExprDeclaredService().addExpressionOrScript(statementSpec.getCreateExpressionDesc());
// define output event type
String typeName = "EventType_Expression_" + expressionName;
EventType resultType = services.getEventAdapterService().createAnonymousMapType(typeName, Collections.<String, Object>emptyMap());
EPStatementStopMethod stopMethod = new EPStatementStopMethod() {
public void stop() {
// no action
}
};
EPStatementDestroyMethod destroyMethod = new EPStatementDestroyMethod() {
public void destroy() {
services.getExprDeclaredService().destroyedExpression(statementSpec.getCreateExpressionDesc());
}
};
return new EPStatementStartResult(new ZeroDepthStream(resultType), stopMethod, destroyMethod);
}
示例8: initialize
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public DataFlowOpInitializeResult initialize(DataFlowOpInitializateContext prepareContext) throws Exception {
if (prepareContext.getInputPorts().size() != 1) {
throw new ExprValidationException("Filter requires single input port");
}
if (filter == null) {
throw new ExprValidationException("Required parameter 'filter' providing the filter expression is not provided");
}
if (prepareContext.getOutputPorts().isEmpty() || prepareContext.getOutputPorts().size() > 2) {
throw new IllegalArgumentException("Filter operator requires one or two output stream(s) but produces " + prepareContext.getOutputPorts().size() + " streams");
}
EventType eventType = prepareContext.getInputPorts().get(0).getTypeDesc().getEventType();
singleOutputPort = prepareContext.getOutputPorts().size() == 1;
ExprNode validated = ExprNodeUtility.validateSimpleGetSubtree(filter, prepareContext.getStatementContext(), eventType);
evaluator = validated.getExprEvaluator();
theEvent = prepareContext.getServicesContext().getEventAdapterService().getShellForType(eventType);
eventsPerStream[0] = theEvent;
GraphTypeDesc[] typesPerPort = new GraphTypeDesc[prepareContext.getOutputPorts().size()];
for (int i = 0; i < typesPerPort.length; i++) {
typesPerPort[i] = new GraphTypeDesc(false, true, eventType);
}
return new DataFlowOpInitializeResult(typesPerPort);
}
示例9: validateExecuteQuery
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
private void validateExecuteQuery() throws ExprValidationException
{
if (statementSpec.getSubSelectExpressions().size() > 0)
{
throw new ExprValidationException("Subqueries are not a supported feature of on-demand queries");
}
for (int i = 0; i < statementSpec.getStreamSpecs().size(); i++)
{
if (!(statementSpec.getStreamSpecs().get(i) instanceof NamedWindowConsumerStreamSpec))
{
throw new ExprValidationException("On-demand queries require named windows and do not allow event streams or patterns");
}
if (statementSpec.getStreamSpecs().get(i).getViewSpecs().size() != 0)
{
throw new ExprValidationException("Views are not a supported feature of on-demand queries");
}
}
if (statementSpec.getOutputLimitSpec() != null)
{
throw new ExprValidationException("Output rate limiting is not a supported feature of on-demand queries");
}
if (statementSpec.getInsertIntoDesc() != null)
{
throw new ExprValidationException("Insert-into is not a supported feature of on-demand queries");
}
}
示例10: addStartGraph
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public synchronized void addStartGraph(CreateDataFlowDesc desc, StatementContext statementContext, EPServicesContext servicesContext, AgentInstanceContext agentInstanceContext, boolean newStatement) throws ExprValidationException {
compileTimeValidate(desc);
DataFlowServiceEntry existing = graphs.get(desc.getGraphName());
if (existing != null && (existing.getState() == EPStatementState.STARTED || newStatement)) {
throw new ExprValidationException("Data flow by name '" + desc.getGraphName() + "' has already been declared");
}
if (existing != null) {
existing.setState(EPStatementState.STARTED);
return;
}
// compile annotations
Map<GraphOperatorSpec, Annotation[]> operatorAnnotations = new HashMap<GraphOperatorSpec, Annotation[]>();
for (GraphOperatorSpec spec : desc.getOperators()) {
Annotation[] operatorAnnotation = AnnotationUtil.compileAnnotations(spec.getAnnotations(), servicesContext.getEngineImportService(), null);
operatorAnnotations.put(spec, operatorAnnotation);
}
DataFlowStmtDesc stmtDesc = new DataFlowStmtDesc(desc, statementContext, servicesContext, agentInstanceContext, operatorAnnotations);
graphs.put(desc.getGraphName(), new DataFlowServiceEntry(stmtDesc, EPStatementState.STARTED));
}
示例11: compareTypeInfo
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
private void compareTypeInfo(String operatorName, String firstName, GraphTypeDesc firstType, String otherName, GraphTypeDesc otherType)
throws ExprValidationException
{
if (firstType.getEventType() != null && otherType.getEventType() != null && !firstType.getEventType().equals(otherType.getEventType())) {
throw new ExprValidationException("For operator '" + operatorName + "' stream '" + firstName + "'" +
" typed '" + firstType.getEventType().getName() + "'" +
" is not the same type as stream '" + otherName + "'" +
" typed '" + otherType.getEventType().getName() + "'");
}
if (firstType.isWildcard() != otherType.isWildcard()) {
throw new ExprValidationException("For operator '" + operatorName + "' streams '" + firstName + "'" +
" and '" + otherName + "' have differing wildcard type information");
}
if (firstType.isUnderlying() != otherType.isUnderlying()) {
throw new ExprValidationException("For operator '" + operatorName + "' streams '" + firstName + "'" +
" and '" + otherName + "' have differing underlying information");
}
}
示例12: determineGraphDeclaredOutputPorts
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
private List<LogicalChannelProducingPortDeclared> determineGraphDeclaredOutputPorts(Object operator, int producingOpNum, OperatorMetadataDescriptor metadata, Map<String, EventType> types, EPServicesContext servicesContext)
throws ExprValidationException {
List<LogicalChannelProducingPortDeclared> ports = new ArrayList<LogicalChannelProducingPortDeclared>();
int portNumber = 0;
for (GraphOperatorOutputItem outputItem : metadata.getOperatorSpec().getOutput().getItems()) {
if (outputItem.getTypeInfo().size() > 1) {
throw new ExprValidationException("Multiple parameter types are not supported");
}
if (!outputItem.getTypeInfo().isEmpty()) {
GraphTypeDesc typeDesc = determineTypeOutputPort(outputItem.getTypeInfo().get(0), types, servicesContext);
boolean isDeclaredPunctuated = JavaClassHelper.isAnnotationListed(DataFlowOpProvideSignal.class, operator.getClass().getAnnotations());
ports.add(new LogicalChannelProducingPortDeclared(producingOpNum, metadata.getOperatorPrettyPrint(), outputItem.getStreamName(), portNumber, typeDesc, isDeclaredPunctuated));
}
portNumber++;
}
return ports;
}
示例13: determineTypeOutputPort
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
private static GraphTypeDesc determineTypeOutputPort(GraphOperatorOutputItemType outType, Map<String, EventType> types, EPServicesContext servicesContext)
throws ExprValidationException {
EventType eventType = null;
boolean isWildcard = false;
boolean isUnderlying = true;
String typeOrClassname = outType.getTypeOrClassname();
if (typeOrClassname != null && typeOrClassname.toLowerCase().equals(EVENT_WRAPPED_TYPE)) {
isUnderlying = false;
if (!outType.getTypeParameters().isEmpty() && !outType.getTypeParameters().get(0).isWildcard()) {
String typeName = outType.getTypeParameters().get(0).getTypeOrClassname();
eventType = resolveType(typeName, types, servicesContext);
}
else {
isWildcard = true;
}
}
else if (typeOrClassname != null) {
eventType = resolveType(typeOrClassname, types, servicesContext);
}
else {
isWildcard = true;
}
return new GraphTypeDesc(isWildcard, isUnderlying, eventType);
}
示例14: compileTimeValidate
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
private void compileTimeValidate(CreateDataFlowDesc desc) throws ExprValidationException {
for (GraphOperatorSpec spec : desc.getOperators()) {
for (GraphOperatorOutputItem out : spec.getOutput().getItems()) {
if (out.getTypeInfo().size() > 1) {
throw new ExprValidationException("Failed to validate operator '" + spec.getOperatorName() + "': Multiple output types for a single stream '" + out.getStreamName() + "' are not supported");
}
}
}
Set<String> schemaNames = new HashSet<String>();
for (CreateSchemaDesc schema : desc.getSchemas()) {
if (schemaNames.contains(schema.getSchemaName())) {
throw new ExprValidationException("Schema name '" + schema.getSchemaName() + "' is declared more then once");
}
schemaNames.add(schema.getSchemaName());
}
}
示例15: ContextManagerNested
import com.espertech.esper.epl.expression.ExprValidationException; //导入依赖的package包/类
public ContextManagerNested(ContextControllerFactoryServiceContext factoryServiceContext)
throws ExprValidationException
{
this.contextName = factoryServiceContext.getContextName();
this.servicesContext = factoryServiceContext.getServicesContext();
this.contextPartitionIdManager = factoryServiceContext.getAgentInstanceContextCreate().getStatementContext().getContextControllerFactoryService().allocatePartitionIdMgr(contextName, factoryServiceContext.getAgentInstanceContextCreate().getStatementContext().getStatementId());
nestedContextFactories = factoryServiceContext.getAgentInstanceContextCreate().getStatementContext().getContextControllerFactoryService().getFactory(factoryServiceContext);
StatementAIResourceRegistryFactory resourceRegistryFactory = new StatementAIResourceRegistryFactory() {
public StatementAIResourceRegistry make() {
return new StatementAIResourceRegistry(new AIRegistryAggregationMap(), new AIRegistryExprMap());
}
};
Map<String, Object> contextProps = ContextPropertyEventType.getNestedTypeBase();
for (ContextControllerFactory factory : nestedContextFactories) {
contextProps.put(factory.getFactoryContext().getContextName(), factory.getContextBuiltinProps());
}
EventType contextPropsType = servicesContext.getEventAdapterService().createAnonymousMapType(contextName, contextProps);
ContextPropertyRegistryImpl registry = new ContextPropertyRegistryImpl(Collections.<ContextDetailPartitionItem>emptyList(), contextPropsType);
contextDescriptor = new ContextDescriptor(contextName, false, registry, resourceRegistryFactory, this, factoryServiceContext.getDetail());
}