public EventBean adapterForTypedAvro(Object avroGenericDataDotRecord, EventType eventType) { return typedEventFactory.adapterForTypedAvro(avroGenericDataDotRecord, eventType); }
public EventBean wrap(Object underlying) { return eventAdapterService.adapterForTypedAvro(underlying, type); }
/** * NOTE: Code-generation-invoked method, method name and parameter order matters * * @param value value * @param eventAdapterService svc * @param fragmentType type * @return fragment */ public static Object getFragmentAvro(Object value, EventBeanTypedEventFactory eventAdapterService, EventType fragmentType) { if (fragmentType == null) { return null; } if (value instanceof GenericData.Record) { return eventAdapterService.adapterForTypedAvro(value, fragmentType); } if (value instanceof Collection) { Collection coll = (Collection) value; EventBean[] events = new EventBean[coll.size()]; int index = 0; for (Object item : coll) { events[index++] = eventAdapterService.adapterForTypedAvro(item, fragmentType); } return events; } return null; }
public Object getFragment(EventBean eventBean) throws PropertyAccessException { if (fragmentEventType == null) { return null; } Object value = get(eventBean); if (value == null) { return null; } return eventAdapterService.adapterForTypedAvro(value, fragmentEventType); }
public Object getAvroFragment(GenericData.Record record) { if (fragmentEventType == null) { return null; } Object value = getAvroFieldValue(record); if (value == null) { return null; } return eventAdapterService.adapterForTypedAvro(value, fragmentEventType); }
public Object getFragment(EventBean eventBean) throws PropertyAccessException { if (fragmentEventType == null) { return null; } Object value = get(eventBean); if (value == null) { return null; } return eventAdapterService.adapterForTypedAvro(value, fragmentEventType); }
public Object getFragment(EventBean eventBean) throws PropertyAccessException { if (fragmentType == null) { return null; } Object value = get(eventBean); if (value == null) { return null; } return eventAdapterService.adapterForTypedAvro(value, fragmentType); }
public EventBean adapterForAvro(Object avroGenericDataDotRecord, String eventTypeName) { EventType eventType = findType(eventTypeName); return typedEventFactory.adapterForTypedAvro(avroGenericDataDotRecord, eventType); }
public EventBean make(Object[] properties) { Object record = makeUnderlying(properties); return eventAdapterService.adapterForTypedAvro(record, eventType); }
public void routeEvent(Object theEvent) { if (!(theEvent.getClass().isArray())) { throw new EPException("Unexpected event object of type " + theEvent.getClass().getName() + ", expected Object[]"); } EventBean eventBean = eventBeanTypedEventFactory.adapterForTypedAvro(theEvent, eventType); runtimeEventSender.routeEventBean(eventBean); } }
public EventBean process(EventBean[] eventsPerStream, boolean isNewData, boolean isSynthesize, ExprEvaluatorContext exprEvaluatorContext) { AvroGenericDataBackedEventBean theEvent = (AvroGenericDataBackedEventBean) eventsPerStream[underlyingStreamNumber]; return selectExprForgeContext.getEventBeanTypedEventFactory().adapterForTypedAvro(theEvent.getProperties(), resultType); }
/** * NOTE: Code-generation-invoked method, method name and parameter order matters * * @param eventsPerStream events * @param schema schema * @param eventAdapterService event svc * @param resultEventType result event type * @return bean */ public static EventBean processSelectExprJoinWildcardAvro(EventBean[] eventsPerStream, Schema schema, EventBeanTypedEventFactory eventAdapterService, EventType resultEventType) { GenericData.Record event = new GenericData.Record(schema); for (int i = 0; i < eventsPerStream.length; i++) { EventBean streamEvent = eventsPerStream[i]; if (streamEvent != null) { GenericData.Record record = (GenericData.Record) streamEvent.getUnderlying(); event.put(i, record); } } return eventAdapterService.adapterForTypedAvro(event, resultEventType); }
public void sendEvent(Object theEvent) { EventBean eventBean = eventBeanTypedEventFactory.adapterForTypedAvro(theEvent, eventType); if (threadingService.isInboundThreading()) { threadingService.submitInbound(eventBean, runtimeEventSender); } else { runtimeEventSender.processWrappedEvent(eventBean); } }
public EventBean copy(EventBean theEvent) { GenericData.Record original = (GenericData.Record) theEvent.getUnderlying(); GenericData.Record copy = new GenericData.Record(avroEventType.getSchemaAvro()); List<Schema.Field> fields = avroEventType.getSchemaAvro().getFields(); for (Schema.Field field : fields) { if (field.schema().getType() == Schema.Type.ARRAY) { Collection originalColl = (Collection) original.get(field.pos()); if (originalColl != null) { copy.put(field.pos(), new ArrayList<>(originalColl)); } } else if (field.schema().getType() == Schema.Type.MAP) { Map originalMap = (Map) original.get(field.pos()); if (originalMap != null) { copy.put(field.pos(), new HashMap<>(originalMap)); } } else { copy.put(field.pos(), original.get(field.pos())); } } return eventAdapterService.adapterForTypedAvro(copy, avroEventType); } }
public EventBean process(EventBean[] eventsPerStream, boolean isNewData, boolean isSynthesize, ExprEvaluatorContext exprEvaluatorContext) { AvroGenericDataBackedEventBean theEvent = (AvroGenericDataBackedEventBean) eventsPerStream[underlyingStreamNumber]; GenericData.Record source = theEvent.getProperties(); GenericData.Record target = new GenericData.Record(resultSchema); for (Item item : items) { Object value; if (item.getOptionalFromIndex() != -1) { value = source.get(item.getOptionalFromIndex()); } else { value = item.getEvaluatorAssigned().evaluate(eventsPerStream, isNewData, exprEvaluatorContext); if (item.getOptionalWidener() != null) { value = item.getOptionalWidener().widen(value); } } target.put(item.getToIndex(), value); } return eventAdapterService.adapterForTypedAvro(target, resultType); }
} else if (theEvent.getEventType() instanceof AvroSchemaEventType && targetType instanceof AvroSchemaEventType) { Object convertedGenericRecord = eventTypeAvroHandler.convertEvent(theEvent, (AvroSchemaEventType) targetType); converted = eventAdapterService.adapterForTypedAvro(convertedGenericRecord, targetType); } else { throw new EPException("Unknown event type " + theEvent.getEventType());