Ejemplo n.º 1
0
 public void RegisterSerde(
     EventTypeMetadata metadata,
     DataInputOutputSerde underlyingSerde,
     Type underlyingClass)
 {
     _serdes.Add(new EventTypeCollectedSerde(metadata, underlyingSerde, underlyingClass));
 }
Ejemplo n.º 2
0
 public static ObjectArrayEventType MakeTransientOAType(
     string enumMethod,
     string propertyName,
     Type type,
     StatementRawInfo statementRawInfo,
     StatementCompileTimeServices services)
 {
     IDictionary<string, object> propsResult = new Dictionary<string, object>();
     propsResult.Put(propertyName, Boxing.GetBoxedType(type));
     var eventTypeName =
         services.EventTypeNameGeneratorStatement.GetAnonymousTypeNameEnumMethod(enumMethod, propertyName);
     var metadata = new EventTypeMetadata(
         eventTypeName,
         statementRawInfo.ModuleName,
         EventTypeTypeClass.ENUMDERIVED,
         EventTypeApplicationType.OBJECTARR,
         NameAccessModifier.TRANSIENT,
         EventTypeBusModifier.NONBUS,
         false,
         EventTypeIdPair.Unassigned());
     var oatype = BaseNestableEventUtil.MakeOATypeCompileTime(
         metadata,
         propsResult,
         null,
         null,
         null,
         null,
         services.BeanEventTypeFactoryPrivate,
         services.EventTypeCompileTimeResolver);
     services.EventTypeCompileTimeRegistry.NewType(oatype);
     return oatype;
 }
Ejemplo n.º 3
0
        public void RegisterXML(
            EventTypeMetadata metadata,
            string representsFragmentOfProperty,
            string representsOriginalTypeName)
        {
            var existing = _xmlFragmentEventTypeFactory.GetTypeByName(metadata.Name);
            if (existing != null) {
                HandleRegister(existing);
                return;
            }

            var schemaType = _xmlFragmentEventTypeFactory.GetRootTypeByName(representsOriginalTypeName);
            if (schemaType == null) {
                throw new EPException("Failed to find XML schema type '" + representsOriginalTypeName + "'");
            }

            var prop = PropertyParser.ParseAndWalkLaxToSimple(representsFragmentOfProperty);
            var schemaModelRoot = SchemaUtil.FindRootElement(
                schemaType.SchemaModel,
                schemaType.ConfigurationEventTypeXMLDOM.RootElementNamespace,
                schemaType.RootElementName);
            var item = prop.GetPropertyTypeSchema(schemaModelRoot);
            var complex = (SchemaElementComplex) item;
            var eventType = _xmlFragmentEventTypeFactory.GetCreateXMLDOMType(
                representsOriginalTypeName,
                metadata.Name,
                metadata.ModuleName,
                complex,
                representsFragmentOfProperty);
            HandleRegister(eventType);
        }
Ejemplo n.º 4
0
        public void RegisterXMLNewType(
            EventTypeMetadata metadata,
            ConfigurationCommonEventTypeXMLDOM config)
        {
            SchemaModel schemaModel = null;
            if ((config.SchemaResource != null) || (config.SchemaText != null)) {
                try {
                    schemaModel = XSDSchemaMapper.LoadAndMap(
                        config.SchemaResource,
                        config.SchemaText,
                        _container.ResourceManager());
                }
                catch (Exception ex) {
                    throw new EPException(ex.Message, ex);
                }
            }

            EventType eventType = _eventTypeFactory.CreateXMLType(
                metadata,
                config,
                schemaModel,
                null,
                metadata.Name,
                _beanEventTypeFactory,
                _xmlFragmentEventTypeFactory,
                _eventTypeNameResolver);
            HandleRegister(eventType);

            if (eventType is SchemaXMLEventType) {
                _xmlFragmentEventTypeFactory.AddRootType((SchemaXMLEventType) eventType);
            }
        }
Ejemplo n.º 5
0
        private static ObjectArrayEventType MakeTransientOATypeInternal(
            string enumMethod,
            IDictionary <string, object> boxedPropertyTypes,
            string eventTypeNameUUid,
            StatementRawInfo statementRawInfo,
            StatementCompileTimeServices services)
        {
            var eventTypeName =
                services.EventTypeNameGeneratorStatement.GetAnonymousTypeNameEnumMethod(enumMethod, eventTypeNameUUid);
            var metadata = new EventTypeMetadata(
                eventTypeName,
                statementRawInfo.ModuleName,
                EventTypeTypeClass.ENUMDERIVED,
                EventTypeApplicationType.OBJECTARR,
                NameAccessModifier.TRANSIENT,
                EventTypeBusModifier.NONBUS,
                false,
                EventTypeIdPair.Unassigned());
            var oatype = BaseNestableEventUtil.MakeOATypeCompileTime(
                metadata,
                boxedPropertyTypes,
                null,
                null,
                null,
                null,
                services.BeanEventTypeFactoryPrivate,
                services.EventTypeCompileTimeResolver);

            services.EventTypeCompileTimeRegistry.NewType(oatype);
            return(oatype);
        }
Ejemplo n.º 6
0
 public JsonEventType CreateJson(
     EventTypeMetadata metadata,
     IDictionary<String, Object> properties,
     string[] superTypes,
     string startTimestampPropertyName,
     string endTimestampPropertyName,
     BeanEventTypeFactory beanEventTypeFactory,
     EventTypeNameResolver eventTypeNameResolver,
     JsonEventTypeDetail detail)
 {
     var st = EventTypeUtility.GetSuperTypesDepthFirst(superTypes, EventUnderlyingType.JSON, eventTypeNameResolver);
     properties = BaseNestableEventUtil.ResolvePropertyTypes(properties, eventTypeNameResolver);
     var getterFactoryJson = new EventTypeNestableGetterFactoryJson(detail);
     // We use a null-stand-in class as the actual underlying class is provided later
     return new JsonEventType(
         metadata,
         properties,
         st.First,
         st.Second,
         startTimestampPropertyName,
         endTimestampPropertyName,
         getterFactoryJson,
         beanEventTypeFactory,
         detail,
         null,
         false);
 }
Ejemplo n.º 7
0
        public EventType CreateXMLType(
            EventTypeMetadata metadata,
            ConfigurationCommonEventTypeXMLDOM detail,
            SchemaModel schemaModel,
            string representsFragmentOfProperty,
            string representsOriginalTypeName,
            BeanEventTypeFactory beanEventTypeFactory,
            XMLFragmentEventTypeFactory xmlFragmentEventTypeFactory,
            EventTypeNameResolver eventTypeNameResolver)
        {
            if (metadata.IsPropertyAgnostic) {
                return new SimpleXMLEventType(
                    metadata,
                    detail,
                    beanEventTypeFactory.EventBeanTypedEventFactory,
                    eventTypeNameResolver,
                    xmlFragmentEventTypeFactory);
            }

            return new SchemaXMLEventType(
                metadata,
                detail,
                schemaModel,
                representsFragmentOfProperty,
                representsOriginalTypeName,
                beanEventTypeFactory.EventBeanTypedEventFactory,
                eventTypeNameResolver,
                xmlFragmentEventTypeFactory);
        }
 private static void BuildAvroType(
     EventTypeRepositoryImpl eventTypeRepositoryPreconfigured,
     string eventTypeName,
     ConfigurationCommonEventTypeAvro config,
     EventTypeAvroHandler eventTypeAvroHandler,
     EventBeanTypedEventFactory eventBeanTypedEventFactory)
 {
     var metadata = new EventTypeMetadata(
         eventTypeName,
         null,
         EventTypeTypeClass.APPLICATION,
         EventTypeApplicationType.AVRO,
         NameAccessModifier.PRECONFIGURED,
         EventTypeBusModifier.NONBUS,
         false,
         new EventTypeIdPair(CRC32Util.ComputeCRC32(eventTypeName), -1));
     var avroSuperTypes = EventTypeUtility.GetSuperTypesDepthFirst(
         config.SuperTypes,
         EventUnderlyingType.AVRO,
         eventTypeRepositoryPreconfigured);
     var newEventType = eventTypeAvroHandler.NewEventTypeFromSchema(
         metadata,
         eventBeanTypedEventFactory,
         config,
         avroSuperTypes.First,
         avroSuperTypes.Second);
     eventTypeRepositoryPreconfigured.AddType(newEventType);
 }
Ejemplo n.º 9
0
        public BeanEventType(
            IContainer container,
            BeanEventTypeStem stem,
            EventTypeMetadata metadata,
            BeanEventTypeFactory beanEventTypeFactory,
            EventType[] superTypes,
            ICollection<EventType> deepSuperTypes,
            string startTimestampPropertyName,
            string endTimestampPropertyName)
        {
            _container = container;
            Stem = stem;
            Metadata = metadata;
            _beanEventTypeFactory = beanEventTypeFactory;
            SuperTypes = superTypes;
            DeepSuperTypesCollection = deepSuperTypes;

            var desc = EventTypeUtility.ValidatedDetermineTimestampProps(
                this,
                startTimestampPropertyName,
                endTimestampPropertyName,
                superTypes);
            StartTimestampPropertyName = desc.Start;
            EndTimestampPropertyName = desc.End;
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Constructor takes a class as an argument.
        /// </summary>
        /// <param name="metadata">event type metadata</param>
        /// <param name="eventTypeId">The event type id.</param>
        /// <param name="clazz">is the class of an object</param>
        /// <param name="eventAdapterService">factory for event beans and event types</param>
        /// <param name="optionalLegacyDef">optional configuration supplying legacy event type information</param>
        public BeanEventType(EventTypeMetadata metadata,
                             int eventTypeId,
                             Type clazz,
                             EventAdapterService eventAdapterService,
                             ConfigurationEventTypeLegacy optionalLegacyDef)
        {
            Metadata             = metadata;
            UnderlyingType       = clazz;
            _eventAdapterService = eventAdapterService;
            OptionalLegacyDef    = optionalLegacyDef;
            EventTypeId          = eventTypeId;
            if (optionalLegacyDef != null)
            {
                FactoryMethodName       = optionalLegacyDef.FactoryMethod;
                _copyMethodName         = optionalLegacyDef.CopyMethod;
                PropertyResolutionStyle = optionalLegacyDef.PropertyResolutionStyle;
            }
            else
            {
                PropertyResolutionStyle = eventAdapterService.BeanEventTypeFactory.DefaultPropertyResolutionStyle;
            }
            _propertyGetterCache = new Dictionary <String, EventPropertyGetter>();

            Initialize(false);

            EventTypeUtility.TimestampPropertyDesc desc = EventTypeUtility.ValidatedDetermineTimestampProps(
                this,
                optionalLegacyDef == null ? null : optionalLegacyDef.StartTimestampPropertyName,
                optionalLegacyDef == null ? null : optionalLegacyDef.EndTimestampPropertyName,
                SuperTypes);
            StartTimestampPropertyName = desc.Start;
            EndTimestampPropertyName   = desc.End;
        }
Ejemplo n.º 11
0
        public static MapEventType MakeMapTypeCompileTime(
            EventTypeMetadata metadata,
            IDictionary<string, object> propertyTypes,
            EventType[] optionalSuperTypes,
            ISet<EventType> optionalDeepSupertypes,
            string startTimestampPropertyName,
            string endTimestampPropertyName,
            BeanEventTypeFactory beanEventTypeFactory,
            EventTypeCompileTimeResolver eventTypeCompileTimeResolver)
        {
            if (metadata.ApplicationType != EventTypeApplicationType.MAP) {
                throw new ArgumentException("Invalid application type " + metadata.ApplicationType);
            }

            IDictionary<string, object> verified = ResolvePropertyTypes(
                propertyTypes, eventTypeCompileTimeResolver);
            return new MapEventType(
                metadata,
                verified,
                optionalSuperTypes,
                optionalDeepSupertypes,
                startTimestampPropertyName,
                endTimestampPropertyName,
                beanEventTypeFactory);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates a new EventType object for a object of the specified class if this is the first time the class has been seen. Else uses a cached EventType instance, i.e. client classes do not need to cache.
        /// </summary>
        /// <param name="name">is the name</param>
        /// <param name="clazz">is the class of the object.</param>
        /// <param name="isPreconfiguredStatic">if from static engine config</param>
        /// <param name="isPreconfigured">if configured before use</param>
        /// <param name="isConfigured">if the class is a configuration value, false if discovered</param>
        /// <returns>EventType implementation for bean class</returns>
        public BeanEventType CreateBeanType(String name, Type clazz, bool isPreconfiguredStatic, bool isPreconfigured, bool isConfigured)
        {
            if (clazz == null)
            {
                throw new ArgumentException("Null value passed as class");
            }

            BeanEventType eventType;

            // not created yet, thread-safe create
            using (_typesPerObjectLock.Acquire())
            {
                eventType = _typesPerObject.Get(clazz);
                if (eventType != null)
                {
                    _eventTypeIdGenerator.AssignedType(name, eventType);
                    return(eventType);
                }

                // Check if we have a legacy type definition for this class
                ConfigurationEventTypeLegacy legacyDef = _typeToLegacyConfigs.Get(clazz.FullName);
                if ((legacyDef == null) && (_defaultAccessorStyle != AccessorStyleEnum.NATIVE))
                {
                    legacyDef = new ConfigurationEventTypeLegacy();
                    legacyDef.AccessorStyle = _defaultAccessorStyle;
                }

                int typeId = _eventTypeIdGenerator.GetTypeId(name);
                EventTypeMetadata metadata = EventTypeMetadata.CreateBeanType(name, clazz, isPreconfiguredStatic, isPreconfigured, isConfigured, TypeClass.APPLICATION);
                eventType = new BeanEventType(metadata, typeId, clazz, _eventAdapterService, legacyDef);
                _typesPerObject.Put(clazz, eventType);
            }

            return(eventType);
        }
Ejemplo n.º 13
0
        public AvroEventType(
            EventTypeMetadata metadata,
            Schema avroSchema,
            string startTimestampPropertyName,
            string endTimestampPropertyName,
            EventType[] optionalSuperTypes,
            ISet<EventType> deepSupertypes,
            EventBeanTypedEventFactory eventBeanTypedEventFactory,
            EventTypeAvroHandler eventTypeAvroHandler)
        {
            Metadata = metadata;
            _avroSchema = avroSchema;
            _optionalSuperTypes = optionalSuperTypes;
            _deepSupertypes = deepSupertypes ?? new EmptySet<EventType>();
            _propertyItems = new LinkedHashMap<string, PropertySetDescriptorItem>();
            _eventBeanTypedEventFactory = eventBeanTypedEventFactory;
            _eventTypeAvroHandler = eventTypeAvroHandler;

            Init();

            var desc = EventTypeUtility.ValidatedDetermineTimestampProps(
                this,
                startTimestampPropertyName,
                endTimestampPropertyName,
                optionalSuperTypes);
            StartTimestampPropertyName = desc.Start;
            EndTimestampPropertyName = desc.End;
        }
Ejemplo n.º 14
0
        public AvroEventType(
            EventTypeMetadata metadata,
            string eventTypeName,
            int typeId,
            EventAdapterService eventAdapterService,
            RecordSchema avroSchema,
            string startTimestampPropertyName,
            string endTimestampPropertyName,
            EventType[] optionalSuperTypes,
            ICollection<EventType> deepSupertypes)
        {
            _metadata = metadata;
            _typeId = typeId;
            _eventAdapterService = eventAdapterService;
            _avroSchema = avroSchema;
            _optionalSuperTypes = optionalSuperTypes;
            _deepSupertypes = deepSupertypes ?? Collections.GetEmptySet<EventType>();
            _propertyItems = new LinkedHashMap<string, PropertySetDescriptorItem>();

            Init();

            EventTypeUtility.TimestampPropertyDesc desc = EventTypeUtility.ValidatedDetermineTimestampProps(
                this, startTimestampPropertyName, endTimestampPropertyName, optionalSuperTypes);
            _startTimestampPropertyName = desc.Start;
            _endTimestampPropertyName = desc.End;
        }
Ejemplo n.º 15
0
 /// <summary>
 ///     Make a wrapper type.
 ///     A wrapper event type may indeed wrap another wrapper event type. This is so that a wrapper event bean can wrap
 ///     another wrapper event bean.
 ///     If there were unwrapped the nesting information such as what is the nested wrapper type and how they are nested
 ///     would be lost.
 /// </summary>
 /// <param name="metadata">metadata</param>
 /// <param name="underlyingEventType">underlying event type</param>
 /// <param name="propertyTypesMayPrimitive">property types</param>
 /// <param name="eventBeanTypedEventFactory">factory for instances</param>
 /// <param name="beanEventTypeFactory">bean event type factory</param>
 /// <param name="eventTypeNameResolver">type name resolver</param>
 /// <returns>wrapper type</returns>
 public static WrapperEventType MakeWrapper(
     EventTypeMetadata metadata,
     EventType underlyingEventType,
     IDictionary<string, object> propertyTypesMayPrimitive,
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     BeanEventTypeFactory beanEventTypeFactory,
     EventTypeNameResolver eventTypeNameResolver)
 {
     // If we are wrapping an underlying type that is itself a wrapper, then this is a special case
     if (underlyingEventType is WrapperEventType underlyingWrapperType) {
         // the underlying type becomes the type already wrapped
         // properties are a superset of the wrapped properties and the additional properties
         underlyingEventType = underlyingWrapperType.UnderlyingEventType;
         var propertiesSuperset = new Dictionary<string, object>();
         propertiesSuperset.PutAll(underlyingWrapperType.UnderlyingMapType.Types);
         propertiesSuperset.PutAll(propertyTypesMayPrimitive);
         propertyTypesMayPrimitive = propertiesSuperset;
     }
     
     IDictionary<string, object> verified = BaseNestableEventUtil.ResolvePropertyTypes(
         propertyTypesMayPrimitive,
         eventTypeNameResolver);
     return new WrapperEventType(
         metadata,
         underlyingEventType,
         verified,
         eventBeanTypedEventFactory,
         beanEventTypeFactory);
 }
Ejemplo n.º 16
0
 public JsonEventType(
     EventTypeMetadata metadata,
     IDictionary <string, object> propertyTypes,
     EventType[] optionalSuperTypes,
     ISet <EventType> optionalDeepSupertypes,
     string startTimestampPropertyName,
     string endTimestampPropertyName,
     EventTypeNestableGetterFactory getterFactory,
     BeanEventTypeFactory beanEventTypeFactory,
     JsonEventTypeDetail detail,
     Type underlyingStandInClass,
     bool underlyingTypeIsTransient)
     : base(
         metadata,
         propertyTypes,
         optionalSuperTypes,
         optionalDeepSupertypes,
         startTimestampPropertyName,
         endTimestampPropertyName,
         getterFactory,
         beanEventTypeFactory,
         true)
 {
     _detail                    = detail;
     _underlyingType            = underlyingStandInClass;
     _underlyingTypeIsTransient = underlyingTypeIsTransient;
 }
Ejemplo n.º 17
0
 public static EventType NewType(
     string name,
     LinkedHashMap<string, object> schemaMap,
     ViewForgeEnv env,
     int streamNum)
 {
     string outputEventTypeName =
         env.StatementCompileTimeServices.EventTypeNameGeneratorStatement.GetViewDerived(name, streamNum);
     EventTypeMetadata metadata = new EventTypeMetadata(
         outputEventTypeName,
         env.ModuleName,
         EventTypeTypeClass.VIEWDERIVED,
         EventTypeApplicationType.MAP,
         NameAccessModifier.TRANSIENT,
         EventTypeBusModifier.NONBUS,
         false,
         EventTypeIdPair.Unassigned());
     IDictionary<string, object> propertyTypes = EventTypeUtility.GetPropertyTypesNonPrimitive(schemaMap);
     EventType resultEventType = BaseNestableEventUtil.MakeMapTypeCompileTime(
         metadata,
         propertyTypes,
         null,
         null,
         null,
         null,
         env.BeanEventTypeFactoryProtected,
         env.EventTypeCompileTimeResolver);
     env.EventTypeModuleCompileTimeRegistry.NewType(resultEventType);
     return resultEventType;
 }
Ejemplo n.º 18
0
 protected abstract AvroSchemaEventType MakeType(
     EventTypeMetadata metadata,
     EventBeanTypedEventFactory eventAdapterService,
     Schema schema,
     ConfigurationCommonEventTypeAvro optionalConfig,
     EventType[] supertypes,
     ISet<EventType> deepSupertypes);
Ejemplo n.º 19
0
 private static BeanEventType MakeBeanType(
     string methodName,
     Type clazz,
     ExprValidationContext validationContext)
 {
     var eventTypeName =
         validationContext.StatementCompileTimeService.EventTypeNameGeneratorStatement
             .GetAnonymousTypeNameUDFMethod(methodName, clazz.Name);
     var metadata = new EventTypeMetadata(
         eventTypeName,
         validationContext.ModuleName,
         EventTypeTypeClass.UDFDERIVED,
         EventTypeApplicationType.CLASS,
         NameAccessModifier.TRANSIENT,
         EventTypeBusModifier.NONBUS,
         false,
         EventTypeIdPair.Unassigned());
     var stem = validationContext.StatementCompileTimeService.BeanEventTypeStemService
         .GetCreateStem(clazz, null);
     var beantype = new BeanEventType(
         validationContext.Container,
         stem,
         metadata,
         validationContext.StatementCompileTimeService.BeanEventTypeFactoryPrivate,
         null,
         null,
         null,
         null);
     validationContext.StatementCompileTimeService.EventTypeCompileTimeRegistry.NewType(beantype);
     return beantype;
 }
Ejemplo n.º 20
0
 static ExcludePlanHintExprUtil()
 {
     LinkedHashMap<string, object> properties = new LinkedHashMap<string, object>();
     properties.Put("from_streamnum", typeof(int?));
     properties.Put("to_streamnum", typeof(int?));
     properties.Put("from_streamname", typeof(string));
     properties.Put("to_streamname", typeof(string));
     properties.Put("opname", typeof(string));
     properties.Put("exprs", typeof(string[]));
     string eventTypeName = EventTypeNameUtil.GetAnonymousTypeNameExcludePlanHint();
     EventTypeMetadata eventTypeMetadata = new EventTypeMetadata(
         eventTypeName,
         null,
         EventTypeTypeClass.EXCLUDEPLANHINTDERIVED,
         EventTypeApplicationType.OBJECTARR,
         NameAccessModifier.TRANSIENT,
         EventTypeBusModifier.NONBUS,
         false,
         EventTypeIdPair.Unassigned());
     OAEXPRESSIONTYPE = BaseNestableEventUtil.MakeOATypeCompileTime(
         eventTypeMetadata,
         properties,
         null,
         null,
         null,
         null,
         new BeanEventTypeFactoryDisallow(EventBeanTypedEventFactoryCompileTime.INSTANCE),
         null);
 }
        /// <summary>
        ///     Ctor.
        /// </summary>
        /// <param name="revisionEventTypeName">name</param>
        /// <param name="spec">specification</param>
        /// <param name="statementStopService">for stop handling</param>
        /// <param name="eventAdapterService">for nested property handling</param>
        /// <param name="eventTypeIdGenerator">The event type id generator.</param>
        public VAERevisionProcessorDeclared(
            string revisionEventTypeName,
            RevisionSpec spec,
            StatementStopService statementStopService,
            EventAdapterService eventAdapterService,
            EventTypeIdGenerator eventTypeIdGenerator)
            : base(spec, revisionEventTypeName, eventAdapterService)
        {
            // on statement stop, remove versions
            statementStopService.StatementStopped += () => _statePerKey.Clear();

            _statePerKey    = new Dictionary <object, RevisionStateDeclared>().WithNullSupport();
            _baseEventType  = spec.BaseEventType;
            _fullKeyGetters = PropertyUtility.GetGetters(_baseEventType, spec.KeyPropertyNames);

            // sort non-key properties, removing keys
            _groups = PropertyUtility.AnalyzeGroups(spec.ChangesetPropertyNames, spec.DeltaTypes, spec.DeltaNames);
            var propertyDesc = CreatePropertyDescriptors(spec, _groups);

            TypeDescriptors = PropertyUtility.GetPerType(_groups, spec.ChangesetPropertyNames, spec.KeyPropertyNames);
            var metadata = EventTypeMetadata.CreateValueAdd(revisionEventTypeName, TypeClass.REVISION);

            RevisionEventType = new RevisionEventType(metadata, eventTypeIdGenerator.GetTypeId(revisionEventTypeName),
                                                      propertyDesc, eventAdapterService);
        }
Ejemplo n.º 22
0
 public EventType CreateMapType(IDictionary<string, object> map)
 {
     var metadata = new EventTypeMetadata(UuidGenerator.Generate(), null, EventTypeTypeClass.STREAM, EventTypeApplicationType.MAP, NameAccessModifier.INTERNAL, EventTypeBusModifier.NONBUS, false, EventTypeIdPair.Unassigned());
     return new MapEventType(
         metadata, map, null, null, null, null,
         BEAN_EVENT_TYPE_FACTORY);
 }
Ejemplo n.º 23
0
 private EventType GetAssignAnonymousType(
     StatementRawInfo statementRawInfo,
     StatementCompileTimeServices services)
 {
     IDictionary<string, object> rowType = RowType;
     var eventTypeName =
         services.EventTypeNameGeneratorStatement.GetAnonymousTypeSubselectMultirow(SubselectNumber);
     var metadata = new EventTypeMetadata(
         eventTypeName,
         statementRawInfo.ModuleName,
         EventTypeTypeClass.SUBQDERIVED,
         EventTypeApplicationType.MAP,
         NameAccessModifier.TRANSIENT,
         EventTypeBusModifier.NONBUS,
         false,
         EventTypeIdPair.Unassigned());
     var maptype = BaseNestableEventUtil.MakeMapTypeCompileTime(
         metadata,
         rowType,
         null,
         null,
         null,
         null,
         services.BeanEventTypeFactoryPrivate,
         services.EventTypeCompileTimeResolver);
     services.EventTypeCompileTimeRegistry.NewType(maptype);
     subselectMultirowType = maptype;
     return maptype;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="propertyDesc">describes each properties type</param>
        /// <param name="eventAdapterService">for nested property handling</param>
        /// <param name="metadata">- event type metadata</param>
        /// <param name="eventTypeId">type id</param>
        public RevisionEventType(
            EventTypeMetadata metadata,
            int eventTypeId,
            IDictionary <string, RevisionPropertyTypeDesc> propertyDesc,
            EventAdapterService eventAdapterService)
        {
            _metadata            = metadata;
            _eventTypeId         = eventTypeId;
            _propertyDesc        = propertyDesc;
            _propertyNames       = propertyDesc.Keys.ToArray();
            _eventAdapterService = eventAdapterService;

            _propertyDescriptors   = new EventPropertyDescriptor[propertyDesc.Count];
            _propertyDescriptorMap = new Dictionary <string, EventPropertyDescriptor>();
            var count = 0;

            foreach (var desc in propertyDesc)
            {
                var type       = (Type)desc.Value.PropertyType;
                var descriptor = new EventPropertyDescriptor(
                    desc.Key, type, null, false, false, false, false, type.IsFragmentableType());
                _propertyDescriptors[count] = descriptor;
                _propertyDescriptorMap.Put(desc.Key, descriptor);
                count++;
            }
        }
Ejemplo n.º 25
0
        private static EventType GetDefineMultimatchEventType(
            LinkedHashMap<string, Pair<int, bool>> variableStreams,
            EventType parentEventType,
            StatementBaseInfo @base,
            StatementCompileTimeServices services)
        {
            IDictionary<string, object> multievent = new LinkedHashMap<string, object>();
            foreach (var entry in variableStreams) {
                if (entry.Value.Second) {
                    multievent.Put(entry.Key, new[] {parentEventType});
                }
            }

            var multimatchAllTypeName = services.EventTypeNameGeneratorStatement.AnonymousRowrecogMultimatchAllName;
            var multimatchAllTypeMetadata = new EventTypeMetadata(
                multimatchAllTypeName,
                @base.ModuleName,
                EventTypeTypeClass.MATCHRECOGDERIVED,
                EventTypeApplicationType.OBJECTARR,
                NameAccessModifier.TRANSIENT,
                EventTypeBusModifier.NONBUS,
                false,
                EventTypeIdPair.Unassigned());
            var multimatchAllEventType = BaseNestableEventUtil.MakeOATypeCompileTime(
                multimatchAllTypeMetadata,
                multievent,
                null,
                null,
                null,
                null,
                services.BeanEventTypeFactoryPrivate,
                services.EventTypeCompileTimeResolver);
            services.EventTypeCompileTimeRegistry.NewType(multimatchAllEventType);
            return multimatchAllEventType;
        }
Ejemplo n.º 26
0
        private NamedWindowOnMergeActionIns SetupInsert(string namedWindowName, InternalEventRouter internalEventRouter, EventTypeSPI eventTypeNamedWindow, int selectClauseNumber, OnTriggerMergeActionInsert desc, EventType triggeringEventType, string triggeringStreamName, StatementContext statementContext)
        {
            // Compile insert-into INFO
            string streamName     = desc.OptionalStreamName ?? eventTypeNamedWindow.Name;
            var    insertIntoDesc = InsertIntoDesc.FromColumns(streamName, desc.Columns);

            // rewrite any wildcards to use "stream.wildcard"
            if (triggeringStreamName == null)
            {
                triggeringStreamName = UuidGenerator.Generate();
            }
            var selectNoWildcard = CompileSelectNoWildcard(triggeringStreamName, desc.SelectClauseCompiled);

            // Set up event types for select-clause evaluation: The first type does not contain anything as its the named window row which is not present for insert
            var dummyTypeNoProperties = new MapEventType(EventTypeMetadata.CreateAnonymous("merge_named_window_insert", ApplicationType.MAP), "merge_named_window_insert", 0, null, Collections.EmptyDataMap, null, null, null);
            var eventTypes            = new EventType[] { dummyTypeNoProperties, triggeringEventType };
            var streamNames           = new string[] { UuidGenerator.Generate(), triggeringStreamName };
            var streamTypeService     = new StreamTypeServiceImpl(eventTypes, streamNames, new bool[1], statementContext.EngineURI, false);

            // Get select expr processor
            var selectExprEventTypeRegistry = new SelectExprEventTypeRegistry(statementContext.StatementName, statementContext.StatementEventTypeRef);
            var exprEvaluatorContext        = new ExprEvaluatorContextStatement(statementContext, false);
            var insertHelper = SelectExprProcessorFactory.GetProcessor(
                statementContext.Container,
                Collections.SingletonList(selectClauseNumber),
                selectNoWildcard.ToArray(), false,
                insertIntoDesc, null, null, streamTypeService,
                statementContext.EventAdapterService,
                statementContext.StatementResultService,
                statementContext.ValueAddEventService,
                selectExprEventTypeRegistry,
                statementContext.EngineImportService,
                exprEvaluatorContext,
                statementContext.VariableService,
                statementContext.ScriptingService,
                statementContext.TableService,
                statementContext.TimeProvider,
                statementContext.EngineURI,
                statementContext.StatementId,
                statementContext.StatementName,
                statementContext.Annotations,
                statementContext.ContextDescriptor,
                statementContext.ConfigSnapshot, null,
                statementContext.NamedWindowMgmtService, null, null,
                statementContext.StatementExtensionServicesContext);
            var filterEval = desc.OptionalWhereClause == null ? null : desc.OptionalWhereClause.ExprEvaluator;

            var routerToUser = streamName.Equals(namedWindowName) ? null : internalEventRouter;
            var audit        = AuditEnum.INSERT.GetAudit(statementContext.Annotations) != null;

            string insertIntoTableName = null;

            if (statementContext.TableService.GetTableMetadata(insertIntoDesc.EventTypeName) != null)
            {
                insertIntoTableName = insertIntoDesc.EventTypeName;
            }

            return(new NamedWindowOnMergeActionIns(filterEval, insertHelper, routerToUser, insertIntoTableName, statementContext.TableService, statementContext.EpStatementHandle, statementContext.InternalEventEngineRouteDest, audit));
        }
Ejemplo n.º 27
0
        public void TestEquals()
        {
            EventTypeMetadata metadata = EventTypeMetadata.CreateNonPonoApplicationType(
                ApplicationType.MAP, "", true, true, true,
                false, false);

            IDictionary <String, Object> mapTwo = new LinkedHashMap <String, Object>();

            mapTwo["MyInt"]                 = typeof(int);
            mapTwo["mySupportBean"]         = typeof(SupportBean);
            mapTwo["myNullableSupportBean"] = typeof(SupportBean);
            mapTwo["myComplexBean"]         = typeof(SupportBeanComplexProps);
            Assert.IsFalse(
                (new MapEventType(metadata, "", 1, _eventAdapterService, mapTwo, null, null, null)).Equals(_eventType));
            mapTwo["MyString"]         = typeof(string);
            mapTwo["myNullableString"] = typeof(string);
            mapTwo["myNullType"]       = null;

            // compare, should equal
            Assert.IsTrue(
                new MapEventType(metadata, "", 1, _eventAdapterService, mapTwo, null, null, null).EqualsCompareType(
                    _eventType));
            Assert.IsFalse(
                (new MapEventType(metadata, "google", 1, _eventAdapterService, mapTwo, null, null, null)).
                EqualsCompareType(_eventType));

            mapTwo["xx"] = typeof(int);
            Assert.IsFalse(
                _eventType.EqualsCompareType(new MapEventType(metadata, "", 1, _eventAdapterService, mapTwo, null, null,
                                                              null)));
            mapTwo.Remove("xx");
            Assert.IsTrue(
                _eventType.EqualsCompareType(new MapEventType(metadata, "", 1, _eventAdapterService, mapTwo, null, null,
                                                              null)));

            mapTwo["MyInt"] = typeof(int?);
            Assert.IsTrue(
                _eventType.EqualsCompareType(new MapEventType(metadata, "", 1, _eventAdapterService, mapTwo, null, null,
                                                              null)));
            mapTwo.Remove("MyInt");
            Assert.IsFalse(
                _eventType.EqualsCompareType(new MapEventType(metadata, "", 1, _eventAdapterService, mapTwo, null, null,
                                                              null)));
            mapTwo["MyInt"] = typeof(int);
            Assert.IsTrue(
                _eventType.EqualsCompareType(new MapEventType(metadata, "", 1, _eventAdapterService, mapTwo, null, null,
                                                              null)));

            // Test boxed and primitive compatible
            IDictionary <String, Object> mapOne = new LinkedHashMap <String, Object>();

            mapOne["MyInt"] = typeof(int);
            mapTwo          = new LinkedHashMap <String, Object>();
            mapTwo["MyInt"] = typeof(int);

            Assert.IsTrue(
                new MapEventType(metadata, "T1", 1, _eventAdapterService, mapOne, null, null, null).EqualsCompareType(
                    new MapEventType(metadata, "T1", 1, _eventAdapterService, mapTwo, null, null, null)));
        }
Ejemplo n.º 28
0
        public static AvroEventType MakeAvroSupportEventType(Schema schema)
        {
            var metadata = EventTypeMetadata.CreateNonPonoApplicationType(
                ApplicationType.AVRO, "typename", true, true, true, false, false);

            return(new AvroEventType(
                       metadata, "typename", 1, SupportEventAdapterService.Service, schema.AsRecordSchema(), null, null, null, null));
        }
 public AvroSchemaEventType NewEventTypeFromJson(
     EventTypeMetadata metadata,
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     string schemaJson,
     IList<EventType> superTypes,
     ISet<EventType> deepSuperTypes)
 {
     throw new UnsupportedOperationException();
 }
 public AvroSchemaEventType NewEventTypeFromSchema(
     EventTypeMetadata metadata,
     EventBeanTypedEventFactory eventBeanTypedEventFactory,
     ConfigurationCommonEventTypeAvro requiredConfig,
     EventType[] supertypes,
     ISet<EventType> deepSupertypes)
 {
     throw new UnsupportedOperationException();
 }