public void SendEvent(Object theEvent) { if (!(theEvent.GetType().IsArray)) { throw new EPException("Unexpected event object of type " + theEvent.GetType().FullName + ", expected Object[]"); } var arr = (Object[])theEvent; EventBean objectArrayEvent = _eventAdapterService.AdapterForTypedObjectArray(arr, _objectArrayEventType); if ((ThreadingOption.IsThreadingEnabledValue) && (_threadingService.IsInboundThreading)) { _threadingService.SubmitInbound(new InboundUnitSendWrapped(objectArrayEvent, _runtimeEventSender).Run); } else { _runtimeEventSender.ProcessWrappedEvent(objectArrayEvent); } }
public EventBean Process(EventBean[] eventsPerStream, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext) { var tuple = new Object[_streamNames.Length]; Array.Copy(eventsPerStream, 0, tuple, 0, _streamNames.Length); return(_eventAdapterService.AdapterForTypedObjectArray(tuple, _resultEventType)); }
public override EventBean Process(EventBean[] eventsPerStream, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext) { var evaluateParams = new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext); var result = ExprEvaluator.Evaluate(evaluateParams); if (result == null) { return(null); } return(EventAdapterService.AdapterForTypedObjectArray((Object[])result, EventType)); }
public static EventBean[] TypeCast(IList <EventBean> events, EventType targetType, EventAdapterService eventAdapterService) { var convertedArray = new EventBean[events.Count]; var count = 0; foreach (EventBean theEvent in events) { EventBean converted; if (theEvent is DecoratingEventBean) { var wrapper = (DecoratingEventBean)theEvent; if (targetType is MapEventType) { IDictionary <String, Object> props = new Dictionary <String, Object>(); props.PutAll(wrapper.DecoratingProperties); foreach (EventPropertyDescriptor propDesc in wrapper.UnderlyingEvent.EventType.PropertyDescriptors) { props.Put(propDesc.PropertyName, wrapper.UnderlyingEvent.Get(propDesc.PropertyName)); } converted = eventAdapterService.AdapterForTypedMap(props, targetType); } else { converted = eventAdapterService.AdapterForTypedWrapper(wrapper.UnderlyingEvent, wrapper.DecoratingProperties, targetType); } } else if ((theEvent.EventType is MapEventType) && (targetType is MapEventType)) { var mapEvent = (MappedEventBean)theEvent; converted = eventAdapterService.AdapterForTypedMap(mapEvent.Properties, targetType); } else if ((theEvent.EventType is MapEventType) && (targetType is WrapperEventType)) { converted = eventAdapterService.AdapterForTypedWrapper(theEvent, Collections.EmptyDataMap, targetType); } else if ((theEvent.EventType is BeanEventType) && (targetType is BeanEventType)) { converted = eventAdapterService.AdapterForTypedObject(theEvent.Underlying, targetType); } else if (theEvent.EventType is ObjectArrayEventType && targetType is ObjectArrayEventType) { Object[] convertedObjectArray = ObjectArrayEventType.ConvertEvent(theEvent, (ObjectArrayEventType)targetType); converted = eventAdapterService.AdapterForTypedObjectArray(convertedObjectArray, targetType); } else { throw new EPException("Unknown event type " + theEvent.EventType); } convertedArray[count] = converted; count++; } return(convertedArray); }
public static EventBean GetFragmentNonPono(EventAdapterService eventAdapterService, Object fragmentUnderlying, EventType fragmentEventType) { if (fragmentUnderlying == null) { return(null); } if (fragmentEventType is MapEventType) { return(eventAdapterService.AdapterForTypedMap((IDictionary <String, Object>)fragmentUnderlying, fragmentEventType)); } return(eventAdapterService.AdapterForTypedObjectArray(fragmentUnderlying.UnwrapIntoArray <object>(true), fragmentEventType)); }
public override object HandleNestedValueFragment(object value) { if (!(value is object[])) { if (value is EventBean) return _arrayGetter.GetFragment((EventBean) value); return null; } // If the map does not contain the key, this is allowed and represented as null var eventBean = EventAdapterService.AdapterForTypedObjectArray((object[]) value, FragmentType); return _arrayGetter.GetFragment(eventBean); }
public static Object HandleCreateFragmentObjectArray(Object value, EventType fragmentEventType, EventAdapterService eventAdapterService) { if (!(value is Object[])) { if (value is EventBean) { return(value); } return(null); } var subEvent = (Object[])value; return(eventAdapterService.AdapterForTypedObjectArray(subEvent, fragmentEventType)); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="value">value</param> /// <param name="fragmentEventType">fragment type</param> /// <param name="eventAdapterService">service</param> /// <returns>fragment</returns> public static object HandleBNCreateFragmentObjectArray(object value, EventType fragmentEventType, EventAdapterService eventAdapterService) { if (value is object[] valueAsArray) { return(eventAdapterService.AdapterForTypedObjectArray(valueAsArray, fragmentEventType)); } if (value is EventBean) { return(value); } return(null); }
/// <summary> /// NOTE: Code-generation-invoked method, method name and parameter order matters /// </summary> /// <param name="fragmentUnderlying">fragment</param> /// <param name="fragmentEventType">type</param> /// <param name="eventAdapterService">svc</param> /// <returns>bean</returns> public static EventBean GetBNFragmentNonPono( object fragmentUnderlying, EventType fragmentEventType, EventAdapterService eventAdapterService) { if (fragmentUnderlying == null) { return(null); } if (fragmentEventType is MapEventType) { return(eventAdapterService.AdapterForTypedMap((IDictionary <string, object>)fragmentUnderlying, fragmentEventType)); } return(eventAdapterService.AdapterForTypedObjectArray((object[])fragmentUnderlying, fragmentEventType)); }
public EventBean Process(EventBean[] eventsPerStream, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext) { ExprEvaluator[] expressionNodes = _selectExprContext.ExpressionNodes; EventAdapterService eventAdapterService = _selectExprContext.EventAdapterService; // Evaluate all expressions and build a map of name-value pairs var props = new Object[expressionNodes.Length]; for (int i = 0; i < expressionNodes.Length; i++) { Object evalResult = expressionNodes[i].Evaluate(new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext)); props[i] = evalResult; } return(eventAdapterService.AdapterForTypedObjectArray(props, _resultEventType)); }
public static object HandleNestedValueArrayWithObjectArrayFragment( object value, int index, ObjectArrayEventPropertyGetter getter, EventType fragmentType, EventAdapterService eventAdapterService) { var valueArray = GetBNArrayValueAtIndex(value, index); if (!(valueArray is object[])) { if (value is EventBean) { return(getter.GetFragment((EventBean)value)); } return(null); } // If the map does not contain the key, this is allowed and represented as null var eventBean = eventAdapterService.AdapterForTypedObjectArray((object[])valueArray, fragmentType); return(getter.GetFragment(eventBean)); }
protected override EventBean GetEventBean(object value) { return(EventAdapterService.AdapterForTypedObjectArray((object[])value, EventType)); }
public EventBean Make(Object[] properties) { var cols = MakeUnderlying(properties) as object[]; return(_eventAdapterService.AdapterForTypedObjectArray(cols, _eventType)); }
public EventBean Wrap(Object underlying) { return(_eventAdapterService.AdapterForTypedObjectArray((Object[])underlying, _type)); }
protected override IList <EventBean> HandleResult(Object invocationResult) { return(Collections.SingletonList(EventAdapterService.AdapterForTypedObjectArray((Object[])invocationResult, EventType))); }
public EventBean Process(EventBean[] eventsPerStream, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext) { ObjectArrayBackedEventBean theEvent = (ObjectArrayBackedEventBean)eventsPerStream[0]; return(_eventAdapterService.AdapterForTypedObjectArray(theEvent.Properties, _resultEventType)); }