public void mergeFrom(EventTypeRepositoryImpl other) { for (Map.Entry<String, EventType> entry : other.getNameToTypeMap().entrySet()) { if (nameToTypeMap.containsKey(entry.getKey())) { continue; } addType(entry.getValue()); } }
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); } }
public EventType getTypeById(long eventTypeIdPublic, long eventTypeIdProtected) { if (eventTypeIdProtected == -1) { return eventTypeRepositoryPreconfigured.getTypeById(eventTypeIdPublic); } DeploymentInternal deployerResult = deploymentLifecycleService.getDeploymentByCRC(eventTypeIdPublic); return deployerResult.getDeploymentTypes().get(eventTypeIdProtected); } };
EventType eventType = runtime.getServicesContext().getEventTypeRepositoryBus().getNameToTypeMap().get(name); if (eventType == null) { log.warn(".unmarshal Failed to unmarshal map message, event type name '" + name + "' is not a known type"); EventType eventType = runtime.getServicesContext().getEventTypeRepositoryBus().getNameToTypeMap().get(name); if (eventType == null) { log.warn(".unmarshal Failed to unmarshal map message, event type name '" + name + "' is not a known type");
public EPCompilerPathable getRuntimePath() { EPServicesContext services = runtimeEnvironment.getServices(); VariableRepositoryPreconfigured variables = new VariableRepositoryPreconfigured(); for (Map.Entry<String, VariableDeployment> entry : services.getVariableManagementService().getDeploymentsWithVariables().entrySet()) { for (Map.Entry<String, Variable> variableEntry : entry.getValue().getVariables().entrySet()) { if (variableEntry.getValue().getMetaData().isPreconfigured()) { variables.addVariable(variableEntry.getKey(), variableEntry.getValue().getMetaData()); } } } EventTypeRepositoryImpl eventTypes = new EventTypeRepositoryImpl(true); for (Map.Entry<String, EventType> entry : services.getEventTypeRepositoryBus().getNameToTypeMap().entrySet()) { if (entry.getValue().getMetadata().getAccessModifier() == NameAccessModifier.PRECONFIGURED) { eventTypes.addType(entry.getValue()); } } return new EPCompilerPathableImpl( services.getVariablePathRegistry().copy(), services.getEventTypePathRegistry().copy(), services.getExprDeclaredPathRegistry().copy(), services.getNamedWindowPathRegistry().copy(), services.getTablePathRegistry().copy(), services.getContextPathRegistry().copy(), services.getScriptPathRegistry().copy(), eventTypes, variables); }
private static void addNestableObjectArrayType(String eventTypeName, LinkedHashMap<String, Object> propertyTypesMayHavePrimitive, ConfigurationCommonEventTypeObjectArray optionalConfig, BeanEventTypeFactory beanEventTypeFactory, EventTypeRepositoryImpl repo) { if (optionalConfig != null && optionalConfig.getSuperTypes().size() > 1) { throw new EventAdapterException(ConfigurationCommonEventTypeObjectArray.SINGLE_SUPERTYPE_MSG); } LinkedHashMap<String, Object> propertyTypes = EventTypeUtility.getPropertyTypesNonPrimitive(propertyTypesMayHavePrimitive); EventTypeMetadata metadata = new EventTypeMetadata(eventTypeName, null, EventTypeTypeClass.APPLICATION, EventTypeApplicationType.OBJECTARR, NameAccessModifier.PRECONFIGURED, EventTypeBusModifier.BUS, false, new EventTypeIdPair(CRC32Util.computeCRC32(eventTypeName), -1)); String[] superTypes = null; if (optionalConfig != null && optionalConfig.getSuperTypes() != null && !optionalConfig.getSuperTypes().isEmpty()) { superTypes = optionalConfig.getSuperTypes().toArray(new String[optionalConfig.getSuperTypes().size()]); } ObjectArrayEventType newEventType = beanEventTypeFactory.getEventTypeFactory().createObjectArray(metadata, propertyTypes, superTypes, optionalConfig != null ? optionalConfig.getStartTimestampPropertyName() : null, optionalConfig != null ? optionalConfig.getEndTimestampPropertyName() : null, beanEventTypeFactory, repo); EventType existingType = repo.getTypeByName(eventTypeName); if (existingType != null) { // The existing type must be the same as the type createdStatement if (newEventType.equalsCompareType(existingType) != null) { ExprValidationException message = newEventType.compareEquals(existingType); throw new EPException("Event type named '" + eventTypeName + "' has already been declared with differing column name or type information: " + message.getMessage(), message); } // Since it's the same, return the existing type return; } repo.addType(newEventType); }
EventTypeRepositoryImpl eventTypeRepositoryPreconfigured = new EventTypeRepositoryImpl(true); EventTypeCompileTimeRegistry eventTypeCompileRegistry = new EventTypeCompileTimeRegistry(eventTypeRepositoryPreconfigured); BeanEventTypeFactoryPrivate beanEventTypeFactoryPrivate = new BeanEventTypeFactoryPrivate(EventBeanTypedEventFactoryCompileTime.INSTANCE, EventTypeFactoryImpl.INSTANCE, beanEventTypeStemService); pathContexts.mergeFrom(impl.getContextPathRegistry()); pathScript.mergeFrom(impl.getScriptPathRegistry()); eventTypeRepositoryPreconfigured.mergeFrom(impl.getEventTypePreconfigured()); variableRepositoryPreconfigured.mergeFrom(impl.getVariablePreconfigured());
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); } }
EventBeanTypedEventFactory eventBeanTypedEventFactory = makeEventBeanTypedEventFactory(eventTypeAvroHandler); BeanEventTypeStemService beanEventTypeStemService = BeanEventTypeRepoUtil.makeBeanEventTypeStemService(configs, resolvedBeanEventTypes, eventBeanTypedEventFactory); EventTypeRepositoryImpl eventTypeRepositoryPreconfigured = new EventTypeRepositoryImpl(false); EventTypeFactory eventTypeFactory = makeEventTypeFactory(epServicesHA.getRuntimeExtensionServices(), eventTypeRepositoryPreconfigured, deploymentLifecycleService); BeanEventTypeFactoryPrivate beanEventTypeFactoryPrivate = new BeanEventTypeFactoryPrivate(eventBeanTypedEventFactory, eventTypeFactory, beanEventTypeStemService);
Set<EventType> filterServiceTypes = new LinkedHashSet<>(services.getEventTypeRepositoryBus().getAllTypes()); filterServiceTypes.addAll(protectedVisibleTypes); Supplier<Collection<EventType>> availableTypes = new Supplier<Collection<EventType>>() {
private EsperHttpRequestCacheEntry makeCacheEntry(String eventTypeName) { EventType eventType = runtime.getServicesContext().getEventTypeRepositoryBus().getNameToTypeMap().get(eventTypeName); if (eventType == null) { log.info("Event type by name '" + eventTypeName + "' not found.");
private static void addXMLDOMType(EventTypeRepositoryImpl repo, String eventTypeName, ConfigurationCommonEventTypeXMLDOM detail, SchemaModel schemaModel, BeanEventTypeFactory beanEventTypeFactory, XMLFragmentEventTypeFactory xmlFragmentEventTypeFactory) { if (detail.getRootElementName() == null) { throw new EventAdapterException("Required root element name has not been supplied"); } EventType existingType = repo.getTypeByName(eventTypeName); if (existingType != null) { String message = "Event type named '" + eventTypeName + "' has already been declared with differing column name or type information"; throw new ConfigurationException(message); } boolean propertyAgnostic = detail.getSchemaResource() == null && detail.getSchemaText() == null; EventTypeMetadata metadata = new EventTypeMetadata(eventTypeName, null, EventTypeTypeClass.STREAM, EventTypeApplicationType.XML, NameAccessModifier.PRECONFIGURED, EventTypeBusModifier.BUS, propertyAgnostic, new EventTypeIdPair(CRC32Util.computeCRC32(eventTypeName), -1)); EventType type = beanEventTypeFactory.getEventTypeFactory().createXMLType(metadata, detail, schemaModel, null, metadata.getName(), beanEventTypeFactory, xmlFragmentEventTypeFactory, repo); repo.addType(type); if (type instanceof SchemaXMLEventType) { xmlFragmentEventTypeFactory.addRootType((SchemaXMLEventType) type); } } }
EventTypeRepositoryImpl eventTypeRepositoryPreconfigured = new EventTypeRepositoryImpl(true); EventTypeCompileTimeRegistry eventTypeCompileRegistry = new EventTypeCompileTimeRegistry(eventTypeRepositoryPreconfigured); BeanEventTypeFactoryPrivate beanEventTypeFactoryPrivate = new BeanEventTypeFactoryPrivate(EventBeanTypedEventFactoryCompileTime.INSTANCE, EventTypeFactoryImpl.INSTANCE, beanEventTypeStemService); pathContexts.mergeFrom(impl.getContextPathRegistry()); pathScript.mergeFrom(impl.getScriptPathRegistry()); eventTypeRepositoryPreconfigured.mergeFrom(impl.getEventTypePreconfigured()); variableRepositoryPreconfigured.mergeFrom(impl.getVariablePreconfigured());
private static void buildAvroType(EventTypeRepositoryImpl eventTypeRepositoryPreconfigured, String eventTypeName, ConfigurationCommonEventTypeAvro config, EventTypeAvroHandler eventTypeAvroHandler, EventBeanTypedEventFactory eventBeanTypedEventFactory) { EventTypeMetadata metadata = new EventTypeMetadata(eventTypeName, null, EventTypeTypeClass.APPLICATION, EventTypeApplicationType.AVRO, NameAccessModifier.PRECONFIGURED, EventTypeBusModifier.BUS, false, new EventTypeIdPair(CRC32Util.computeCRC32(eventTypeName), -1)); Pair<EventType[], Set<EventType>> avroSuperTypes = EventTypeUtility.getSuperTypesDepthFirst(config.getSuperTypes(), EventUnderlyingType.AVRO, eventTypeRepositoryPreconfigured); AvroSchemaEventType newEventType = eventTypeAvroHandler.newEventTypeFromSchema(metadata, eventBeanTypedEventFactory, config, avroSuperTypes.getFirst(), avroSuperTypes.getSecond()); eventTypeRepositoryPreconfigured.addType(newEventType); } }
private WriterCacheEntry makeCacheEntry(String eventTypeName) { EventType eventType = runtime.getServicesContext().getEventTypeRepositoryBus().getNameToTypeMap().get(eventTypeName); if (eventType == null) { log.info("Event type by name '" + eventTypeName + "' not found.");
private EventType resolvePreconfigured(String typeName) { EventType eventType = publics.getTypeByName(typeName); if (eventType == null) { return null; } moduleDependencies.addPublicEventType(typeName); return eventType; }
private static void addNestableMapType(String eventTypeName, LinkedHashMap<String, Object> propertyTypesMayHavePrimitive, ConfigurationCommonEventTypeMap optionalConfig, EventTypeRepositoryImpl repo, BeanEventTypeFactory beanEventTypeFactory, EventTypeNameResolver eventTypeNameResolver) throws EventAdapterException { EventTypeMetadata metadata = new EventTypeMetadata(eventTypeName, null, EventTypeTypeClass.APPLICATION, EventTypeApplicationType.MAP, NameAccessModifier.PRECONFIGURED, EventTypeBusModifier.BUS, false, new EventTypeIdPair(CRC32Util.computeCRC32(eventTypeName), -1)); LinkedHashMap<String, Object> propertyTypes = EventTypeUtility.getPropertyTypesNonPrimitive(propertyTypesMayHavePrimitive); String[] superTypes = null; if (optionalConfig != null && optionalConfig.getSuperTypes() != null && !optionalConfig.getSuperTypes().isEmpty()) { superTypes = optionalConfig.getSuperTypes().toArray(new String[optionalConfig.getSuperTypes().size()]); } MapEventType newEventType = beanEventTypeFactory.getEventTypeFactory().createMap(metadata, propertyTypes, superTypes, optionalConfig != null ? optionalConfig.getStartTimestampPropertyName() : null, optionalConfig != null ? optionalConfig.getEndTimestampPropertyName() : null, beanEventTypeFactory, eventTypeNameResolver); EventType existingType = repo.getTypeByName(eventTypeName); if (existingType != null) { // The existing type must be the same as the type createdStatement if (newEventType.equalsCompareType(existingType) != null) { ExprValidationException message = newEventType.compareEquals(existingType); throw new EPException("Event type named '" + eventTypeName + "' has already been declared with differing column name or type information: " + message.getMessage(), message); } return; } repo.addType(newEventType); }
if (eventTypeMetadata.getBusModifier() == EventTypeBusModifier.BUS) { eventTypeSPI.setMetadataId(nameTypeId, -1); services.getEventTypeRepositoryBus().addType(eventTypeSPI); } else { eventTypeSPI.setMetadataId(deploymentIdCrc32, nameTypeId);
public static EventType getEventTypeForTypeId(StatementContext statementContext, EventTypeIdPair key) { return statementContext.getEventTypeRepositoryPreconfigured().getTypeById(key.getPublicId()); } }
EventType eventType = runtime.getServicesContext().getEventTypeRepositoryBus().getNameToTypeMap().get(request.getStream()); if (eventType == null) { throw new ConfigurationException("Event type by name '" + request.getStream() + "' not found");