public BeanEventType MakeBeanEventTypeAnonymous(Type beanType) { var metadata = new EventTypeMetadata( beanType.Name, null, EventTypeTypeClass.STREAM, EventTypeApplicationType.CLASS, NameAccessModifier.TRANSIENT, EventTypeBusModifier.NONBUS, false, EventTypeIdPair.Unassigned()); var stem = _stemSvc.GetCreateStem(beanType, null); return(new BeanEventType(_container, stem, metadata, _factoryPrivate, null, null, null, null)); }
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; }
public void RegisterBean( EventTypeMetadata metadata, Type clazz, string startTimestampName, string endTimestampName, EventType[] superTypes, ISet<EventType> deepSuperTypes) { var stem = _beanEventTypeStemService.GetCreateStem(clazz, null); var eventType = _eventTypeFactory.CreateBeanType( stem, metadata, _beanEventTypeFactory, superTypes, deepSuperTypes, startTimestampName, endTimestampName); HandleRegister(eventType); }
private static void BuildPublicBeanType( BeanEventTypeStemService beanEventTypeStemService, EventTypeRepository repo, string eventTypeName, Type clazz, BeanEventTypeFactoryPrivate privateFactory, IDictionary<string, ConfigurationCommonEventTypeBean> configs) { // check existing type var existingType = repo.GetTypeByName(eventTypeName); if (existingType != null) { if (existingType.Metadata.ApplicationType != EventTypeApplicationType.CLASS) { throw new ConfigurationException( "Event type named '" + eventTypeName + "' has already been declared with differing underlying type information: Class " + existingType.UnderlyingType.FullName + " versus " + clazz.Name); } var beanEventType = (BeanEventType) existingType; if (beanEventType.UnderlyingType != clazz) { throw new ConfigurationException( "Event type named '" + eventTypeName + "' has already been declared with differing underlying type information: Class " + existingType.UnderlyingType.FullName + " versus " + beanEventType.UnderlyingType); } return; } var optionalConfig = configs.Get(eventTypeName); // check-allocate bean-stem var stem = beanEventTypeStemService.GetCreateStem(clazz, optionalConfig); // metadata var publicId = CRC32Util.ComputeCRC32(eventTypeName); var metadata = new EventTypeMetadata( eventTypeName, null, EventTypeTypeClass.STREAM, EventTypeApplicationType.CLASS, NameAccessModifier.PRECONFIGURED, EventTypeBusModifier.NONBUS, false, new EventTypeIdPair(publicId, -1)); // supertypes var superTypes = GetSuperTypes(stem.SuperTypes, beanEventTypeStemService, repo, privateFactory, configs); var deepSuperTypes = GetDeepSupertypes( stem.DeepSuperTypes, beanEventTypeStemService, repo, privateFactory, configs); // bean type var startTS = optionalConfig == null ? null : optionalConfig.StartTimestampPropertyName; var endTS = optionalConfig == null ? null : optionalConfig.EndTimestampPropertyName; var eventType = privateFactory.EventTypeFactory.CreateBeanType( stem, metadata, privateFactory, superTypes, deepSuperTypes, startTS, endTS); repo.AddType(eventType); }