protected static EventBean[] convertToArray(Object eventOrDeque) { if (eventOrDeque == null) { return null; } if (eventOrDeque instanceof EventBean) { return new EventBean[] {(EventBean) eventOrDeque}; } return EventBeanUtility.toArray((ArrayDeque<EventBean>) eventOrDeque); }
public void handleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents) { EventBean[] newData; // clear state from prior results resultSetProcessor.clear(); // build join result // use linked hash set to retain order of join results for last/first/window to work most // intuitively Set<MultiKey<EventBean>> newEvents = new LinkedHashSet<MultiKey<EventBean>>(); for (int i = 0; i < triggerEvents.length; i++) { EventBean triggerEvent = triggerEvents[0]; if (matchingEvents != null) { for (int j = 0; j < matchingEvents.length; j++) { EventBean[] eventsPerStream = new EventBean[2]; eventsPerStream[0] = matchingEvents[j]; eventsPerStream[1] = triggerEvent; newEvents.add(new MultiKey<EventBean>(eventsPerStream)); } } } // process matches UniformPair<EventBean[]> pair = resultSetProcessor.processJoinResult(newEvents, oldEvents, false); newData = (pair != null ? pair.getFirst() : null); if (isDistinct) { newData = EventBeanUtility.getDistinctByProp(newData, eventBeanReader); } if (internalEventRouter != null) { if (newData != null) { for (int i = 0; i < newData.length; i++) { internalEventRouter.route( newData[i], statementHandle, statementContext.getInternalEventEngineRouteDest(), statementContext, addToFront); } } } // The on-select listeners receive the events selected if ((newData != null) && (newData.length > 0)) { // And post only if we have listeners/subscribers that need the data if (statementResultService.isMakeNatural() || statementResultService.isMakeSynthetic()) { updateChildren(newData, null); } } lastResult = newData; // clear state from prior results resultSetProcessor.clear(); }
/** * Ctor. * * @param eventType - event type to expect for lookup * @param index - index to look up in */ public IndexedTableLookupStrategySingle( EventType eventType, String property, PropertyIndexedEventTableSingle index) { this.eventType = eventType; this.property = property; if (index == null) { throw new IllegalArgumentException("Unexpected null index received"); } this.index = index; propertyGetter = EventBeanUtility.getAssertPropertyGetter(eventType, property); }
public void render(EventBean theEvent, StringWriter writer) { EventBeanUtility.summarize(theEvent, writer); }