public static EventType resolveTypeName(String eventTypeName, EventTypeCompileTimeResolver eventTypeCompileTimeResolver) throws ExprValidationException { EventType eventType = eventTypeCompileTimeResolver.getTypeByName(eventTypeName); if (eventType == null) { throw new ExprValidationException("Failed to resolve event type, named window or table by name '" + eventTypeName + "'"); } return eventType; }
private static EventType resolveType(String typeOrClassname, Map<String, EventType> types, StatementCompileTimeServices services) throws ExprValidationException { EventType eventType = types.get(typeOrClassname); if (eventType == null) { eventType = services.getEventTypeCompileTimeResolver().getTypeByName(typeOrClassname); } if (eventType == null) { throw new ExprValidationException("Failed to find event type '" + typeOrClassname + "'"); } return eventType; }
public static EventType requireEventType(String aspectCamel, String aspectName, String optionalEventTypeName, EventTypeCompileTimeResolver eventTypeCompileTimeResolver) throws ExprValidationException { if (optionalEventTypeName == null) { throw new ExprValidationException(aspectCamel + " '" + aspectName + "' returns EventBean-array but does not provide the event type name"); } EventType eventType = eventTypeCompileTimeResolver.getTypeByName(optionalEventTypeName); if (eventType == null) { throw new ExprValidationException(aspectCamel + " '" + aspectName + "' returns event type '" + optionalEventTypeName + "' and the event type cannot be found"); } return eventType; }
private static EventType validateExpressionGetEventType(String msgprefix, List<AnnotationDesc> annotations, StatementCompileTimeServices services) throws ExprValidationException { Map<String, List<AnnotationDesc>> annos = AnnotationUtil.mapByNameLowerCase(annotations); // check annotations used List<AnnotationDesc> typeAnnos = annos.remove("type"); if (!annos.isEmpty()) { throw new ExprValidationException(msgprefix + " unrecognized annotation '" + annos.keySet().iterator().next() + "'"); } // type determination EventType optionalType = null; if (typeAnnos != null) { String typeName = AnnotationUtil.getExpectSingleStringValue(msgprefix, typeAnnos); optionalType = services.getEventTypeCompileTimeResolver().getTypeByName(typeName); if (optionalType == null) { throw new ExprValidationException(msgprefix + " failed to find event type '" + typeName + "'"); } } return optionalType; }
public static void validateAlreadyExistsTableOrVariable(String name, VariableCompileTimeResolver variableCompileTimeResolver, TableCompileTimeResolver tableCompileTimeResolver, EventTypeCompileTimeResolver eventTypeCompileTimeResolver) throws ExprValidationException { TableMetaData existingTable = tableCompileTimeResolver.resolve(name); if (existingTable != null) { throw new ExprValidationException("A table by name '" + name + "' has already been declared"); } VariableMetaData existingVariable = variableCompileTimeResolver.resolve(name); if (existingVariable != null) { throw new ExprValidationException("A variable by name '" + name + "' has already been declared"); } EventType existingEventType = eventTypeCompileTimeResolver.getTypeByName(name); if (existingEventType != null) { throw new ExprValidationException("An event type by name '" + name + "' has already been declared"); } } }
public StmtForgeMethodResult make(String packageName, String classPostfix, StatementCompileTimeServices services) throws ExprValidationException { StatementSpecCompiled statementSpec = base.getStatementSpec(); CreateSchemaDesc spec = statementSpec.getRaw().getCreateSchemaDesc(); if (services.getEventTypeCompileTimeResolver().getTypeByName(spec.getSchemaName()) != null) { throw new ExprValidationException("Event type named '" + spec.getSchemaName() + "' has already been declared"); } EPLValidationUtil.validateTableExists(services.getTableCompileTimeResolver(), spec.getSchemaName()); EventType eventType = handleCreateSchema(spec, services); CodegenPackageScope packageScope = new CodegenPackageScope(packageName, null, services.isInstrumented()); String aiFactoryProviderClassName = CodeGenerationIDGenerator.generateClassNameSimple(StatementAIFactoryProvider.class, classPostfix); StatementAgentInstanceFactoryCreateSchemaForge forge = new StatementAgentInstanceFactoryCreateSchemaForge(eventType); StmtClassForgableAIFactoryProviderCreateSchema aiFactoryForgable = new StmtClassForgableAIFactoryProviderCreateSchema(aiFactoryProviderClassName, packageScope, forge); SelectSubscriberDescriptor selectSubscriberDescriptor = new SelectSubscriberDescriptor(); StatementInformationalsCompileTime informationals = StatementInformationalsUtil.getInformationals(base, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), false, selectSubscriberDescriptor, packageScope, services); informationals.getProperties().put(StatementProperty.CREATEOBJECTNAME, spec.getSchemaName()); String statementProviderClassName = CodeGenerationIDGenerator.generateClassNameSimple(StatementProvider.class, classPostfix); StmtClassForgableStmtProvider stmtProvider = new StmtClassForgableStmtProvider(aiFactoryProviderClassName, statementProviderClassName, informationals, packageScope); List<StmtClassForgable> forgables = new ArrayList<>(); forgables.add(aiFactoryForgable); forgables.add(stmtProvider); return new StmtForgeMethodResult(forgables, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); }
isAny = true; } else { EventType eventType = services.getEventTypeCompileTimeResolver().getTypeByName(typeName); if (eventType == null) { throw new ExprValidationException("Event type by name '" + typeName + "' could not be found for use in variant stream by name '" + eventTypeName + "'");
ExprNodeUtilityPrint.toExpressionStringMinPrecedenceSafe(atom.getSplitterExpression()) + "'"); streamEventType = services.getEventTypeCompileTimeResolver().getTypeByName(atom.getOptionalResultEventType()); if (streamEventType == null) { throw new ExprValidationException("Event type by name '" + atom.getOptionalResultEventType() + "' could not be found");
EventType insertIntoTarget = insertIntoDesc == null ? null : args.getEventTypeCompileTimeResolver().getTypeByName(insertIntoDesc.getEventTypeName());
EventType existingType = args.getEventTypeCompileTimeResolver().getTypeByName(insertIntoDesc.getEventTypeName()); if (existingType != null) { processor = SelectExprInsertEventBeanFactory.getInsertUnderlyingJoinWildcard(existingType, streamNames, streamTypesWTables, args.getClasspathImportService(), args.getStatementName(), args.getEventTypeAvroHandler());
EventType existingType = services.getEventTypeCompileTimeResolver().getTypeByName(typeName); if (existingType != null && existingType.getMetadata().getTypeClass() != EventTypeTypeClass.NAMED_WINDOW) { throw new ExprValidationException("Error starting statement: An event type or schema by name '" + typeName + "' already exists");
insertIntoTargetType = args.getOptionalInsertIntoEventType(); } else { insertIntoTargetType = args.getEventTypeCompileTimeResolver().getTypeByName(insertIntoDesc.getEventTypeName()); if (insertIntoTargetType == null) { TableMetaData table = args.getTableCompileTimeResolver().resolve(insertIntoDesc.getEventTypeName());