public BeanEventTypeStem( Type clazz, ConfigurationCommonEventTypeBean optionalLegacyDef, string[] propertyNames, IDictionary<string, PropertyInfo> simpleProperties, IDictionary<string, PropertyStem> mappedPropertyDescriptors, IDictionary<string, PropertyStem> indexedPropertyDescriptors, Type[] superTypes, ISet<Type> deepSuperTypes, PropertyResolutionStyle propertyResolutionStyle, IDictionary<string, IList<PropertyInfo>> simpleSmartPropertyTable, IDictionary<string, IList<PropertyInfo>> indexedSmartPropertyTable, IDictionary<string, IList<PropertyInfo>> mappedSmartPropertyTable, IList<EventPropertyDescriptor> propertyDescriptors, IDictionary<string, EventPropertyDescriptor> propertyDescriptorMap) { Clazz = clazz; OptionalLegacyDef = optionalLegacyDef; PropertyNames = propertyNames; SimpleProperties = simpleProperties; MappedPropertyDescriptors = mappedPropertyDescriptors; IndexedPropertyDescriptors = indexedPropertyDescriptors; SuperTypes = superTypes; DeepSuperTypes = deepSuperTypes; PropertyResolutionStyle = propertyResolutionStyle; SimpleSmartPropertyTable = simpleSmartPropertyTable; IndexedSmartPropertyTable = indexedSmartPropertyTable; MappedSmartPropertyTable = mappedSmartPropertyTable; PropertyDescriptors = propertyDescriptors; PropertyDescriptorMap = propertyDescriptorMap; }
/// <summary> /// Ctor. /// </summary> /// <param name="legacyConfig"> /// is a legacy type specification containing information about explicitly configured fields and methods /// </param> public PropertyListBuilderExplicit(ConfigurationCommonEventTypeBean legacyConfig) { if (legacyConfig == null) { throw new ArgumentException("Required configuration not passed"); } this.legacyConfig = legacyConfig; }
public void SetUp() { var config = new ConfigurationCommonEventTypeBean(); // add 2 explicit properties, also supported config.AddFieldProperty("x", "fieldNested"); config.AddMethodProperty("y", "ReadLegacyBeanVal"); builder = new PropertyListBuilderNative(config); }
private void TryInvalidConfig( Type beanEventClass, ConfigurationCommonEventTypeBean configBean, string expected) { TryInvalidConfigurationCompileAndRuntime( SupportConfigFactory.GetConfiguration(), config => config.Common.AddEventType(beanEventClass.Name, beanEventClass.FullName, configBean), expected); }
private static void Configure(Configuration configuration) { foreach (var clazz in new[] { typeof(SupportBean), typeof(SupportBean_A), typeof(SupportBean_B), typeof(SupportBean_S0), typeof(SupportBean_S1), typeof(SupportBean_S2) }) { configuration.Common.AddEventType(clazz.Name, clazz); } configuration.Common.AddEventType( "MyOAEventType", new[] {"p0", "p1"}, new object[] {typeof(string), typeof(int)}); var legacy = new ConfigurationCommonEventTypeBean(); configuration.Common.AddEventType("MyLegacyEvent", typeof(EPLDataflowOpBeaconSource.MyLegacyEvent), legacy); configuration.Common.AddEventType( "MyEventNoDefaultCtor", typeof(EPLDataflowOpBeaconSource.MyEventNoDefaultCtor)); configuration.Compiler.AddPlugInSingleRowFunction( "generateTagId", typeof(EPLDataflowOpBeaconSource), "GenerateTagId"); DefaultSupportGraphEventUtil.AddTypeConfiguration(configuration); configuration.Common.AddImportType(typeof(Randomizer)); configuration.Common.AddImportNamespace(typeof(DefaultSupportSourceOp)); configuration.Common.AddImportNamespace(typeof(DefaultSupportCaptureOp)); configuration.Common.AddImportType(typeof(EPLDataflowCustomProperties.MyOperatorOneForge)); configuration.Common.AddImportType(typeof(EPLDataflowCustomProperties.MyOperatorTwoForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIOpLifecycle.SupportGraphSourceForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIOpLifecycle.SupportOperatorForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIExceptions.MyExceptionOpForge)); configuration.Common.AddImportType(typeof(EPLDataflowAPIOpLifecycle.MyCaptureOutputPortOpForge)); configuration.Common.AddImportType(typeof(EPLDataflowExampleRollingTopWords)); configuration.Common.AddImportType(typeof(EPLDataflowInputOutputVariations.MyFactorialOp)); configuration.Common.AddImportType(typeof(EPLDataflowInputOutputVariations.MyCustomOp)); configuration.Common.AddImportType(typeof(EPLDataflowInvalidGraph.MyInvalidOpForge)); configuration.Common.AddImportType(typeof(EPLDataflowInvalidGraph.MyTestOp)); configuration.Common.AddImportType(typeof(EPLDataflowInvalidGraph.MySBInputOp)); configuration.Common.AddImportType(typeof(EPLDataflowTypes.MySupportBeanOutputOp)); configuration.Common.AddImportType(typeof(EPLDataflowTypes.MyMapOutputOp)); configuration.Common.AddImportType(typeof(MyLineFeedSource)); configuration.Common.AddImportType(typeof(EPLDataflowAPIInstantiationOptions.MyOpForge)); configuration.Common.AddImportNamespace(typeof(MyObjectArrayGraphSource)); configuration.Common.AddImportNamespace(typeof(MyTokenizerCounter)); configuration.Common.AddImportType(typeof(SupportBean)); }
public void TestEventBeanPropertyResolutionCaseInsensitiveConfigureType() { RegressionSession session = RegressionRunner.Session(); ConfigurationCommonEventTypeBean beanWithCaseInsensitive = new ConfigurationCommonEventTypeBean(); beanWithCaseInsensitive.PropertyResolutionStyle = PropertyResolutionStyle.CASE_INSENSITIVE; session.Configuration.Common.AddEventType("BeanWithCaseInsensitive", typeof(SupportBean), beanWithCaseInsensitive); RegressionRunner.Run(session, new EventBeanPropertyResolutionCaseInsensitiveConfigureType()); session.Dispose(); }
/// <summary> /// Populates explicitly-defined properties into the result list. /// </summary> /// <param name="result">is the resulting list of event property descriptors</param> /// <param name="clazz">is the class to introspect</param> /// <param name="legacyConfig">supplies specification of explicit methods and fields to expose</param> protected internal static void GetExplicitProperties( IList<PropertyStem> result, Type clazz, ConfigurationCommonEventTypeBean legacyConfig) { foreach (var desc in legacyConfig.FieldProperties) { result.Add(MakeDesc(clazz, desc)); } foreach (var desc in legacyConfig.MethodProperties) { result.Add(MakeDesc(clazz, desc)); } }
public BeanEventTypeStemBuilder( ConfigurationCommonEventTypeBean optionalConfig, PropertyResolutionStyle defaultPropertyResolutionStyle) { _optionalConfig = optionalConfig; if (optionalConfig != null) { _propertyResolutionStyle = optionalConfig.PropertyResolutionStyle; } else { _propertyResolutionStyle = defaultPropertyResolutionStyle; } _smartResolutionStyle = _propertyResolutionStyle.Equals(PropertyResolutionStyle.CASE_INSENSITIVE) || _propertyResolutionStyle.Equals(PropertyResolutionStyle.DISTINCT_CASE_INSENSITIVE); }
private void TryInvalidField(string fieldName, Type clazz) { ConfigurationCommonEventTypeBean config = new ConfigurationCommonEventTypeBean(); config.AddFieldProperty("name", fieldName); builder = new PropertyListBuilderExplicit(config); try { builder.AssessProperties(clazz); } catch (ConfigurationException ex) { // expected log.Debug(ex.Message); } }
public BeanEventTypeStem GetCreateStem( Type clazz, ConfigurationCommonEventTypeBean optionalConfiguration) { var stem = _stems.Get(clazz); if (stem != null) { return stem; } if (optionalConfiguration == null && _defaultAccessorStyle != AccessorStyle.NATIVE) { optionalConfiguration = new ConfigurationCommonEventTypeBean(); optionalConfiguration.AccessorStyle = _defaultAccessorStyle; } stem = new BeanEventTypeStemBuilder(optionalConfiguration, _defaultPropertyResolutionStyle).Make(clazz); _stems.Put(clazz, stem); return stem; }
public void SetUp() { ConfigurationCommonEventTypeBean config = new ConfigurationCommonEventTypeBean(); config.AddFieldProperty("f_legVal", "fieldLegacyVal"); config.AddFieldProperty("f_strArr", "fieldStringArray"); config.AddFieldProperty("f_strMap", "fieldMapped"); config.AddFieldProperty("f_legNested", "fieldNested"); config.AddMethodProperty("m_legVal", "ReadLegacyBeanVal"); config.AddMethodProperty("m_strArr", "ReadStringArray"); config.AddMethodProperty("m_strInd", "ReadStringIndexed"); config.AddMethodProperty("m_strMapKeyed", "ReadMapByKey"); config.AddMethodProperty("m_strMap", "ReadMap"); config.AddMethodProperty("m_legNested", "ReadLegacyNested"); builder = new PropertyListBuilderExplicit(config); }
public BeanEventType GetCreateBeanType(Type clazz, bool publicFields) { var existing = types.Get(clazz); if (existing != null) { return existing; } // check-allocate bean-stem ConfigurationCommonEventTypeBean config = null; if (publicFields) { config = new ConfigurationCommonEventTypeBean(); config.AccessorStyle = AccessorStyle.PUBLIC; } var stem = stemFactory.GetCreateStem(clazz, config); // metadata var metadata = new EventTypeMetadata( clazz.FullName, null, EventTypeTypeClass.BEAN_INCIDENTAL, EventTypeApplicationType.CLASS, NameAccessModifier.TRANSIENT, EventTypeBusModifier.NONBUS, false, ComputeTypeId(clazz.Name)); // supertypes var superTypes = GetSuperTypes(stem.SuperTypes); var deepSuperTypes = GetDeepSupertypes(stem.DeepSuperTypes); // bean type var eventType = EventTypeFactory.CreateBeanType( stem, metadata, this, superTypes, deepSuperTypes, null, null); types.Put(clazz, eventType); return eventType; }
/// <summary> /// Creates an implementation for a builer considering the accessor style and /// code generation flags for a given class. /// </summary> /// <param name="optionalLegacyClassConfigs">configures how event property listy is build</param> /// <returns>builder/introspector implementation</returns> public static PropertyListBuilder CreateBuilder(ConfigurationCommonEventTypeBean optionalLegacyClassConfigs) { if (optionalLegacyClassConfigs == null) { return new PropertyListBuilderNative(null); } if (optionalLegacyClassConfigs.AccessorStyle == AccessorStyle.NATIVE) { return new PropertyListBuilderNative(optionalLegacyClassConfigs); } if (optionalLegacyClassConfigs.AccessorStyle == AccessorStyle.EXPLICIT) { return new PropertyListBuilderExplicit(optionalLegacyClassConfigs); } if (optionalLegacyClassConfigs.AccessorStyle == AccessorStyle.PUBLIC) { return new PropertyListBuilderPublic(optionalLegacyClassConfigs); } throw new ArgumentException("Cannot match accessor style to property list builder"); }
public void TestEventBeanPublicFields() { RegressionSession session = RegressionRunner.Session(); ConfigurationCommonEventTypeBean legacyDef = new ConfigurationCommonEventTypeBean(); legacyDef.AccessorStyle = AccessorStyle.PUBLIC; session.Configuration.Common.AddEventType("MyLegacyNestedEvent", typeof(SupportLegacyBean.LegacyNested), legacyDef); ConfigurationCommonEventTypeBean anotherLegacyEvent = new ConfigurationCommonEventTypeBean(); anotherLegacyEvent.AccessorStyle = AccessorStyle.PUBLIC; anotherLegacyEvent.AddFieldProperty("explicitFSimple", "fieldLegacyVal"); anotherLegacyEvent.AddFieldProperty("explicitFIndexed", "fieldStringArray"); anotherLegacyEvent.AddFieldProperty("explicitFNested", "fieldNested"); anotherLegacyEvent.AddMethodProperty("explicitMSimple", "ReadLegacyBeanVal"); anotherLegacyEvent.AddMethodProperty("explicitMArray", "ReadStringArray"); anotherLegacyEvent.AddMethodProperty("explicitMIndexed", "ReadStringIndexed"); anotherLegacyEvent.AddMethodProperty("explicitMMapped", "ReadMapByKey"); session.Configuration.Common.AddEventType("AnotherLegacyEvent", typeof(SupportLegacyBean), anotherLegacyEvent); RegressionRunner.Run(session, new EventBeanPublicAccessors()); session.Dispose(); }
public void TestEventBeanExplicitOnly() { RegressionSession session = RegressionRunner.Session(); ConfigurationCommonEventTypeBean legacyDef = new ConfigurationCommonEventTypeBean(); legacyDef.AccessorStyle = AccessorStyle.EXPLICIT; legacyDef.AddFieldProperty("explicitFNested", "fieldNested"); legacyDef.AddMethodProperty("explicitMNested", "ReadLegacyNested"); session.Configuration.Common.AddEventType("MyLegacyEvent", typeof(SupportLegacyBean), legacyDef); legacyDef = new ConfigurationCommonEventTypeBean(); legacyDef.AccessorStyle = AccessorStyle.EXPLICIT; legacyDef.AddFieldProperty("fieldNestedClassValue", "fieldNestedValue"); legacyDef.AddMethodProperty("readNestedClassValue", "ReadNestedValue"); session.Configuration.Common.AddEventType("MyLegacyNestedEvent", typeof(SupportLegacyBean.LegacyNested), legacyDef); ConfigurationCommonEventTypeBean mySupportBean = new ConfigurationCommonEventTypeBean(); mySupportBean.AccessorStyle = AccessorStyle.EXPLICIT; session.Configuration.Common.AddEventType("MySupportBean", typeof(SupportBean), mySupportBean); RegressionRunner.Run(session, new EventBeanExplicitOnly()); session.Dispose(); }
public void TestInvalidConfigure() { var configBean = new ConfigurationCommonEventTypeBean(); configBean.StartTimestampPropertyName = null; configBean.EndTimestampPropertyName = "DateTimeEx"; TryInvalidConfig(typeof(SupportDateTime), configBean, "Declared end timestamp property requires that a start timestamp property is also declared"); configBean.StartTimestampPropertyName = "xyz"; configBean.EndTimestampPropertyName = null; TryInvalidConfig(typeof(SupportBean), configBean, "Declared start timestamp property name 'xyz' was not found"); configBean.StartTimestampPropertyName = "LongPrimitive"; configBean.EndTimestampPropertyName = "xyz"; TryInvalidConfig(typeof(SupportBean), configBean, "Declared end timestamp property name 'xyz' was not found"); configBean.EndTimestampPropertyName = null; configBean.StartTimestampPropertyName = "TheString"; TryInvalidConfig( typeof(SupportBean), configBean, "Declared start timestamp property 'TheString' is expected to return a DateTimeEx, DateTime, DateTimeOffset or long-typed value but returns 'System.String'"); configBean.StartTimestampPropertyName = "LongPrimitive"; configBean.EndTimestampPropertyName = "TheString"; TryInvalidConfig( typeof(SupportBean), configBean, "Declared end timestamp property 'TheString' is expected to return a DateTimeEx, DateTime, DateTimeOffset or long-typed value but returns 'System.String'"); configBean.StartTimestampPropertyName = "LongDate"; configBean.EndTimestampPropertyName = "DateTimeEx"; TryInvalidConfig( typeof(SupportDateTime), configBean, "Declared end timestamp property 'DateTimeEx' is expected to have the same property type as the start-timestamp property 'LongDate'"); }
private static void Configure(Configuration configuration) { configuration.Common.AddImportType(typeof(DateTimeParsingFunctions)); foreach (var clazz in new[] { typeof(SupportDateTime), typeof(SupportTimeStartEndA), typeof(SupportBean), typeof(SupportEventWithJustGet), typeof(SupportBean_ST0_Container) }) { configuration.Common.AddEventType(clazz); } IDictionary<string, object> meta = new Dictionary<string, object>(); meta.Put("timeTaken", typeof(DateTimeEx)); configuration.Common.AddEventType("RFIDEvent", meta); var common = configuration.Common; common.AddVariable("V_START", typeof(long), -1); common.AddVariable("V_END", typeof(long), -1); var leg = new ConfigurationCommonEventTypeBean(); leg.StartTimestampPropertyName = "LongdateStart"; configuration.Common.AddEventType("A", typeof(SupportTimeStartEndA), leg); configuration.Common.AddEventType("B", typeof(SupportTimeStartEndB), leg); var configBean = new ConfigurationCommonEventTypeBean(); configBean.StartTimestampPropertyName = "LongdateStart"; configBean.EndTimestampPropertyName = "LongdateEnd"; configuration.Common.AddEventType("SupportTimeStartEndA", typeof(SupportTimeStartEndA), configBean); configuration.Common.AddEventType("SupportTimeStartEndB", typeof(SupportTimeStartEndB), configBean); configuration.Common.AddImportType(typeof(DateTime)); configuration.Common.AddImportType(typeof(SupportBean_ST0_Container)); configuration.Compiler.AddPlugInSingleRowFunction( "makeTest", typeof(SupportBean_ST0_Container), "MakeTest"); foreach (var fieldType in EnumHelper.GetValues<SupportDateTimeFieldType>()) { var oa = new ConfigurationCommonEventTypeObjectArray(); oa.StartTimestampPropertyName = "startTS"; oa.EndTimestampPropertyName = "endTS"; configuration.Common.AddEventType( "A_" + fieldType.GetName(), new[] {"startTS", "endTS"}, new object[] { fieldType.GetFieldType(), fieldType.GetFieldType() }, oa); configuration.Common.AddEventType( "B_" + fieldType.GetName(), new[] {"startTS", "endTS"}, new object[] { fieldType.GetFieldType(), fieldType.GetFieldType() }, oa); } AddIdStsEtsEvent(configuration); }
private static void Configure(Configuration configuration) { var myLegacyNestedEvent = new ConfigurationCommonEventTypeBean(); myLegacyNestedEvent.AccessorStyle = AccessorStyle.EXPLICIT; myLegacyNestedEvent.AddFieldProperty("fieldNestedClassValue", "fieldNestedValue"); myLegacyNestedEvent.AddMethodProperty("readNestedClassValue", "ReadNestedValue"); configuration.Common.AddEventType( "MyLegacyNestedEvent", typeof(SupportLegacyBean.LegacyNested), myLegacyNestedEvent); foreach (var clazz in new[] { typeof(SupportBean), typeof(SupportOverrideOne), typeof(SupportOverrideOneA), typeof(SupportOverrideBase), typeof(SupportOverrideOneB), typeof(ISupportBaseAB), typeof(ISupportA), typeof(ISupportB), typeof(ISupportC), typeof(ISupportAImplSuperG), typeof(ISupportAImplSuperGImplPlus), typeof(SupportBeanComplexProps), typeof(SupportBeanWriteOnly), typeof(SupportBeanDupProperty), typeof(SupportBeanCombinedProps) }) { configuration.Common.AddEventType(clazz.Name, clazz); } configuration.Common.AddEventType("SomeKeywords", typeof(SupportBeanReservedKeyword)); configuration.Common.AddEventType("Order", typeof(SupportBeanReservedKeyword)); var myFinalEvent = new ConfigurationCommonEventTypeBean(); myFinalEvent.AccessorStyle = AccessorStyle.NATIVE; configuration.Common.AddEventType("MyFinalEvent", typeof(SupportBeanFinal), myFinalEvent); var myLegacyTwo = new ConfigurationCommonEventTypeBean(); myLegacyTwo.AccessorStyle = AccessorStyle.NATIVE; myLegacyTwo.AddFieldProperty("explicitFInt", "fieldIntPrimitive"); myLegacyTwo.AddMethodProperty("explicitMGetInt", "GetIntPrimitive"); myLegacyTwo.AddMethodProperty("explicitMReadInt", "ReadIntPrimitive"); configuration.Common.AddEventType("MyLegacyTwo", typeof(SupportLegacyBeanInt), myLegacyTwo); IDictionary<string, object> def = new Dictionary<string, object>(); def.Put("Mapped", new Dictionary<string, object>()); def.Put("Indexed", typeof(int[])); configuration.Common.AddEventType("MapEvent", def); IDictionary<string, object> defType = new Dictionary<string, object>(); defType.Put("name", typeof(string)); defType.Put("value", typeof(string)); defType.Put("properties", typeof(IDictionary<string, object>)); configuration.Common.AddEventType("InputEvent", defType); configuration.Common.AddEventType( "ObjectArrayEvent", new[] {"Mapped", "Indexed"}, new object[] {new Dictionary<string, object>(), typeof(int[])}); var myEventWithField = new ConfigurationCommonEventTypeBean(); myEventWithField.AccessorStyle = AccessorStyle.PUBLIC; configuration.Common.AddEventType( typeof(EventBeanPropertyIterableMapList.MyEventWithField).Name, typeof(EventBeanPropertyIterableMapList.MyEventWithField), myEventWithField); var configNoCglib = new ConfigurationCommonEventTypeBean(); configuration.Common.AddEventType( typeof(EventBeanPropertyIterableMapList.MyEventWithMethod).Name, typeof(EventBeanPropertyIterableMapList.MyEventWithMethod), configNoCglib); IDictionary<string, object> mapOuter = new Dictionary<string, object>(); mapOuter.Put("p0int", typeof(int)); mapOuter.Put("p0intarray", typeof(int[])); mapOuter.Put("p0map", typeof(IDictionary<string, object>)); configuration.Common.AddEventType("MSTypeOne", mapOuter); string[] props = {"p0int", "p0intarray", "p0map"}; object[] types = {typeof(int), typeof(int[]), typeof(IDictionary<string, object>)}; configuration.Common.AddEventType("OASimple", props, types); IDictionary<string, object> frostyLev0 = new Dictionary<string, object>(); frostyLev0.Put("p1id", typeof(int)); configuration.Common.AddEventType("FrostyLev0", frostyLev0); IDictionary<string, object> frosty = new Dictionary<string, object>(); frosty.Put("p0simple", "FrostyLev0"); frosty.Put("p0bean", typeof(SupportBeanComplexProps)); configuration.Common.AddEventType("Frosty", frosty); configuration.Common.AddEventType( "WheatLev0", new[] {"p1id"}, new object[] {typeof(int)}); configuration.Common.AddEventType( "WheatRoot", new[] {"p0simple", "p0bean"}, new object[] {"WheatLev0", typeof(SupportBeanComplexProps)}); IDictionary<string, object> homerunLev0 = new Dictionary<string, object>(); homerunLev0.Put("p1id", typeof(int)); configuration.Common.AddEventType("HomerunLev0", homerunLev0); IDictionary<string, object> homerunRoot = new Dictionary<string, object>(); homerunRoot.Put("p0simple", "HomerunLev0"); homerunRoot.Put("p0array", "HomerunLev0[]"); configuration.Common.AddEventType("HomerunRoot", homerunRoot); configuration.Common.AddEventType("GoalLev0", new[] {"p1id"}, new object[] {typeof(int)}); configuration.Common.AddEventType( "GoalRoot", new[] {"p0simple", "p0array"}, new object[] {"GoalLev0", "GoalLev0[]"}); IDictionary<string, object> flywheelTypeLev0 = new Dictionary<string, object>(); flywheelTypeLev0.Put("p1id", typeof(int)); IDictionary<string, object> flywheelRoot = new Dictionary<string, object>(); flywheelRoot.Put("p0simple", flywheelTypeLev0); configuration.Common.AddEventType("FlywheelRoot", flywheelRoot); IDictionary<string, object> gistInner = new Dictionary<string, object>(); gistInner.Put("p2id", typeof(int)); configuration.Common.AddEventType("GistInner", gistInner); IDictionary<string, object> typeMap = new Dictionary<string, object>(); typeMap.Put("id", typeof(int)); typeMap.Put("bean", typeof(SupportBean)); typeMap.Put("beanarray", typeof(SupportBean[])); typeMap.Put("complex", typeof(SupportBeanComplexProps)); typeMap.Put("complexarray", typeof(SupportBeanComplexProps[])); typeMap.Put("map", "GistInner"); typeMap.Put("maparray", "GistInner[]"); configuration.Common.AddEventType("GistMapOne", typeMap); configuration.Common.AddEventType("GistMapTwo", typeMap); configuration.Common.AddEventType("CashInner", new[] {"p2id"}, new object[] {typeof(int)}); string[] propsCash = {"id", "bean", "beanarray", "complex", "complexarray", "map", "maparray"}; object[] typesCash = { typeof(int), typeof(SupportBean), typeof(SupportBean[]), typeof(SupportBeanComplexProps), typeof(SupportBeanComplexProps[]), "CashInner", "CashInner[]" }; configuration.Common.AddEventType("CashMapOne", propsCash, typesCash); configuration.Common.AddEventType("CashMapTwo", propsCash, typesCash); IDictionary<string, object> txTypeLev0 = new Dictionary<string, object>(); txTypeLev0.Put("p1simple", typeof(SupportBean)); txTypeLev0.Put("p1array", typeof(SupportBean[])); txTypeLev0.Put("p1complex", typeof(SupportBeanComplexProps)); txTypeLev0.Put("p1complexarray", typeof(SupportBeanComplexProps[])); configuration.Common.AddEventType("TXTypeLev0", txTypeLev0); IDictionary<string, object> txTypeRoot = new Dictionary<string, object>(); txTypeRoot.Put("p0simple", "TXTypeLev0"); txTypeRoot.Put("p0array", "TXTypeLev0[]"); configuration.Common.AddEventType("TXTypeRoot", txTypeRoot); string[] localTypeLev0 = {"p1simple", "p1array", "p1complex", "p1complexarray"}; object[] typesLev0 = { typeof(SupportBean), typeof(SupportBean[]), typeof(SupportBeanComplexProps), typeof(SupportBeanComplexProps[]) }; configuration.Common.AddEventType("LocalTypeLev0", localTypeLev0, typesLev0); string[] localTypeRoot = {"p0simple", "p0array"}; object[] typesOuter = {"LocalTypeLev0", "LocalTypeLev0[]"}; configuration.Common.AddEventType("LocalTypeRoot", localTypeRoot, typesOuter); IDictionary<string, object> jimTypeLev1 = new Dictionary<string, object>(); jimTypeLev1.Put("p2id", typeof(int)); configuration.Common.AddEventType("JimTypeLev1", jimTypeLev1); IDictionary<string, object> jimTypeLev0 = new Dictionary<string, object>(); jimTypeLev0.Put("p1simple", "JimTypeLev1"); jimTypeLev0.Put("p1array", "JimTypeLev1[]"); configuration.Common.AddEventType("JimTypeLev0", jimTypeLev0); IDictionary<string, object> jimTypeRoot = new Dictionary<string, object>(); jimTypeRoot.Put("p0simple", "JimTypeLev0"); jimTypeRoot.Put("p0array", "JimTypeLev0[]"); configuration.Common.AddEventType("JimTypeRoot", jimTypeRoot); configuration.Common.AddEventType("JackTypeLev1", new[] {"p2id"}, new object[] {typeof(int)}); configuration.Common.AddEventType( "JackTypeLev0", new[] {"p1simple", "p1array"}, new object[] {"JackTypeLev1", "JackTypeLev1[]"}); configuration.Common.AddEventType( "JackTypeRoot", new[] {"p0simple", "p0array"}, new object[] {"JackTypeLev0", "JackTypeLev0[]"}); IDictionary<string, object> mmInner = new Dictionary<string, object>(); mmInner.Put("p2id", typeof(int)); IDictionary<string, object> mmInnerMap = new Dictionary<string, object>(); mmInnerMap.Put("p1bean", typeof(SupportBean)); mmInnerMap.Put("p1beanComplex", typeof(SupportBeanComplexProps)); mmInnerMap.Put("p1beanArray", typeof(SupportBean[])); mmInnerMap.Put("p1innerId", typeof(int)); mmInnerMap.Put("p1innerMap", mmInner); configuration.Common.AddEventType("MMInnerMap", mmInnerMap); IDictionary<string, object> mmOuterMap = new Dictionary<string, object>(); mmOuterMap.Put("p0simple", "MMInnerMap"); mmOuterMap.Put("p0array", "MMInnerMap[]"); configuration.Common.AddEventType("MMOuterMap", mmOuterMap); IDictionary<string, object> myTypeDef = new Dictionary<string, object>(); myTypeDef.Put("candidate book", typeof(string)); myTypeDef.Put("XML Message Type", typeof(string)); myTypeDef.Put("select", typeof(int)); myTypeDef.Put("children's books", typeof(int[])); myTypeDef.Put("my <> map", typeof(IDictionary<string, object>)); configuration.Common.AddEventType("MyType", myTypeDef); configuration.Common.AddEventType(typeof(EventBeanPropertyResolutionWDefaults.LocalEventWithEnum)); configuration.Common.AddEventType(typeof(EventBeanPropertyResolutionWDefaults.LocalEventWithGroup)); var anotherLegacyNestedEvent = new ConfigurationCommonEventTypeBean(); anotherLegacyNestedEvent.AccessorStyle = AccessorStyle.PUBLIC; configuration.Common.AddEventType( "AnotherLegacyNestedEvent", typeof(SupportLegacyBean.LegacyNested), anotherLegacyNestedEvent); configuration.Common.AddImportType(typeof(EventBeanPropertyResolutionWDefaults.LocalEventEnum)); configuration.Common.AddImportType(typeof(EventBeanPropertyResolutionWDefaults.GROUP)); }
/// <summary> /// Ctor. /// </summary> /// <param name="legacyConfig">configures legacy type</param> public PropertyListBuilderPublic(ConfigurationCommonEventTypeBean legacyConfig) { this.legacyConfig = legacyConfig ?? throw new ArgumentException("Required configuration not passed"); }
private static void Configure(Configuration configuration) { foreach (Type clazz in new[] { typeof(SupportBean), typeof(SupportObjectArrayOneDim), typeof(SupportBeanSimple), typeof(SupportBean_A), typeof(SupportRFIDEvent), typeof(SupportBean_S0), typeof(SupportBean_S1), typeof(SupportMarketDataBean), typeof(SupportTemperatureBean), typeof(SupportBeanComplexProps), typeof(SupportBeanInterfaceProps), typeof(SupportBeanErrorTestingOne), typeof(SupportBeanErrorTestingTwo), typeof(SupportBeanReadOnly), typeof(SupportBeanArrayCollMap), typeof(SupportBean_N), typeof(SupportBeanObject), typeof(SupportBeanCtorOne), typeof(SupportBeanCtorTwo), typeof(SupportBean_ST0), typeof(SupportBean_ST1), typeof(SupportEventWithCtorSameType), typeof(SupportBeanCtorThree), typeof(SupportBeanCtorOne), typeof(SupportBean_ST0), typeof(SupportBean_ST1), typeof(SupportEventWithMapFieldSetter), typeof(SupportBeanNumeric), typeof(SupportBeanArrayEvent), typeof(SupportBean_A), typeof(SupportBean_B), typeof(SupportEventContainsSupportBean) }) { configuration.Common.AddEventType(clazz); } Schema avroExistingTypeSchema = SchemaBuilder.Record( "name", TypeBuilder.RequiredLong("MyLong"), TypeBuilder.Field( "MyLongArray", TypeBuilder.Array(TypeBuilder.LongType())), TypeBuilder.Field("MyByteArray", TypeBuilder.BytesType()), TypeBuilder.Field( "MyMap", TypeBuilder.Map( TypeBuilder.StringType( TypeBuilder.Property( AvroConstant.PROP_STRING_KEY, AvroConstant.PROP_STRING_VALUE))))); configuration.Common.AddEventTypeAvro("AvroExistingType", new ConfigurationCommonEventTypeAvro(avroExistingTypeSchema)); IDictionary<string, object> mapTypeInfo = new Dictionary<string, object>(); mapTypeInfo.Put("one", typeof(string)); mapTypeInfo.Put("two", typeof(string)); configuration.Common.AddEventType("MapOne", mapTypeInfo); configuration.Common.AddEventType("MapTwo", mapTypeInfo); string[] props = {"one", "two"}; object[] types = {typeof(string), typeof(string)}; configuration.Common.AddEventType("OAOne", props, types); configuration.Common.AddEventType("OATwo", props, types); Schema avroOneAndTwoSchema = SchemaBuilder.Record( "name", TypeBuilder.RequiredString("one"), TypeBuilder.RequiredString("two")); configuration.Common.AddEventTypeAvro("AvroOne", new ConfigurationCommonEventTypeAvro(avroOneAndTwoSchema)); configuration.Common.AddEventTypeAvro("AvroTwo", new ConfigurationCommonEventTypeAvro(avroOneAndTwoSchema)); ConfigurationCommonEventTypeBean legacySupportBeanString = new ConfigurationCommonEventTypeBean(); legacySupportBeanString.FactoryMethod = "GetInstance"; configuration.Common.AddEventType("SupportBeanString", typeof(SupportBeanString), legacySupportBeanString); ConfigurationCommonEventTypeBean legacySupportSensorEvent = new ConfigurationCommonEventTypeBean(); legacySupportSensorEvent.FactoryMethod = typeof(SupportSensorEventFactory).FullName + ".GetInstance"; configuration.Common.AddEventType("SupportSensorEvent", typeof(SupportSensorEvent), legacySupportSensorEvent); configuration.Common.AddImportType(typeof(SupportEnum)); IDictionary<string, object> mymapDef = new Dictionary<string, object>(); mymapDef.Put("Anint", typeof(int)); mymapDef.Put("IntBoxed", typeof(int?)); mymapDef.Put("FloatBoxed", typeof(float?)); mymapDef.Put("IntArr", typeof(int[])); mymapDef.Put("MapProp", typeof(IDictionary<string, object>)); mymapDef.Put("IsaImpl", typeof(ISupportAImpl)); mymapDef.Put("IsbImpl", typeof(ISupportBImpl)); mymapDef.Put("IsgImpl", typeof(ISupportAImplSuperGImpl)); mymapDef.Put("IsabImpl", typeof(ISupportBaseABImpl)); mymapDef.Put("Nested", typeof(SupportBeanComplexProps.SupportBeanSpecialGetterNested)); configuration.Common.AddEventType("MyMap", mymapDef); IDictionary<string, object> defMap = new Dictionary<string, object>(); defMap.Put("intVal", typeof(int)); defMap.Put("stringVal", typeof(string)); defMap.Put("doubleVal", typeof(double?)); defMap.Put("nullVal", null); configuration.Common.AddEventType("MyMapType", defMap); string[] propsMyOAType = new string[] {"intVal", "stringVal", "doubleVal", "nullVal"}; object[] typesMyOAType = new object[] {typeof(int), typeof(string), typeof(double?), null}; configuration.Common.AddEventType("MyOAType", propsMyOAType, typesMyOAType); Schema schema = SchemaBuilder.Record( "MyAvroType", TypeBuilder.RequiredInt("intVal"), TypeBuilder.RequiredString("stringVal"), TypeBuilder.RequiredDouble("doubleVal"), TypeBuilder.Field("nullVal", TypeBuilder.NullType())); configuration.Common.AddEventTypeAvro("MyAvroType", new ConfigurationCommonEventTypeAvro(schema)); ConfigurationCommonEventTypeXMLDOM xml = new ConfigurationCommonEventTypeXMLDOM(); xml.RootElementName = "abc"; configuration.Common.AddEventType("xmltype", xml); IDictionary<string, object> mapDef = new Dictionary<string, object>(); mapDef.Put("IntPrimitive", typeof(int)); mapDef.Put("LongBoxed", typeof(long?)); mapDef.Put("TheString", typeof(string)); mapDef.Put("BoolPrimitive", typeof(bool?)); configuration.Common.AddEventType("MySupportMap", mapDef); IDictionary<string, object> type = MakeMap( new object[][] { new object[] {"Id", typeof(string)} }); configuration.Common.AddEventType("AEventMap", type); configuration.Common.AddEventType("BEventMap", type); IDictionary<string, object> metadata = MakeMap( new object[][] {new object[] {"Id", typeof(string)}}); configuration.Common.AddEventType("AEventTE", metadata); configuration.Common.AddEventType("BEventTE", metadata); configuration.Common.AddImportType(typeof(SupportStaticMethodLib)); configuration.Common.AddImportNamespace(typeof(EPLInsertIntoPopulateUnderlying)); IDictionary<string, object> complexMapMetadata = MakeMap( new object[][] { new object[] { "Nested", MakeMap( new object[][] { new object[] {"NestedValue", typeof(string)} }) } }); configuration.Common.AddEventType("ComplexMap", complexMapMetadata); configuration.Compiler.ByteCode.AllowSubscriber = true; configuration.Compiler.AddPlugInSingleRowFunction("generateMap", typeof(EPLInsertIntoTransposeStream), "LocalGenerateMap"); configuration.Compiler.AddPlugInSingleRowFunction("generateOA", typeof(EPLInsertIntoTransposeStream), "LocalGenerateOA"); configuration.Compiler.AddPlugInSingleRowFunction("generateAvro", typeof(EPLInsertIntoTransposeStream), "LocalGenerateAvro"); configuration.Compiler.AddPlugInSingleRowFunction("generateJson", typeof(EPLInsertIntoTransposeStream), "LocalGenerateJson"); configuration.Compiler.AddPlugInSingleRowFunction("custom", typeof(SupportStaticMethodLib), "MakeSupportBean"); configuration.Compiler.AddPlugInSingleRowFunction("customOne", typeof(SupportStaticMethodLib), "MakeSupportBean"); configuration.Compiler.AddPlugInSingleRowFunction("customTwo", typeof(SupportStaticMethodLib), "MakeSupportBeanNumeric"); }
private static void Configure(Configuration configuration) { foreach (var clazz in new[] { typeof(SupportBean), typeof(OrderBean), typeof(OrderWithItems), typeof(SupportBeanAtoFBase), typeof(SupportBean_A), typeof(SupportMarketDataBean), typeof(SupportSimpleBeanTwo), typeof(SupportSimpleBeanOne), typeof(SupportVariableSetEvent), typeof(SupportBean_S0), typeof(SupportBean_S1), typeof(SupportBeanRange), typeof(SupportBean_B), typeof(SupportOverrideOneA), typeof(SupportOverrideOne), typeof(SupportOverrideBase), typeof(SupportQueueEnter), typeof(SupportQueueLeave), typeof(SupportBeanAtoFBase), typeof(SupportBeanAbstractSub), typeof(SupportBean_ST0), typeof(SupportBeanTwo), typeof(SupportCountAccessEvent), typeof(BookDesc), typeof(SupportBean_Container), typeof(SupportEventWithManyArray), typeof(SupportEventWithIntArray) }) { configuration.Common.AddEventType(clazz); } IDictionary<string, object> outerMapInnerType = new Dictionary<string, object>(); outerMapInnerType.Put("key", typeof(string)); configuration.Common.AddEventType("InnerMap", outerMapInnerType); IDictionary<string, object> outerMap = new Dictionary<string, object>(); outerMap.Put("innermap", "InnerMap"); configuration.Common.AddEventType("OuterMap", outerMap); IDictionary<string, object> typesSimpleKeyValue = new Dictionary<string, object>(); typesSimpleKeyValue.Put("key", typeof(string)); typesSimpleKeyValue.Put("value", typeof(long)); configuration.Common.AddEventType("MySimpleKeyValueMap", typesSimpleKeyValue); IDictionary<string, object> innerTypeOne = new Dictionary<string, object>(); innerTypeOne.Put("i1", typeof(int)); IDictionary<string, object> innerTypeTwo = new Dictionary<string, object>(); innerTypeTwo.Put("i2", typeof(int)); IDictionary<string, object> outerType = new Dictionary<string, object>(); outerType.Put("one", "T1"); outerType.Put("two", "T2"); configuration.Common.AddEventType("T1", innerTypeOne); configuration.Common.AddEventType("T2", innerTypeTwo); configuration.Common.AddEventType("OuterType", outerType); IDictionary<string, object> types = new Dictionary<string, object>(); types.Put("key", typeof(string)); types.Put("primitive", typeof(long)); types.Put("boxed", typeof(long?)); configuration.Common.AddEventType("MyMapWithKeyPrimitiveBoxed", types); var dataType = BuildMap( new object[][] { new object[] {"a", typeof(string)}, new object[] {"b", typeof(int)} }); configuration.Common.AddEventType("MyMapAB", dataType); var legacy = new ConfigurationCommonEventTypeBean(); legacy.CopyMethod = "MyCopyMethod"; configuration.Common.AddEventType("SupportBeanCopyMethod", typeof(SupportBeanCopyMethod), legacy); configuration.Common.AddEventType("SimpleEventWithId", new string[]{"id"}, new object[]{ typeof(string) }); configuration.Compiler.AddPlugInSingleRowFunction( "setBeanLongPrimitive999", typeof(InfraNamedWindowOnUpdate), "SetBeanLongPrimitive999"); configuration.Compiler.AddPlugInSingleRowFunction( "increaseIntCopyDouble", typeof(InfraNamedWindowOnMerge), "IncreaseIntCopyDouble"); var config = new ConfigurationCommonVariantStream(); config.AddEventTypeName("SupportBean_A"); config.AddEventTypeName("SupportBean_B"); configuration.Common.AddVariantStream("VarStream", config); configuration.Common.Logging.IsEnableQueryPlan = true; }
/// <summary> /// Ctor. /// </summary> /// <param name="optionalLegacyConfig"> /// configures legacy type, or null informationhas been supplied. /// </param> public PropertyListBuilderNative(ConfigurationCommonEventTypeBean optionalLegacyConfig) { this.optionalLegacyConfig = optionalLegacyConfig; }