public static void buildVariantStreams(EventTypeRepositoryImpl repo, Map<String, ConfigurationCommonVariantStream> variantStreams, EventTypeFactory eventTypeFactory) { for (Map.Entry<String, ConfigurationCommonVariantStream> entry : variantStreams.entrySet()) { if (repo.getTypeByName(entry.getKey()) != null) { continue; } addVariantStream(entry.getKey(), entry.getValue(), repo, eventTypeFactory); } }
EventTypeAvroHandler eventTypeAvroHandler = EventTypeAvroHandlerFactory.resolve(classpathImportServiceCompileTime, configuration.getCommon().getEventMeta().getAvroSettings(), EventTypeAvroHandler.COMPILE_TIME_HANDLER_IMPL); EventTypeRepositoryAvroTypeUtil.buildAvroTypes(eventTypeRepositoryPreconfigured, configuration.getCommon().getEventTypesAvro(), eventTypeAvroHandler, beanEventTypeFactoryPrivate.getEventBeanTypedEventFactory()); EventTypeRepositoryVariantStreamUtil.buildVariantStreams(eventTypeRepositoryPreconfigured, configuration.getCommon().getVariantStreams(), EventTypeFactoryImpl.INSTANCE);
private static void addVariantStream(String name, ConfigurationCommonVariantStream config, EventTypeRepositoryImpl repo, EventTypeFactory eventTypeFactory) { VariantSpec variantSpec = validateVariantStream(name, config, repo); EventTypeMetadata metadata = new EventTypeMetadata(name, null, EventTypeTypeClass.VARIANT, EventTypeApplicationType.VARIANT, NameAccessModifier.PRECONFIGURED, EventTypeBusModifier.BUS, false, new EventTypeIdPair(CRC32Util.computeCRC32(name), -1)); VariantEventType variantEventType = eventTypeFactory.createVariant(metadata, variantSpec); repo.addType(variantEventType); } }
EventTypeAvroHandler eventTypeAvroHandler = EventTypeAvroHandlerFactory.resolve(classpathImportServiceCompileTime, configuration.getCommon().getEventMeta().getAvroSettings(), EventTypeAvroHandler.COMPILE_TIME_HANDLER_IMPL); EventTypeRepositoryAvroTypeUtil.buildAvroTypes(eventTypeRepositoryPreconfigured, configuration.getCommon().getEventTypesAvro(), eventTypeAvroHandler, beanEventTypeFactoryPrivate.getEventBeanTypedEventFactory()); EventTypeRepositoryVariantStreamUtil.buildVariantStreams(eventTypeRepositoryPreconfigured, configuration.getCommon().getVariantStreams(), EventTypeFactoryImpl.INSTANCE);
EventTypeRepositoryXMLTypeUtil.buildXMLTypes(eventTypeRepositoryPreconfigured, configs.getCommon().getEventTypesXMLDOM(), beanEventTypeFactoryPrivate, xmlFragmentEventTypeFactory, classpathImportServiceRuntime); EventTypeRepositoryAvroTypeUtil.buildAvroTypes(eventTypeRepositoryPreconfigured, configs.getCommon().getEventTypesAvro(), eventTypeAvroHandler, beanEventTypeFactoryPrivate.getEventBeanTypedEventFactory()); EventTypeRepositoryVariantStreamUtil.buildVariantStreams(eventTypeRepositoryPreconfigured, configs.getCommon().getVariantStreams(), eventTypeFactory);