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) { if (dispatcherThread != null) { throw new Exception("Module instantiated twice"); } SynchronizationContext syncContext = null; CountDownLatch latch = new CountDownLatch(1); Log.Info("Create SyncContext..."); dispatcherThread = new Thread(delegate() { // Create our context, and install it: try { syncContext = new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher); SynchronizationContext.SetSynchronizationContext(syncContext); Log.Info("I am the UI Thread"); } finally { latch.CountDown(); } // Start the Dispatcher Processing System.Windows.Threading.Dispatcher.Run(); }); dispatcherThread.Name = "TestDispatcherThread"; dispatcherThread.IsBackground = true; dispatcherThread.Start(); latch.Await(); Log.Info("SyncContext created"); }
public static IBeanConfiguration AddDefaultBytecodeBehavior(IBeanContextFactory beanContextFactory, Type behaviorType) { IBeanConfiguration behaviorBC = beanContextFactory.RegisterBean(behaviorType); beanContextFactory.Link(behaviorBC).To <IBytecodeBehaviorExtendable>(); return(behaviorBC); }
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 <TestXmlPostProcessor>("testXmlPostProcessor").autowireable <TestXmlPostProcessor>(); beanContextFactory.link("testXmlPostProcessor").to <IXmlPostProcessorExtendable>().with("test1"); beanContextFactory.link("testXmlPostProcessor").to <IXmlPostProcessorExtendable>().with("test2"); beanContextFactory.link("testXmlPostProcessor").to <IXmlPostProcessorExtendable>().with("test3"); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { if (EventManagerName != null) { beanContextFactory.Link(EventManagerName).To <IEventListenerExtendable>().With(typeof(IDataChange)); } }
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 void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { for (int a = Count; a-- > 0;) { beanContextFactory.RegisterBean("name" + a, typeof(TestBean)).PropertyValue("Value", "value"); } }
protected void CreateDispatcherThread(IBeanContextFactory beanContextFactory) { SynchronizationContext syncContext = null; CountDownLatch latch = new CountDownLatch(1); dispatcherThread = new Thread(delegate() { // Create our context, and install it: try { syncContext = new DispatcherSynchronizationContext(Dispatcher.CurrentDispatcher); SynchronizationContext.SetSynchronizationContext(syncContext); Log.Info("I am the UI Thread"); } finally { latch.CountDown(); } // Start the Dispatcher Processing System.Windows.Threading.Dispatcher.Run(); }); dispatcherThread.Name = "TestDispatcherThread"; //dispatcherThread.IsBackground = true; dispatcherThread.Start(); latch.Await(); //SynchronizationContext.SetSynchronizationContext(syncContext); beanContextFactory.RegisterExternalBean(syncContext).Autowireable <SynchronizationContext>(); beanContextFactory.RegisterExternalBean(new UIThreadWrapper(dispatcherThread)).Autowireable <UIThreadWrapper>(); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean(bean1Name, typeof(Bean1)); beanContextFactory.RegisterBean(bean2Name, typeof(Bean2)).Autowireable <Bean2>(); beanContextFactory.RegisterBean(bean3Name, typeof(Bean3)); beanContextFactory.RegisterBean <AutowiredTestBean>().Autowireable <AutowiredTestBean>(); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { List <int> testList = new List <int>(); testList.Add(1); testList.Add(2); beanContextFactory.RegisterWithLifecycle(testList).Autowireable <IList <int> >(); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean <SingletonContextHandle>(SINGLETON_CCH).PropertyValue("Content", new IBackgroundWorkerParamDelegate <IBeanContextFactory>(new DummyListTestModule().AfterPropertiesSet)); beanContextFactory.RegisterBean <ThreadLocalContextHandle>(THREADLOCAL_CCH).PropertyValue("Content", new IBackgroundWorkerParamDelegate <IBeanContextFactory>(new DummyListTestModule().AfterPropertiesSet)); beanContextFactory.RegisterBean <PrototypeContextHandle>(PROTOTYPE_CCH).PropertyValue("Content", new IBackgroundWorkerParamDelegate <IBeanContextFactory>(new DummyListTestModule().AfterPropertiesSet)); beanContextFactory.RegisterBean <SingletonContextHandle>(SINGLETON_CCH_WITH_CCF).PropertyRef("ContextFactory", CHILD_CONTEXT_FACTORY); }
public virtual void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { String[] transferObjectsScopes = TransferObjectsScope.Split(';'); foreach (Assembly assembly in AssemblyHelper.Assemblies) { FullServiceModelProvider.ShareServiceModel(assembly, transferObjectsScopes); } }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean("revertChangesHelper", typeof(RevertChangesHelperMock)).Autowireable(typeof(IRevertChangesHelper)); beanContextFactory.RegisterBean("cache", typeof(CacheMock)).Autowireable(typeof(ICache)); beanContextFactory.RegisterBean("cacheFactory", typeof(CacheFactoryMock)).Autowireable(typeof(ICacheFactory)); beanContextFactory.RegisterBean("cacheProvider", typeof(CacheProviderMock)).Autowireable(typeof(ICacheProvider)); beanContextFactory.RegisterBean("prefetchHelper", typeof(PrefetchHelperMock)).Autowireable(typeof(IPrefetchHelper)); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { // creates objects that implement the interfaces beanContextFactory.RegisterBean(IMPLEMENT_ABSTRACT_OBJECT_FACTORY, typeof(ImplementAbstractObjectFactory)).Autowireable( typeof(IImplementAbstractObjectFactory), typeof(IImplementAbstractObjectFactoryExtendable)); BytecodeModule.AddDefaultBytecodeBehavior(beanContextFactory, typeof(ImplementAbstractObjectBehavior)).PropertyRef("ImplementAbstractObjectFactory", IMPLEMENT_ABSTRACT_OBJECT_FACTORY); }
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) { beanContextFactory.RegisterBean <ThreadPool>("threadPool").Autowireable(typeof(IThreadPool), typeof(IDelayedExecution)); beanContextFactory.RegisterBean <BooleanArrayConverter>("booleanArrayConverter"); DedicatedConverterUtil.BiLink(beanContextFactory, "booleanArrayConverter", typeof(String), typeof(bool[])); beanContextFactory.RegisterBean <ByteArrayConverter>("byteArrayConverter"); DedicatedConverterUtil.BiLink(beanContextFactory, "byteArrayConverter", typeof(String), typeof(byte[])); beanContextFactory.RegisterBean <SByteArrayConverter>("sbyteArrayConverter"); DedicatedConverterUtil.BiLink(beanContextFactory, "sbyteArrayConverter", typeof(String), typeof(sbyte[])); beanContextFactory.RegisterBean <CharArrayConverter>("charArrayConverter"); DedicatedConverterUtil.BiLink(beanContextFactory, "charArrayConverter", typeof(String), typeof(char[])); IBeanConfiguration stringToFileConverter = beanContextFactory.RegisterBean <StringToFileConverter>(); DedicatedConverterUtil.Link(beanContextFactory, stringToFileConverter, typeof(String), typeof(FileInfo)); DedicatedConverterUtil.Link(beanContextFactory, stringToFileConverter, typeof(String), typeof(DirectoryInfo)); IBeanConfiguration stringToClassArrayConverter = beanContextFactory.RegisterBean <StringToClassArrayConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, stringToClassArrayConverter, typeof(String), typeof(Type[])); IBeanConfiguration stringToDoubleArrayConverter = beanContextFactory.RegisterBean <StringToDoubleArrayConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, stringToDoubleArrayConverter, typeof(String), typeof(double[])); IBeanConfiguration stringToFloatArrayConverter = beanContextFactory.RegisterBean <StringToFloatArrayConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, stringToFloatArrayConverter, typeof(String), typeof(float[])); IBeanConfiguration stringToIntArrayConverter = beanContextFactory.RegisterBean <StringToIntArrayConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, stringToIntArrayConverter, typeof(String), typeof(int[])); IBeanConfiguration stringToLongArrayConverter = beanContextFactory.RegisterBean <StringToLongArrayConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, stringToLongArrayConverter, typeof(String), typeof(long[])); IBeanConfiguration stringToPatternConverterBC = beanContextFactory.RegisterBean <StringToPatternConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, stringToPatternConverterBC, typeof(String), typeof(Regex)); DedicatedConverterUtil.BiLink(beanContextFactory, stringToPatternConverterBC, typeof(String), typeof(Regex[])); IBeanConfiguration stringToStringArrayConverter = beanContextFactory.RegisterBean <StringToStringArrayConverter>(); DedicatedConverterUtil.BiLink(beanContextFactory, stringToStringArrayConverter, typeof(String), typeof(String[])); beanContextFactory.RegisterBean <InterningFeature>("interningFeature").Autowireable <IInterningFeature>(); beanContextFactory.RegisterBean <GuiThreadHelper>("guiThreadHelper").Autowireable <IGuiThreadHelper>(); beanContextFactory.RegisterBean <MultithreadingHelper>().Autowireable <IMultithreadingHelper>(); }
public static void Transfer(IServiceContext sourceContext, IBeanContextFactory targetContextFactory, String[] beanNames) { ParamChecker.AssertParamNotNull(sourceContext, "sourceContext"); ParamChecker.AssertParamNotNull(targetContextFactory, "targetContextFactory"); ParamChecker.AssertParamNotNull(beanNames, "beanNames"); for (int a = beanNames.Length; a-- > 0;) { Transfer(sourceContext, targetContextFactory, beanNames[a]); } }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.registerBean <ExtendableBean>("testExtensionPoint") .propertyValue(ExtendableBean.P_EXTENDABLE_TYPE, typeof(ITestListenerExtendable)) .propertyValue(ExtendableBean.P_PROVIDER_TYPE, typeof(ITestListenerRegistry)); beanContextFactory.registerBean <ExtendableBean>("testExtensionPoint2") .propertyValue(ExtendableBean.P_EXTENDABLE_TYPE, typeof(ITestListenerExtendable2)) .propertyValue(ExtendableBean.P_PROVIDER_TYPE, typeof(ITestListenerRegistry2)); }
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 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 static void Transfer(IServiceContext sourceContext, IBeanContextFactory targetContextFactory, Type[] autowireableTypes) { ParamChecker.AssertParamNotNull(sourceContext, "sourceContext"); ParamChecker.AssertParamNotNull(targetContextFactory, "targetContextFactory"); ParamChecker.AssertParamNotNull(autowireableTypes, "autowireableTypes"); for (int a = autowireableTypes.Length; a-- > 0;) { Transfer(sourceContext, targetContextFactory, autowireableTypes[a]); } }
public virtual void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { beanContextFactory.RegisterBean <CompositeIdFactory>("compositeIdFactory").Autowireable <ICompositeIdFactory>(); BytecodeModule.AddDefaultBytecodeBehavior <CompositeIdBehavior>(beanContextFactory); BytecodeModule.AddDefaultBytecodeBehavior <EntityMetaDataMemberBehavior>(beanContextFactory); BytecodeModule.AddDefaultBytecodeBehavior <ObjRefBehavior>(beanContextFactory); BytecodeModule.AddDefaultBytecodeBehavior <ObjRefStoreBehavior>(beanContextFactory); }
public static IBeanConfiguration RegisterExtendableBean(IBeanContextFactory beanContextFactory, String beanName, Type providerType, Type extendableType) { if (beanName != null) { return(beanContextFactory.RegisterBean(beanName, typeof(ExtendableBean)).PropertyValue(ExtendableBean.P_PROVIDER_TYPE, providerType) .PropertyValue(ExtendableBean.P_EXTENDABLE_TYPE, extendableType).Autowireable(providerType, extendableType)); } return(beanContextFactory.RegisterBean(typeof(ExtendableBean)).PropertyValue(ExtendableBean.P_PROVIDER_TYPE, providerType) .PropertyValue(ExtendableBean.P_EXTENDABLE_TYPE, extendableType).Autowireable(providerType, extendableType)); }
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.RegisterBean <MainPage>("mainPage").Precedence(PrecedenceType.LOW); beanContextFactory.RegisterBean <UndoNotPersistedCommand>("command_cancel"); beanContextFactory.RegisterBean <SaveNotPersistedCommand>("command_save").PropertyRef("ControllerService", "client.helloWorldService").PropertyValue("MethodName", "SaveTestEntities") .PropertyValue("MethodParameters", new Type[] { typeof(IEnumerable <TestEntity>) }); beanContextFactory.RegisterBean <SaveNotPersistedCommand>("command_save2").PropertyRef("ControllerService", "client.helloWorldService").PropertyValue("MethodName", "SaveTestEntities2") .PropertyValue("MethodParameters", new Type[] { typeof(IEnumerable <TestEntity2>) }); }
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 static void Transfer(IServiceContext sourceContext, IBeanContextFactory targetContextFactory, Type autowireableType) { ParamChecker.AssertParamNotNull(sourceContext, "sourceContext"); ParamChecker.AssertParamNotNull(targetContextFactory, "targetContextFactory"); ParamChecker.AssertParamNotNull(autowireableType, "autowireableType"); Object bean = sourceContext.GetService(autowireableType); if (bean == null) { throw new System.Exception("No autowired bean found for type " + autowireableType.FullName); } targetContextFactory.RegisterExternalBean(bean).Autowireable(autowireableType); }
public static void Transfer(IServiceContext sourceContext, IBeanContextFactory targetContextFactory, String beanName) { ParamChecker.AssertParamNotNull(sourceContext, "sourceContext"); ParamChecker.AssertParamNotNull(targetContextFactory, "targetContextFactory"); ParamChecker.AssertParamNotNull(beanName, "beanName"); Object bean = sourceContext.GetService(beanName); if (bean == null) { throw new System.Exception("No bean found with name '" + beanName + "'"); } targetContextFactory.RegisterExternalBean(beanName, bean); }
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"); } }