protected ICascadedInterceptor HandleServiceAnnotation(ServiceAttribute serviceAnnotation, IBeanContextFactory beanContextFactory, IServiceContext beanContext, IBeanConfiguration beanConfiguration, Type type) { if (serviceAnnotation.CustomExport) { // Do nothing if the service wants to be exported by some special way anywhere else return(null); } String beanName = beanConfiguration.GetName(); String serviceName = ExtractServiceName(serviceAnnotation.Name, type); if (!IsNetworkClientMode) { IMethodLevelBehavior <Attribute> behavior = CreateInterceptorModeBehavior(type); CacheInterceptor interceptor = new CacheInterceptor(); if (beanContext.IsRunning) { interceptor = beanContext.RegisterWithLifecycle(interceptor) // .PropertyValue("ServiceName", serviceName) // .PropertyValue("Behavior", behavior) // .IgnoreProperties("ProcessService") // .Finish(); beanContext.Link(beanName).To <IServiceExtendable>().With(serviceName); } else { beanContextFactory.RegisterWithLifecycle(interceptor) // .PropertyValue("ServiceName", serviceName) // .PropertyValue("Behavior", behavior) // .IgnoreProperties("ProcessService"); beanContextFactory.Link(beanName).To <IServiceExtendable>().With(serviceName); } if (Log.InfoEnabled) { Log.Info("Registering application service '" + serviceName + "'"); } return(interceptor); } else { if (Log.InfoEnabled) { Log.Info("Registering application mock service '" + serviceName + "'"); } if (beanContext.IsRunning) { beanContext.Link(beanName).To <IServiceExtendable>().With(serviceName); } else { beanContextFactory.Link(beanName).To <IServiceExtendable>().With(serviceName); } return(null); } }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean <OriWrapperTestBed>("oriWrapperTestBed").Autowireable(typeof(OriWrapperTestBed)); IBeanConfiguration cacheRetrieverConf = beanContextFactory.RegisterBean <CacheRetrieverMock>(); beanContextFactory.Link(cacheRetrieverConf).To <ICacheRetrieverExtendable>().With(typeof(EntityA)); beanContextFactory.Link(cacheRetrieverConf).To <ICacheRetrieverExtendable>().With(typeof(EntityB)); beanContextFactory.Link(cacheRetrieverConf).To <ICacheRetrieverExtendable>().With(typeof(Material)); beanContextFactory.Link(cacheRetrieverConf).To <ICacheRetrieverExtendable>().With(typeof(MaterialGroup)); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterAnonymousBean <ParserController>().Autowireable <IFileParserExtendable>(); IBeanConfiguration visioParser = beanContextFactory.RegisterAnonymousBean <VisioParser>(); beanContextFactory.Link(visioParser).To <IFileParserExtendable>().With("vsd"); IBeanConfiguration powerpointParser = beanContextFactory.RegisterAnonymousBean <PowerpointParser>(); beanContextFactory.Link(powerpointParser).To <IFileParserExtendable>().With("ppt"); beanContextFactory.Link(powerpointParser).To <IFileParserExtendable>().With("pptx"); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { IBeanConfiguration cacheRetrieverConf = beanContextFactory.RegisterBean <CacheRetrieverMock>(); beanContextFactory.Link(cacheRetrieverConf).To <ICacheRetrieverExtendable>().With(typeof(Material)); beanContextFactory.Link(cacheRetrieverConf).To <ICacheRetrieverExtendable>().With(typeof(MaterialType)); if (dispatcherThread == null) { Log.Info("Create SyncContext..."); CreateDispatcherThread(beanContextFactory); Log.Info("SyncContext created"); } }
public void PreProcessProperties(IBeanContextFactory beanContextFactory, IServiceContext beanContext, IProperties props, String beanName, Object service, Type beanType, IList <IPropertyConfiguration> propertyConfigs, ISet <String> ignoredPropertyNames, IPropertyInfo[] properties) { if (extensionType.IsAssignableFrom(service.GetType())) { if (Log.DebugEnabled) { if (extendableName == null) { Log.Debug("Registering bean '" + beanName + "' to " + extendableType.Name + " because it implements " + extensionType.Name); } else { Log.Debug("Registering bean '" + beanName + "' to " + extendableType.Name + " ('" + extendableName + "') because it implements " + extensionType.Name); } } ILinkRegistryNeededConfiguration <Object> link = beanContextFactory.Link(service); if (extendableName == null) { link.To(extendableType); } else { link.To(extendableName, extendableType); } } }
public static IBeanConfiguration AddDefaultBytecodeBehavior(IBeanContextFactory beanContextFactory, Type behaviorType) { IBeanConfiguration behaviorBC = beanContextFactory.RegisterBean(behaviorType); beanContextFactory.Link(behaviorBC).To <IBytecodeBehaviorExtendable>(); return(behaviorBC); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { if (EventManagerName != null) { beanContextFactory.Link(EventManagerName).To <IEventListenerExtendable>().With(typeof(IDataChange)); } }
public virtual Object PostProcessBean(IBeanContextFactory beanContextFactory, IServiceContext beanContext, IBeanConfiguration beanConfiguration, Type beanType, Object targetBean, ISet <Type> requestedTypes) { if (!beanType.IsGenericType) { return(targetBean); } // ViewModelDataChangeController has exactly 1 generic argument Type genericTypeArgument = beanType.GetGenericArguments()[0]; // Instantiate TYPE to generic argument of given bean type if (!dataChangeControllerType.MakeGenericType(genericTypeArgument).IsAssignableFrom(beanType)) { return(targetBean); } Type[] arguments = beanType.GetGenericArguments(); Object eventListener = TypeFilteredDataChangeListener.CreateEventListener((IDataChangeListener)targetBean, arguments[0]); String eventListenerBeanName = beanConfiguration.GetName() + ".eventListener"; beanContextFactory.RegisterExternalBean(eventListenerBeanName, eventListener); if (beanContext.IsRunning) { beanContext.Link(eventListenerBeanName).To <IEventListenerExtendable>().With(typeof(IDataChange)); } else { beanContextFactory.Link(eventListenerBeanName).To <IEventListenerExtendable>().With(typeof(IDataChange)); } return(targetBean); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean <EventListenerRegistry>("eventListenerRegistry").Autowireable(typeof(IEventListenerExtendable), typeof(IEventTargetListenerExtendable), typeof(IEventBatcherExtendable), typeof(IEventTargetExtractorExtendable), typeof(IEventBatcher), typeof(IEventDispatcher), typeof(IEventListener), typeof(IEventQueue)); if (IsNetworkClientMode && IsEventServiceBeanActive) { beanContextFactory.RegisterBean <ClientServiceBean>("eventServiceWCF") .PropertyValue("Interface", typeof(IEventService)) .PropertyValue("SyncRemoteInterface", typeof(IEventServiceWCF)) .PropertyValue("AsyncRemoteInterface", typeof(IEventClient)) .Autowireable <IEventService>(); //beanContextFactory.registerBean<EventServiceDelegate>("eventService").autowireable<IEventService>(); if (IsPollingActive) { beanContextFactory.RegisterBean <EventPoller>("eventPoller").Autowireable <IEventPoller>(); beanContextFactory.Link("eventPoller").To <IOfflineListenerExtendable>(); } else { if (Log.InfoEnabled) { Log.Info("Event polling disabled. Reason: property '" + EventConfigurationConstants.PollingActive + "' set to '" + IsPollingActive + "'"); } } } }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean <BytecodeEnhancer>("bytecodeEnhancer").Autowireable(typeof(IBytecodeEnhancer), typeof(IBytecodeBehaviorExtendable)); IBeanConfiguration bytecodeClassLoaderBC = beanContextFactory.RegisterBean <BytecodeClassLoader>().Autowireable(typeof(IBytecodeClassLoader), typeof(IBytecodePrinter)); beanContextFactory.Link(bytecodeClassLoaderBC).To <IEventListenerExtendable>().With(typeof(ClearAllCachesEvent)).Optional(); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { // Default ObjectCopier implementation beanContextFactory.RegisterBean <ObjectCopier>().Autowireable(typeof(IObjectCopier), typeof(IObjectCopierExtendable)); // Default ObjectCopier extensions IBeanConfiguration stringBuilderOCE = beanContextFactory.RegisterBean <StringBuilderOCE>(); beanContextFactory.Link(stringBuilderOCE).To <IObjectCopierExtendable>().With(typeof(StringBuilder)); }
public virtual void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { IBeanConfiguration privilegeProvider = beanContextFactory.RegisterBean <PrivilegeProvider>().Autowireable <IPrivilegeProvider>(); IBeanConfiguration ppEventListener = beanContextFactory.RegisterBean <UnfilteredDataChangeListener>().PropertyRefs(privilegeProvider); beanContextFactory.Link(ppEventListener).To <IEventListenerExtendable>().With(typeof(IDataChange)); beanContextFactory.Link(privilegeProvider, PrivilegeProvider.m_HandleClearAllCaches).To <IEventListenerExtendable>().With(typeof(ClearAllCachesEvent)); beanContextFactory.RegisterBean <EntityPrivilegeFactoryProvider>().Autowireable <IEntityPrivilegeFactoryProvider>(); beanContextFactory.RegisterBean <EntityTypePrivilegeFactoryProvider>().Autowireable <IEntityTypePrivilegeFactoryProvider>(); if (IsNetworkClientMode && IsPrivilegeServiceBeanActive) { beanContextFactory.RegisterBean <ClientServiceBean>("privilegeServiceWCF") .PropertyValue("Interface", typeof(IPrivilegeService)) .PropertyValue("SyncRemoteInterface", typeof(IPrivilegeServiceWCF)) .PropertyValue("AsyncRemoteInterface", typeof(IPrivilegeClient)).Autowireable <IPrivilegeService>(); } }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { IBeanConfiguration dummyServiceBC = beanContextFactory.RegisterBean <DummyService>(DUMMY_CACHE_SERVICE).Autowireable(typeof(IClientServiceFactory), typeof(ICacheRetriever)); beanContextFactory.RegisterAlias(CacheModule.EXTERNAL_CACHE_SERVICE, DUMMY_CACHE_SERVICE); beanContextFactory.Link(dummyServiceBC).To <IMergeServiceExtensionExtendable>().With(typeof(Object)); beanContextFactory.RegisterAlias(CacheModule.ROOT_CACHE_RETRIEVER, "cacheServiceRegistry"); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean <RevertChangesHelper>("revertChangesHelper").Autowireable <IRevertChangesHelper>(); IBeanConfiguration rootCacheClearEventListenerBC = beanContextFactory.RegisterBean <RootCacheClearEventListener>().PropertyRefs(CacheModule.COMMITTED_ROOT_CACHE); beanContextFactory.Link(rootCacheClearEventListenerBC).To <IEventListenerExtendable>().With(typeof(ClearAllCachesEvent)); IBeanConfiguration serviceResultCacheDCL = beanContextFactory.RegisterBean <UnfilteredDataChangeListener>().PropertyRef( beanContextFactory.RegisterBean <ServiceResultCacheDCL>()); beanContextFactory.Link(serviceResultCacheDCL).To <IEventListenerExtendable>().With(typeof(IDataChange)); IBeanConfiguration cacheDCListener = beanContextFactory.RegisterBean <CacheDataChangeListener>("cacheDataChangeListener"); beanContextFactory.Link(cacheDCListener).To <IEventListenerExtendable>().With(typeof(IDataChange)); beanContextFactory.RegisterBean <DataChangeEventBatcher>("dataChangeEventBatcher"); beanContextFactory.Link("dataChangeEventBatcher").To <IEventBatcherExtendable>().With(typeof(IDataChange)); }
public virtual void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { if (GenericTransferMapping) { beanContextFactory.RegisterBean <ValueObjectConfigReader>("valueObjectConfigReader"); beanContextFactory.Link("valueObjectConfigReader").To <IEventListenerExtendable>().With(typeof(EntityMetaDataAddedEvent)); beanContextFactory.RegisterBean <ListTypeHelper>("listTypeHelper").Autowireable <IListTypeHelper>(); beanContextFactory.RegisterBean <MapperServiceFactory>("mapperServiceFactory").Autowireable <IMapperServiceFactory>(); beanContextFactory.RegisterBean <ExtendableBean>("mapperExtensionRegistry") .Autowireable <IDedicatedMapperExtendable>().Autowireable <IDedicatedMapperRegistry>() .PropertyValue(ExtendableBean.P_EXTENDABLE_TYPE, typeof(IDedicatedMapperExtendable)) .PropertyValue(ExtendableBean.P_PROVIDER_TYPE, typeof(IDedicatedMapperRegistry)); } }
public virtual void PostProcessTargetProviderBean(String targetProviderBeanName, IBeanContextFactory beanContextFactory) { beanContextFactory.Link(targetProviderBeanName).To <IOfflineListenerExtendable>(); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { IBeanConfiguration registryC = beanContextFactory.RegisterBean <TestRegistry>(LinkContainerTest.REGISTRY_NAME).Autowireable(typeof(ITestListenerExtendable), typeof(ITestRegistry), typeof(INotifyPropertyChanged)); IBeanConfiguration listenerC = beanContextFactory.RegisterBean <TestListener>(LinkContainerTest.LISTENER_NAME); if (ListenerName == null) { ListenerName = LinkContainerTest.LISTENER_NAME; } String registryPropertyName = LinkContainerTest.REGISTRY_PROPERTY_NAME; ILinkRegistryNeededConfiguration link1; switch (ListenerVariant) { case ListenerVariant.BY_NAME: link1 = beanContextFactory.Link(ListenerName); break; case ListenerVariant.BY_NAME_DELEGATE: if (ExtendableType == null) { ExtendableType = typeof(INotifyPropertyChanged); } beanContextFactory.RegisterExternalBean(LinkContainerTest.LISTENER_DELEGATE_NAME, new PropertyChangedEventHandler(((TestListener)listenerC.GetInstance()).HandlePropertyChangedTest)); link1 = beanContextFactory.Link(LinkContainerTest.LISTENER_DELEGATE_NAME); registryPropertyName = LinkContainerTest.REGISTRY_EVENT_PROPERTY_NAME; break; case ListenerVariant.BY_NAME_AND_METHOD: link1 = beanContextFactory.Link(ListenerName, "HandlePropertyChangedTest"); break; case ListenerVariant.BY_CONF: link1 = beanContextFactory.Link(listenerC); break; case ListenerVariant.BY_CONF_DELEGATE: if (ExtendableType == null) { ExtendableType = typeof(INotifyPropertyChanged); } IBeanConfiguration listenerDelegateC = beanContextFactory.RegisterExternalBean(LinkContainerTest.LISTENER_DELEGATE_NAME, new PropertyChangedEventHandler(((TestListener)listenerC.GetInstance()).HandlePropertyChangedTest)); link1 = beanContextFactory.Link(listenerDelegateC); registryPropertyName = LinkContainerTest.REGISTRY_EVENT_PROPERTY_NAME; break; case ListenerVariant.BY_INSTANCE: link1 = beanContextFactory.Link(listenerC.GetInstance()); break; case ListenerVariant.BY_INSTANCE_DELEGATE: if (ExtendableType == null) { ExtendableType = typeof(INotifyPropertyChanged); } link1 = beanContextFactory.Link(new PropertyChangedEventHandler(((TestListener)listenerC.GetInstance()).HandlePropertyChangedTest)); registryPropertyName = LinkContainerTest.REGISTRY_EVENT_PROPERTY_NAME; break; default: throw new System.Exception("Unsupported enum: " + ListenerVariant); } if (ExtendableType == null) { ExtendableType = typeof(ITestListenerExtendable); } ILinkConfigWithOptional link2; switch (RegistryVariant) { case RegistryVariant.BY_EXTENDABLE: link2 = link1.To(ExtendableType); break; case RegistryVariant.BY_NAME_AND_EXTENDABLE: link2 = link1.To(LinkContainerTest.REGISTRY_NAME, ExtendableType); break; case RegistryVariant.BY_NAME_AND_EVENT: link2 = link1.To(LinkContainerTest.REGISTRY_NAME, new EventDelegate <Object>(registryPropertyName)); break; case RegistryVariant.BY_NAME_AND_PROPERTY: link2 = link1.To(LinkContainerTest.REGISTRY_NAME, registryPropertyName); break; case RegistryVariant.BY_INSTANCE_AND_EXTENDABLE: link2 = link1.To(registryC.GetInstance(), ExtendableType); break; case RegistryVariant.BY_INSTANCE_AND_EVENT: link2 = link1.To(registryC.GetInstance(), new EventDelegate <Object>(registryPropertyName)); break; case RegistryVariant.BY_INSTANCE_AND_PROPERTY: link2 = link1.To(registryC.GetInstance(), registryPropertyName); break; default: throw new System.Exception("Unsupported enum: " + RegistryVariant); } if (Optional) { link2.Optional(); link2 = null; } }
public static void Link(IBeanContextFactory beanContextFactory, String listenerBeanName, Type fromType, Type toType) { beanContextFactory.Link(listenerBeanName).To <IDedicatedConverterExtendable>().With(fromType, toType); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { ParamChecker.AssertNotNull(ProxyFactory, "ProxyFactory"); IBeanConfiguration serviceResultcache = beanContextFactory.RegisterBean <ServiceResultCache>().Autowireable <IServiceResultCache>(); beanContextFactory.Link(serviceResultcache, "HandleClearAllCaches").To <IEventListenerExtendable>().With(typeof(ClearAllCachesEvent)); beanContextFactory.RegisterBean <ValueHolderIEC>().Autowireable(typeof(ValueHolderIEC), typeof(IProxyHelper)); beanContextFactory.RegisterBean <CacheHelper>().Autowireable(typeof(ICacheHelper), typeof(ICachePathHelper), typeof(IPrefetchHelper)); IBeanConfiguration prioMembersProvider = beanContextFactory.RegisterBean <PrioMembersProvider>().Autowireable <IPrioMembersProvider>(); beanContextFactory.Link(prioMembersProvider, PrioMembersProvider.handleMetaDataAddedEvent).To <IEventListenerExtendable>() .With(typeof(IEntityMetaDataEvent)); beanContextFactory.RegisterBean <CacheWalker>().Autowireable <ICacheWalker>(); beanContextFactory.RegisterAutowireableBean <ICacheMapEntryTypeProvider, CacheMapEntryTypeProvider>(); beanContextFactory.RegisterAutowireableBean <IRootCacheValueFactory, RootCacheValueFactory>(); //IBeanConfiguration rootCache = beanContextFactory.registerBean<RootCache>("rootCache").autowireable(typeof(RootCache), typeof(IWritableCache)); //if (IsUseSingleChildCache) //{ // beanContextFactory.registerBean<SingletonCacheFactory>("cacheFactory") // .propertyRefs("singletonChildCache") // .autowireable<ICacheFactory>(); // IWritableCache childCache = (IWritableCache)beanContextFactory.registerBean<ChildCache>("singletonChildCache") // .propertyRefs("rootCache") // .autowireable(typeof(ICache)).GetInstance(); // ((RootCache)rootCache.GetInstance()).AddChildCache(childCache); //} //else //{ // rootCache.autowireable(typeof(ICache), typeof(IWritableCache), typeof(ICacheFactory)); //} //beanContextFactory.registerBean<RootCache>(ROOT_CACHE).autowireable<RootCache>(); //beanContextFactory.Link("rootCache").To<IOfflineListenerExtendable>(); beanContextFactory.RegisterBean <CacheRetrieverRegistry>(ROOT_CACHE_RETRIEVER).Autowireable(typeof(ICacheServiceByNameExtendable), typeof(ICacheRetrieverExtendable)); beanContextFactory.RegisterBean <FirstLevelCacheManager>("firstLevelCacheManager").Autowireable(typeof(IFirstLevelCacheExtendable), typeof(IFirstLevelCacheManager)); String rootCacheBridge = "rootCacheBridge"; beanContextFactory.RegisterBean <RootCacheBridge>(rootCacheBridge).PropertyRefs(COMMITTED_ROOT_CACHE, ROOT_CACHE_RETRIEVER); TransactionalRootCacheInterceptor txRcInterceptor = new TransactionalRootCacheInterceptor(); beanContextFactory.RegisterWithLifecycle("txRootCacheInterceptor", txRcInterceptor).PropertyRefs(COMMITTED_ROOT_CACHE, rootCacheBridge) .Autowireable(typeof(ITransactionalRootCache), typeof(ISecondLevelCacheManager)); Object txRcProxy = ProxyFactory.CreateProxy(new Type[] { typeof(IRootCache), typeof(ICacheIntern), typeof(IOfflineListener) }, txRcInterceptor); beanContextFactory.RegisterExternalBean(ROOT_CACHE, txRcProxy).Autowireable(typeof(IRootCache), typeof(ICacheIntern)); if (IsSecondLevelCacheActive) { // One single root cache instance for whole context beanContextFactory.RegisterBean <RootCache>(COMMITTED_ROOT_CACHE).PropertyRef("CacheRetriever", ROOT_CACHE_RETRIEVER) .PropertyValue("Privileged", true); beanContextFactory.Link(CacheModule.COMMITTED_ROOT_CACHE).To <IOfflineListenerExtendable>(); } else { // One root cache instance per thread sequence. Most often used in server environment where the "deactivated" // second level cache means that each thread hold his own, isolated root cache (which gets cleared with each service // request. Effectively this means that the root cache itself only lives per-request and does not hold a longer state IInterceptor threadLocalRootCacheInterceptor = (IInterceptor)beanContextFactory .RegisterBean <ThreadLocalRootCacheInterceptor>("threadLocalRootCacheInterceptor") .PropertyRef("StoredCacheRetriever", CacheModule.ROOT_CACHE_RETRIEVER).PropertyValue("Privileged", true).GetInstance(); RootCache rootCacheProxy = ProxyFactory.CreateProxy <RootCache>(threadLocalRootCacheInterceptor); beanContextFactory.RegisterExternalBean(CacheModule.COMMITTED_ROOT_CACHE, rootCacheProxy).Autowireable <RootCache>(); } beanContextFactory.RegisterBean <CacheEventTargetExtractor>("cacheEventTargetExtractor"); beanContextFactory.Link("cacheEventTargetExtractor").To <IEventTargetExtractorExtendable>().With(typeof(ICache)); beanContextFactory.RegisterBean <CacheFactory>().Autowireable <ICacheFactory>(); IInterceptor cacheProviderInterceptor = (IInterceptor)beanContextFactory .RegisterBean <CacheProviderInterceptor>("cacheProviderInterceptor") .Autowireable(typeof(ICacheProviderExtendable), typeof(ICacheProvider), typeof(ICacheContext)).GetInstance(); ICache cacheProxy = ProxyFactory.CreateProxy <ICache>(new Type[] { typeof(ICacheProvider), typeof(IWritableCache) }, cacheProviderInterceptor); beanContextFactory.RegisterExternalBean("cache", cacheProxy).Autowireable <ICache>(); beanContextFactory.RegisterBean <PagingQueryServiceResultProcessor>("pagingQuerySRP"); beanContextFactory.Link("pagingQuerySRP").To <IServiceResultProcessorExtendable>().With(typeof(IPagingResponse)); beanContextFactory.RegisterBean <CacheProvider>(CacheNamedBeans.CacheProviderSingleton).PropertyValue("CacheType", CacheType.SINGLETON); beanContextFactory.RegisterBean <CacheProvider>(CacheNamedBeans.CacheProviderThreadLocal).PropertyValue("CacheType", CacheType.THREAD_LOCAL); beanContextFactory.RegisterBean <CacheProvider>(CacheNamedBeans.CacheProviderPrototype).PropertyValue("CacheType", CacheType.PROTOTYPE); String defaultCacheProviderBeanName; switch (DefaultCacheType) { case CacheType.PROTOTYPE: { defaultCacheProviderBeanName = CacheNamedBeans.CacheProviderPrototype; break; } case CacheType.SINGLETON: { defaultCacheProviderBeanName = CacheNamedBeans.CacheProviderSingleton; break; } case CacheType.THREAD_LOCAL: { defaultCacheProviderBeanName = CacheNamedBeans.CacheProviderThreadLocal; break; } case CacheType.DEFAULT: { defaultCacheProviderBeanName = CacheNamedBeans.CacheProviderThreadLocal; break; } default: throw new Exception("Not supported type: " + DefaultCacheType); } beanContextFactory.Link(defaultCacheProviderBeanName).To <ICacheProviderExtendable>(); // CacheContextPostProcessor must be registered AFTER CachePostProcessor... Object cachePostProcessor = beanContextFactory.RegisterBean <CachePostProcessor>().GetInstance(); beanContextFactory.RegisterBean <CacheContextPostProcessor>().PropertyValue("CachePostProcessor", cachePostProcessor); if (IsNetworkClientMode && IsCacheServiceBeanActive) { IBeanConfiguration remoteCacheService = beanContextFactory.RegisterBean <ClientServiceBean>(CacheModule.EXTERNAL_CACHE_SERVICE) .PropertyValue("Interface", typeof(ICacheService)) .PropertyValue("SyncRemoteInterface", typeof(ICacheServiceWCF)) .PropertyValue("AsyncRemoteInterface", typeof(ICacheClient)).Autowireable <ICacheService>(); beanContextFactory.RegisterAlias(CacheModule.DEFAULT_CACHE_RETRIEVER, CacheModule.EXTERNAL_CACHE_SERVICE); // register to all entities in a "most-weak" manner beanContextFactory.Link(remoteCacheService).To <ICacheRetrieverExtendable>().With(typeof(Object)); //beanContextFactory.RegisterAlias(CacheModule.ROOT_CACHE_RETRIEVER, CacheModule.EXTERNAL_CACHE_SERVICE); //beanContextFactory.registerBean<CacheServiceDelegate>("cacheService").autowireable<ICacheService>(); } beanContextFactory.RegisterBean <DataObjectMixin>().Autowireable <DataObjectMixin>(); beanContextFactory.RegisterBean <EntityEqualsMixin>().Autowireable <EntityEqualsMixin>(); beanContextFactory.RegisterBean <EmbeddedTypeMixin>().Autowireable <EmbeddedTypeMixin>(); beanContextFactory.RegisterBean <PropertyChangeMixin>().Autowireable(typeof(PropertyChangeMixin), typeof(IPropertyChangeExtensionExtendable), typeof(ICollectionChangeExtensionExtendable)); beanContextFactory.RegisterBean <ValueHolderContainerMixin>().Autowireable <ValueHolderContainerMixin>(); }
public static void Link(IBeanContextFactory beanContextFactory, IBeanConfiguration listenerBC, Type fromType, Type toType) { beanContextFactory.Link(listenerBC).To <IDedicatedConverterExtendable>().With(fromType, toType); }
public virtual void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterAutowireableBean <IMergeController, MergeController>(); beanContextFactory.RegisterAutowireableBean <IMergeProcess, MergeProcess>(); beanContextFactory.RegisterAutowireableBean <ICUDResultApplier, CUDResultApplier>(); beanContextFactory.RegisterAutowireableBean <ICUDResultComparer, CUDResultComparer>(); beanContextFactory.RegisterAutowireableBean <CompositeIdMixin, CompositeIdMixin>(); beanContextFactory.RegisterAutowireableBean <ObjRefMixin, ObjRefMixin>(); beanContextFactory.RegisterBean <SecurityScopeProvider>().Autowireable(typeof(ISecurityScopeProvider), typeof(ISecurityScopeChangeListenerExtendable)); beanContextFactory.RegisterBean <SecurityActivation>().Autowireable <ISecurityActivation>(); beanContextFactory.RegisterBean <CacheModification>().Autowireable <ICacheModification>(); beanContextFactory.RegisterAutowireableBean <IObjRefHelper, ObjRefHelper>(); beanContextFactory.RegisterBean <CUDResultHelper>().Autowireable(typeof(ICUDResultHelper), typeof(ICUDResultExtendable)); beanContextFactory.RegisterBean <EntityMetaDataReader>().Autowireable <IEntityMetaDataReader>(); beanContextFactory.RegisterBean <MergeServiceRegistry>().Autowireable(typeof(IMergeService), typeof(IMergeServiceExtensionExtendable), typeof(IMergeListenerExtendable), typeof(IMergeTimeProvider)); IBeanConfiguration valueObjectMap = beanContextFactory.RegisterBean <ValueObjectMap>(); IBeanConfiguration entityMetaDataProvider = beanContextFactory.RegisterBean <EntityMetaDataProvider>() .PropertyRef("ValueObjectMap", valueObjectMap) .Autowireable <IEntityMetaDataProvider>() .Autowireable <IEntityMetaDataRefresher>() .Autowireable <IValueObjectConfigExtendable>() .Autowireable <IEntityLifecycleExtendable>() .Autowireable <ITechnicalEntityTypeExtendable>() .Autowireable <IEntityMetaDataExtendable>() .Autowireable <IEntityInstantiationExtensionExtendable>(); beanContextFactory.RegisterBean <IndependentEntityMetaDataReader>(INDEPENDENT_META_DATA_READER).Precedence(PrecedenceType.HIGH); if (!IndependentMetaData) { IBeanConfiguration entityMetaDataConverter = beanContextFactory.RegisterBean <EntityMetaDataConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, entityMetaDataConverter, typeof(EntityMetaData), typeof(EntityMetaDataTransfer)); beanContextFactory.RegisterBean <EntityMetaDataClient>(REMOTE_ENTITY_METADATA_PROVIDER); } else { } IBeanConfiguration ormConfigGroupProvider = beanContextFactory.RegisterBean <OrmConfigGroupProvider>().Autowireable <IOrmConfigGroupProvider>(); beanContextFactory.Link(ormConfigGroupProvider, OrmConfigGroupProvider.handleClearAllCachesEvent).To <IEventListenerExtendable>() .With(typeof(ClearAllCachesEvent)); IBeanConfiguration ormXmlReaderLegathy = beanContextFactory.RegisterBean <OrmXmlReaderLegathy>(); ExtendableBean.RegisterExtendableBean(beanContextFactory, typeof(IOrmXmlReaderRegistry), typeof(IOrmXmlReaderExtendable)) // .PropertyRef(ExtendableBean.P_DEFAULT_BEAN, ormXmlReaderLegathy); IBeanConfiguration ormXmlReader20BC = beanContextFactory.RegisterBean <OrmXmlReader20>(); beanContextFactory.Link(ormXmlReader20BC).To <IOrmXmlReaderExtendable>().With(OrmXmlReader20.ORM_XML_NS); beanContextFactory.RegisterBean <XmlConfigUtil>().Autowireable <IXmlConfigUtil>(); beanContextFactory.RegisterBean <RelationProvider>().Autowireable(typeof(IRelationProvider), typeof(INoEntityTypeExtendable)); beanContextFactory.RegisterBean <MemberTypeProvider>().Autowireable <IMemberTypeProvider>().Autowireable <IIntermediateMemberTypeProvider>(); beanContextFactory.RegisterBean <EmbeddedMemberMixin>().Autowireable <EmbeddedMemberMixin>(); beanContextFactory.RegisterBean <ObjRefFactory>().Autowireable <IObjRefFactory>(); IBeanConfiguration objRefObjectCopierExtension = beanContextFactory.RegisterBean <ObjRefObjectCopierExtension>(); beanContextFactory.Link(objRefObjectCopierExtension).To <IObjectCopierExtendable>().With(typeof(IObjRef)); Type entityFactoryType = this.EntityFactoryType; if (entityFactoryType == null) { entityFactoryType = typeof(EntityFactory); } beanContextFactory.RegisterBean("entityFactory", entityFactoryType).Autowireable <IEntityFactory>(); beanContextFactory.RegisterBean <ObjRefStoreEntryProvider>().Autowireable <IObjRefStoreEntryProvider>(); if (IsNetworkClientMode && IsMergeServiceBeanActive) { IBeanConfiguration remoteMergeServiceExtension = beanContextFactory.RegisterBean <ClientServiceBean>(DEFAULT_MERGE_SERVICE_EXTENSION) .PropertyValue("Interface", typeof(IMergeServiceExtension)) .PropertyValue("SyncRemoteInterface", typeof(IMergeServiceWCF)) .PropertyValue("AsyncRemoteInterface", typeof(IMergeClient)); // register to all entities in a "most-weak" manner beanContextFactory.Link(remoteMergeServiceExtension).To <IMergeServiceExtensionExtendable>().With(typeof(Object)); } }
public virtual void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { { IBeanConfiguration cyclicXmlControllerBC = beanContextFactory.RegisterBean(typeof(CyclicXmlController)).Parent("abstractElementHandler"); IBeanConfiguration cyclicXmlReaderBC = beanContextFactory.RegisterBean(typeof(CyclicXmlReader)).PropertyRefs(cyclicXmlControllerBC); IBeanConfiguration cyclicXmlWriterBC = beanContextFactory.RegisterBean(typeof(CyclicXmlWriter)).PropertyRefs(cyclicXmlControllerBC); beanContextFactory.RegisterBean(CYCLIC_XML_HANDLER, typeof(CyclicXmlHandler)).PropertyRefs(cyclicXmlReaderBC, cyclicXmlWriterBC, cyclicXmlControllerBC); } { IBeanConfiguration simpleXmlControllerBC = beanContextFactory.RegisterBean(typeof(SimpleXmlController)); IBeanConfiguration simpleXmlReaderBC = beanContextFactory.RegisterBean(typeof(SimpleXmlReader)).PropertyRefs(simpleXmlControllerBC); IBeanConfiguration simpleXmlWriterBC = beanContextFactory.RegisterBean(typeof(SimpleXmlWriter)).PropertyRefs(simpleXmlControllerBC); beanContextFactory.RegisterBean(SIMPLE_XML_HANDLER, typeof(CyclicXmlHandler)).PropertyRefs(simpleXmlReaderBC, simpleXmlWriterBC, simpleXmlControllerBC); } beanContextFactory.RegisterBean(typeof(XmlTypeRegistry)).Autowireable(typeof(IXmlTypeRegistry), typeof(IXmlTypeExtendable)); beanContextFactory.RegisterBean(typeof(CommandBuilder)).Autowireable(typeof(ICommandBuilder)); IBeanConfiguration classElementHandlerBC = beanContextFactory.RegisterBean(typeof(ClassNameHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(classElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("c"); IBeanConfiguration objectElementHandlerBC = beanContextFactory.RegisterBean(typeof(ObjectTypeHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(objectElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(ITypeBasedHandlerExtendable)).With(typeof(Object)); IBeanConfiguration objRefElementHandlerBC = beanContextFactory.RegisterBean(typeof(ObjRefElementHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(objRefElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("or"); IBeanConfiguration stringElementHandlerBC = beanContextFactory.RegisterBean(typeof(StringNameHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(stringElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("s"); IBeanConfiguration oriWrapperElementHandlerBC = beanContextFactory.RegisterBean(typeof(ObjRefWrapperElementHandler)).Parent( "abstractElementHandler"); beanContextFactory.Link(oriWrapperElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("ow"); IBeanConfiguration numberElementHandlerBC = beanContextFactory.RegisterBean(typeof(NumberTypeHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Int64?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Int32?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Int16?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(UInt64?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(UInt32?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(UInt16?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Double?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Single?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Byte?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(SByte?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Boolean?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Char?)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Int64)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Int32)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Int16)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(UInt64)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(UInt32)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(UInt16)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Double)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Single)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Byte)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(SByte)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Boolean)); beanContextFactory.Link(numberElementHandlerBC).To <ITypeBasedHandlerExtendable>(CYCLIC_XML_HANDLER).With(typeof(Char)); IBeanConfiguration dateTypeHandlerBC = beanContextFactory.RegisterBean(typeof(DateElementHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(dateTypeHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("d"); IBeanConfiguration collectionElementHandlerBC = beanContextFactory.RegisterBean(typeof(CollectionElementHandler)).Parent( "abstractElementHandler"); beanContextFactory.Link(collectionElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("l"); beanContextFactory.Link(collectionElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("set"); beanContextFactory.RegisterBean("abstractElementHandler", typeof(AbstractHandler)).PropertyRef("ClassElementHandler", classElementHandlerBC).Template(); IBeanConfiguration arrayElementHandlerBC = beanContextFactory.RegisterBean(typeof(ArrayNameHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(arrayElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("a"); IBeanConfiguration enumElementHandlerBC = beanContextFactory.RegisterBean(typeof(EnumNameHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(enumElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("e"); IBeanConfiguration timeSpanElementHandlerBC = beanContextFactory.RegisterBean(typeof(TimeSpanElementHandler)).Parent("abstractElementHandler"); beanContextFactory.Link(timeSpanElementHandlerBC).To(CYCLIC_XML_HANDLER, typeof(INameBasedHandlerExtendable)).With("t"); beanContextFactory.RegisterBean("xmlTransferScanner", typeof(XmlTransferScanner)); beanContextFactory.RegisterBean("xmlDictionary", typeof(CyclicXmlDictionary)).Autowireable(typeof(ICyclicXmlDictionary)); ExtendableBean.RegisterExtendableBean(beanContextFactory, "objectFutureHandlerExtendable", typeof(IObjectFutureHandlerRegistry), typeof(IObjectFutureHandlerExtendable)); beanContextFactory.RegisterBean("objRefFutureHandler", typeof(ObjRefFutureHandler)); beanContextFactory.Link("objRefFutureHandler").To(typeof(IObjectFutureHandlerExtendable)).With(typeof(ObjRefFuture)); beanContextFactory.RegisterBean("prefetchFutureHandler", typeof(PrefetchFutureHandler)); beanContextFactory.Link("prefetchFutureHandler").To(typeof(IObjectFutureHandlerExtendable)).With(typeof(PrefetchFuture)); ExtendableBean.RegisterExtendableBean(beanContextFactory, "xmlPostProcessorRegistry", typeof(IXmlPostProcessorRegistry), typeof(IXmlPostProcessorExtendable)).PropertyValue("ArgumentTypes", new Type[] { typeof(String) }); beanContextFactory.RegisterBean("mergeXmlPostProcessor", typeof(MergeXmlPostProcessor)); beanContextFactory.Link("mergeXmlPostProcessor").To(typeof(IXmlPostProcessorExtendable)).With("merge"); beanContextFactory.RegisterBean <CUDResultPrinter>().Autowireable <ICUDResultPrinter>(); }