Пример #1
0
        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));
            }
        }
Пример #2
0
        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>();
        }