private EventType HandleCreateSchema(
            EPServicesContext services,
            StatementContext statementContext,
            CreateSchemaDesc spec)
        {
            EventType eventType;

            try
            {
                if (spec.AssignedType != AssignedType.VARIANT)
                {
                    eventType = EventTypeUtility.CreateNonVariantType(
                        false, spec, statementContext.Annotations, services.ConfigSnapshot, services.EventAdapterService,
                        services.EngineImportService);
                }
                else
                {
                    if (spec.CopyFrom != null && !spec.CopyFrom.IsEmpty())
                    {
                        throw new ExprValidationException("Copy-from types are not allowed with variant types");
                    }

                    var isAny  = false;
                    var config = new ConfigurationVariantStream();
                    foreach (var typeName in spec.Types)
                    {
                        if (typeName.Trim().Equals("*"))
                        {
                            isAny = true;
                            break;
                        }
                        config.AddEventTypeName(typeName);
                    }
                    if (!isAny)
                    {
                        config.TypeVariance = TypeVarianceEnum.PREDEFINED;
                    }
                    else
                    {
                        config.TypeVariance = TypeVarianceEnum.ANY;
                    }
                    services.ValueAddEventService.AddVariantStream(
                        spec.SchemaName, config, services.EventAdapterService, services.EventTypeIdGenerator);
                    eventType = services.ValueAddEventService.GetValueAddProcessor(spec.SchemaName).ValueAddEventType;
                }
            }
            catch (Exception ex)
            {
                throw new ExprValidationException(ex.Message, ex);
            }

            return(eventType);
        }
Example #2
0
        private EventType HandleCreateSchema(
            CreateSchemaDesc spec,
            StatementCompileTimeServices services)
        {
            EventType eventType;

            try {
                if (spec.AssignedType != AssignedType.VARIANT) {
                    eventType = EventTypeUtility.CreateNonVariantType(false, spec, @base, services);
                }
                else {
                    eventType = HandleVariantType(spec, services);
                }
            }
            catch (EPException) {
                throw;
            }
            catch (Exception ex) {
                throw new ExprValidationException(ex.Message, ex);
            }

            return eventType;
        }
        private EventTypeForgeablesPair HandleCreateSchema(
            CreateSchemaDesc spec,
            StatementCompileTimeServices services)
        {
            EventTypeForgeablesPair pair;

            try {
                if (spec.AssignedType != AssignedType.VARIANT) {
                    pair = EventTypeUtility.CreateNonVariantType(false, spec, @base, services);
                }
                else {
                    var eventType = HandleVariantType(spec, services);  
                    pair = new EventTypeForgeablesPair(eventType, EmptyList<StmtClassForgeableFactory>.Instance);
                }
            }
            catch (EPException) {
                throw;
            }
            catch (Exception ex) {
                throw new ExprValidationException(ex.Message, ex);
            }

            return pair;
        }