public ILinkRegistryNeededConfiguration Link(IBeanConfiguration listenerBean, String methodName) { LinkConfiguration <Object> linkConfiguration = linkController.CreateLinkConfiguration(listenerBean, methodName); AddBeanConfiguration(linkConfiguration); return(linkConfiguration); }
public static IBeanConfiguration AddDefaultBytecodeBehavior(IBeanContextFactory beanContextFactory, Type behaviorType) { IBeanConfiguration behaviorBC = beanContextFactory.RegisterBean(behaviorType); beanContextFactory.Link(behaviorBC).To <IBytecodeBehaviorExtendable>(); return(behaviorBC); }
public ILinkRegistryNeededConfiguration Link(IBeanConfiguration listenerBean) { LinkConfiguration <Object> linkConfiguration = linkController.CreateLinkConfiguration(listenerBean, null); AddBeanConfiguration(linkConfiguration); return(linkConfiguration); }
public IBeanConfiguration GetBeanConfiguration(String beanName) { if (nameToBeanConfMap == null || beanName == null) { return(null); } IBeanConfiguration beanConf = nameToBeanConfMap.Get(beanName); if (beanConf == null) { if (aliasToBeanNameMap != null) { String aliasName = DictionaryExtension.ValueOrDefault(aliasToBeanNameMap, beanName); if (aliasName != null) { beanConf = nameToBeanConfMap.Get(aliasName); } } } if (beanConf == null && parent != null) { beanConf = parent.GetBeanConfiguration(beanName); } return(beanConf); }
protected ICascadedInterceptor HandleServiceClientAnnotation(AnnotationEntry <ServiceClientAttribute> serviceClientAnnotation, IBeanContextFactory beanContextFactory, IServiceContext beanContext, IBeanConfiguration beanConfiguration, Type type) { String serviceName = ExtractServiceName(serviceClientAnnotation.Annotation.Name, serviceClientAnnotation.DeclaringType); IMethodLevelBehavior <Attribute> behavior = CreateInterceptorModeBehavior(type); CacheInterceptor interceptor = new CacheInterceptor(); if (beanContext.IsRunning) { interceptor = beanContext.RegisterWithLifecycle(interceptor) // .PropertyValue("ServiceName", serviceName) // .PropertyValue("Behavior", behavior) // .Finish(); } else { beanContextFactory.RegisterWithLifecycle(interceptor) // .PropertyValue("ServiceName", serviceName) // .PropertyValue("Behavior", behavior); } if (Log.InfoEnabled) { Log.Info("Creating application service stub for service '" + serviceName + "' accessing with '" + serviceClientAnnotation.DeclaringType.FullName + "'"); } return(interceptor); }
public PropertyRefConfiguration(IBeanConfiguration parentBeanConfiguration, String beanName, bool optional, IProperties props) : base(parentBeanConfiguration, props) { ParamChecker.AssertParamNotNull(beanName, "beanName"); this.beanName = beanName; this.optional = optional; }
public PropertyEmbeddedRefConfiguration(IBeanConfiguration parentBeanConfiguration, String propertyName, IBeanConfiguration embeddedBean, IProperties props) : base(parentBeanConfiguration, props) { ParamChecker.AssertParamNotNull(propertyName, "propertyName"); ParamChecker.AssertParamNotNull(embeddedBean, "embeddedBean"); this.propertyName = propertyName; this.embeddedBean = embeddedBean; }
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 IBeanConfiguration PropertyRef(IBeanConfiguration bean) { ParamChecker.AssertParamNotNull(bean, "bean"); if (propertyConfigurations == null) { propertyConfigurations = new List <IPropertyConfiguration>(); } propertyConfigurations.Add(new PropertyEmbeddedRefConfiguration(this, bean, props)); return(this); }
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) { // 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 Link(IBeanConfiguration listenerBean, Type autowiredRegistryClass, params Object[] arguments) { ParamChecker.AssertParamNotNull(listenerBean, "listenerBean"); String listenerBeanName = listenerBean.GetName(); ParamChecker.AssertParamNotNull(listenerBeanName, "listenerBean.getName()"); IBeanConfiguration beanConfiguration = createLinkConfiguration(listenerBeanName, autowiredRegistryClass, arguments); AddBeanConfiguration(beanConfiguration); }
public ILinkRegistryNeededRuntime Link(IServiceContext serviceContext, IBeanConfiguration listenerBean, String methodName) { LinkRuntime <LinkContainer> linkRuntime = new LinkRuntime <LinkContainer>((ServiceContext)serviceContext, typeof(LinkContainer)); linkRuntime.Listener(listenerBean); if (methodName != null) { linkRuntime.ListenerMethod(methodName); } return(linkRuntime); }
public IBeanConfiguration GetBeanConfiguration(BeanContextFactory beanContextFactory, String beanName) { CheckNotDisposed(); IBeanConfiguration beanConfiguration = beanContextFactory.GetBeanConfiguration(beanName); if (beanConfiguration == null && parent != null) { return(parent.GetBeanConfiguration(beanName)); } return(beanConfiguration); }
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 LinkConfiguration <Object> CreateLinkConfiguration(IBeanConfiguration listenerBean, String methodName) { LinkConfiguration <Object> linkConfiguration = new LinkConfiguration <Object>(typeof(LinkContainer), ProxyFactory, Props); linkConfiguration.PropertyValue(LinkContainer.PROPERTY_LISTENER_BEAN, listenerBean); if (methodName != null) { linkConfiguration.PropertyValue(LinkContainer.PROPERTY_LISTENER_METHOD_NAME, methodName); } return(linkConfiguration); }
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 Link(IServiceContext serviceContext, IBeanConfiguration listenerBean, Type autowiredRegistryClass, Object[] arguments) { ParamChecker.AssertParamNotNull(serviceContext, "serviceContext"); ParamChecker.AssertParamNotNull(listenerBean, "listenerBean"); ParamChecker.AssertParamNotNull(autowiredRegistryClass, "autowiredRegistryClass"); ParamChecker.AssertParamNotNull(arguments, "arguments"); AbstractLinkContainerOld linkContainer = createLinkContainer(autowiredRegistryClass, arguments); linkContainer.RegistryBeanAutowiredType = autowiredRegistryClass; linkContainer.ListenerBean = listenerBean; linkContainer.BeanContext = serviceContext; serviceContext.RegisterWithLifecycle(linkContainer).Finish(); }
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 IBeanContextHolder <RadWindow> CreateDefaultWindow(String header, UserControl content) { String windowBeanName = "window"; IBeanContextHolder <RadWindow> radWindow = BeanContext.CreateService <RadWindow>(delegate(IBeanContextFactory childContextFactory) { childContextFactory.RegisterExternalBean("param.header", header); IBeanConfiguration window = childContextFactory.RegisterBean <RadWindow>(windowBeanName) .PropertyRef("Header", "param.header") .PropertyValue("WindowStartupLocation", Telerik.Windows.Controls.WindowStartupLocation.CenterScreen) .PropertyValue("CanClose", "true") .PropertyValue("CanMove", "true") .PropertyValue("ResizeMode", ResizeMode.CanResize) .Autowireable <RadWindow>(); if (content != null) { // Optional content argument childContextFactory.RegisterExternalBean("param.content", content); window.PropertyRef("Content", "param.content") .PropertyValue("Width", content.Width + 20) .PropertyValue("Height", content.Height + 50); } UserControl parent = Application.Current.RootVisual as UserControl; if (parent != null) { window.PropertyValue("MaxHeight", parent.ActualHeight) .PropertyValue("MaxWidth", parent.ActualWidth); } if (parent != null && content != null) { window.PropertyValue("MinHeight", Math.Min(content.MinHeight, parent.ActualHeight)) .PropertyValue("MinWidth", Math.Min(content.MinWidth, parent.ActualWidth)); } }); radWindow.LinkExtendable.Link(new RoutedEventHandler(DefaultWindow_Loaded)).To(windowBeanName, RadWindowEvents.Loaded); radWindow.LinkExtendable.Link(new SizeChangedEventHandler(DefaultWindow_SizeChanged)).To(windowBeanName, RadWindowEvents.SizeChanged); return(radWindow); }
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)); }
protected void AddBeanConfiguration(IBeanConfiguration beanConfiguration) { String beanName = beanConfiguration.GetName(); if (beanName != null && beanName.Length > 0) { if (nameToBeanConfMap == null) { nameToBeanConfMap = new HashMap <String, IBeanConfiguration>(); } if (aliasToBeanNameMap != null && aliasToBeanNameMap.ContainsKey(beanName)) { throw new Exception("An alias with the name '" + beanName + "' of this bean is already registered in this context"); } if (!beanConfiguration.IsOverridesExisting()) { if (!nameToBeanConfMap.PutIfNotExists(beanName, beanConfiguration)) { IBeanConfiguration existingBeanConfiguration = nameToBeanConfMap.Get(beanName); if (!existingBeanConfiguration.IsOverridesExisting()) { throw ServiceContext.CreateDuplicateBeanNameException(beanName, beanConfiguration, existingBeanConfiguration); } // Existing config requests precedence over every other bean config. This is no error return; } } else { // Intentionally put the configuration in the map unaware of an existing entry nameToBeanConfMap.Put(beanName, beanConfiguration); } } if (beanConfigurations == null) { beanConfigurations = new List <IBeanConfiguration>(); } beanConfigurations.Add(beanConfiguration); }
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); } }
protected override ICascadedInterceptor HandleServiceIntern(IBeanContextFactory beanContextFactory, IServiceContext beanContext, IBeanConfiguration beanConfiguration, Type type, ISet <Type> requestedTypes) { ServiceAttribute serviceAnnotation = serviceAnnotationCache.GetAnnotation(type); if (serviceAnnotation != null) { return(HandleServiceAnnotation(serviceAnnotation, beanContextFactory, beanContext, beanConfiguration, type)); } AnnotationEntry <ServiceClientAttribute> serviceClientAnnotation = serviceClientAnnotationCache.GetAnnotationEntry(type); if (serviceClientAnnotation != null) { return(HandleServiceClientAnnotation(serviceClientAnnotation, beanContextFactory, beanContext, beanConfiguration, type)); } return(null); }
public ILinkRegistryNeededRuntime Link(IServiceContext serviceContext, IBeanConfiguration listenerBean) { return(Link(serviceContext, listenerBean, (String)null)); }
public void Link <R>(IServiceContext serviceContext, IBeanConfiguration listenerBean, Object[] arguments) { Link(serviceContext, listenerBean, typeof(R), arguments); }
public void Link(IServiceContext serviceContext, IBeanConfiguration listenerBean, Type autowiredRegistryClass) { Link(serviceContext, listenerBean, autowiredRegistryClass, emptyArgs); }
public void Link <R>(IServiceContext serviceContext, IBeanConfiguration listenerBean) { Link(serviceContext, listenerBean, typeof(R), emptyArgs); }