private static Object getAnnotationValue(AnnotationPart part, String name, Object defaultValue) { List<AnnotationAttribute> attrs = part.getAttributes(); Iterator<AnnotationAttribute> it = attrs.iterator(); while (it.hasNext()) { AnnotationAttribute attr = it.next(); if (name.equals(attr.getName())) { return attr.getValue(); } } return defaultValue; }
/** * Greater-then between properties. * @param propertyLeft the name of the property providing left hand side values * @param propertyRight the name of the property providing right hand side values * @return expression */ public static RelationalOpExpression gtProperty(String propertyLeft, String propertyRight) { return new RelationalOpExpression(getPropExpr(propertyLeft) , ">", new PropertyValueExpression(propertyRight)); }
/** * Equals between a property and a constant. * @param propertyName the name of the property providing left hand side values * @param value is the constant to compare * @return expression */ public static RelationalOpExpression eq(String propertyName, Object value) { return new RelationalOpExpression(getPropExpr(propertyName) , "=", new ConstantExpression(value)); }
EPStatement statement = esperService.getEPAdministrator().createEPL(s); EPStatementObjectModel model = esperService.getEPAdministrator().compileEPL(s); List<AnnotationPart> annots = model.getAnnotations(); for (AnnotationPart part : annots) { if (isMainSessionizer && com.ebay.pulsar.sessionizer.esper.annotation.SubSession.class.getSimpleName().equals(part.getName())) { String sessionizerName = (String) part.getAttributes().get(0).getValue(); if (!subSessionNames.contains(sessionizerName)) { throw new IllegalArgumentException("The sub sessionizer referenced by EPL " + sessionizerName + " not configured."); if (isMainSessionizer && UpdateDuration.class.getSimpleName().equals(part.getName())) { statement.addListener(new UpdateTTLListener(context, maxTTL)); if (DecorateEvent.class.getSimpleName().equals(part.getName())) { statement.addListener(new DecorateEventListener(context)); if (AppendState.class.getSimpleName().equals(part.getName())) { statement.addListener(new AppendStateListener(context, (String) getAnnotationValue(part, "name", null), (String) getAnnotationValue(part, "colname", null), if (UpdateState.class.getSimpleName().equals(part.getName())) { statement.addListener(new SessionStateListener(context)); if (UpdateMetadata.class.getSimpleName().equals(part.getName())) { statement.addListener(new SessionMetadataListener(context)); if (UpdateCounter.class.getSimpleName().equals(part.getName())) { statement.addListener(new SessionCounterListener((String) part.getAttributes().get(0).getValue(), context)); if (DebugSession.class.getSimpleName().equals(part.getName())) {
/** * SQL-Like. * @param propertyName the name of the property providing values to match * @param value is the string to match against * @return expression */ public static LikeExpression like(String propertyName, String value) { return new LikeExpression(getPropExpr(propertyName), new ConstantExpression(value)); }
/** * Pattern not-operator and filter in combination, equivalent to the "not tag=MyEvent" syntax. * @param alias is the event type alias name to filter for * @param tagName is the tag name to assign to matching events * @return pattern expression */ public static PatternNotExpr notFilter(String alias, String tagName) { return new PatternNotExpr(new PatternFilterExpr(Filter.create(alias), tagName)); }
/** * Pattern every-operator and filter in combination, equivalent to the "every MyEvent" syntax. * @param alias is the event type alias name to filter for * @return pattern expression */ public static PatternEveryExpr everyFilter(String alias) { PatternExpr filter = new PatternFilterExpr(Filter.create(alias)); return new PatternEveryExpr(filter); }
/** * Ctor. * @param index is the index of the prior event * @param propertyName is the property to return */ public PriorExpression(int index, String propertyName) { this.addChild(new ConstantExpression(index)); this.addChild(new PropertyValueExpression(propertyName)); }
/** * Ctor. * @param index provides the index * @param propertyName is the name of the property to return the value for */ public PreviousExpression(int index, String propertyName) { this.addChild(new ConstantExpression(index)); this.addChild(new PropertyValueExpression(propertyName)); }
/** * Between. * @param property the name of the property that returns the datapoint to check range * @param lowBoundary constant indicating the lower boundary * @param highBoundary constant indicating the upper boundary * @return expression */ public static BetweenExpression between(String property, Object lowBoundary, Object highBoundary) { return new BetweenExpression(getPropExpr(property), new ConstantExpression(lowBoundary), new ConstantExpression(highBoundary)); }
/** * Less-then between properties. * @param propertyLeft the name of the property providing left hand side values * @param propertyRight the name of the property providing right hand side values * @return expression */ public static RelationalOpExpression ltProperty(String propertyLeft, String propertyRight) { return new RelationalOpExpression(getPropExpr(propertyLeft) , "<", new PropertyValueExpression(propertyRight)); }
EPStatement statement = esperService.getEPAdministrator().createEPL(s); EPStatementObjectModel model = esperService.getEPAdministrator().compileEPL(s); List<AnnotationPart> annots = model.getAnnotations(); for (AnnotationPart part : annots) { if (DebugSession.class.getSimpleName().equals(part.getName())) { String prefix = (String) getAnnotationValue(part, "counter"); String field = (String) getAnnotationValue(part, "colname"); if (DecorateEvent.class.getSimpleName().equals(part.getName())) { statement.addListener(eventListener); if (com.ebay.pulsar.sessionizer.esper.annotation.Session.class.getSimpleName().equals(part.getName())) { String sessionizerName = (String) part.getAttributes().get(0).getValue(); if (!sessionizerNames.contains(sessionizerName)) { throw new IllegalArgumentException("The sessionizer referenced by EPL " + sessionizerName
/** * Greater-then between a property and a constant. * @param propertyName the name of the property providing left hand side values * @param value is the constant to compare * @return expression */ public static RelationalOpExpression gt(String propertyName, Object value) { return new RelationalOpExpression(getPropExpr(propertyName) , ">", new ConstantExpression(value)); }
private static Object getAnnotationValue(AnnotationPart part, String name) { List<AnnotationAttribute> attrs = part.getAttributes(); Iterator<AnnotationAttribute> it = attrs.iterator(); while (it.hasNext()) { AnnotationAttribute attr = it.next(); if (name.endsWith(attr.getName())) { return attr.getValue(); } } return null; }
/** * SQL-Like. * @param propertyName the name of the property providing values to match * @param value is the string to match against * @param escape the escape character(s) * @return expression */ public static LikeExpression like(String propertyName, Object value, String escape) { return new LikeExpression(getPropExpr(propertyName), new ConstantExpression(value), new ConstantExpression(escape)); }
/** * Pattern not-operator and filter in combination, equivalent to the "not MyEvent" syntax. * @param alias is the event type alias name to filter for * @return pattern expression */ public static PatternNotExpr notFilter(String alias) { return new PatternNotExpr(new PatternFilterExpr(Filter.create(alias))); }
/** * Greater-or-equal between properties. * @param propertyLeft the name of the property providing left hand side values * @param propertyRight the name of the property providing right hand side values * @return expression */ public static RelationalOpExpression geProperty(String propertyLeft, String propertyRight) { return new RelationalOpExpression(getPropExpr(propertyLeft) , ">=", new PropertyValueExpression(propertyRight)); }
/** * Less-or-equals between a property and a constant. * @param propertyName the name of the property providing left hand side values * @param value is the constant to compare * @return expression */ public static RelationalOpExpression le(String propertyName, Object value) { return new RelationalOpExpression(getPropExpr(propertyName) , "<=", new ConstantExpression(value)); }
/** * Less-or-equal between properties. * @param propertyLeft the name of the property providing left hand side values * @param propertyRight the name of the property providing right hand side values * @return expression */ public static RelationalOpExpression leProperty(String propertyLeft, String propertyRight) { return new RelationalOpExpression(getPropExpr(propertyLeft) , "<=", new PropertyValueExpression(propertyRight)); }
/** * Equals between properties. * @param propertyLeft the name of the property providing left hand side values * @param propertyRight the name of the property providing right hand side values * @return expression */ public static RelationalOpExpression eqProperty(String propertyLeft, String propertyRight) { return new RelationalOpExpression(getPropExpr(propertyLeft) , "=", new PropertyValueExpression(propertyRight)); }