当前位置: 首页>>代码示例>>Java>>正文


Java CompositeComponentDefinition类代码示例

本文整理汇总了Java中org.springframework.beans.factory.parsing.CompositeComponentDefinition的典型用法代码示例。如果您正苦于以下问题:Java CompositeComponentDefinition类的具体用法?Java CompositeComponentDefinition怎么用?Java CompositeComponentDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompositeComponentDefinition类属于org.springframework.beans.factory.parsing包,在下文中一共展示了CompositeComponentDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseChildElements

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
private void parseChildElements(Element element, String parentId, String redissonRef, BeanDefinitionBuilder redissonDef, ParserContext parserContext) {
    if (element.hasChildNodes()) {
        CompositeComponentDefinition compositeDef
                = new CompositeComponentDefinition(parentId,
                        parserContext.extractSource(element));
        parserContext.pushContainingComponent(compositeDef);
        List<Element> childElts = DomUtils.getChildElements(element);
        for (Element elt : childElts) {
            if(BeanDefinitionParserDelegate
                    .QUALIFIER_ELEMENT.equals(elt.getLocalName())) {
                continue;//parsed elsewhere
            }
            String localName = parserContext.getDelegate().getLocalName(elt);
            localName = Conventions.attributeNameToPropertyName(localName);
            if (ConfigType.contains(localName)) {
                parseConfigTypes(elt, localName, redissonDef, parserContext);
            } else if (AddressType.contains(localName)) {
                parseAddressTypes(elt, localName, redissonDef, parserContext);
            } else if (helper.isRedissonNS(elt)) {
                elt.setAttribute(REDISSON_REF, redissonRef);
                parserContext.getDelegate().parseCustomElement(elt);
            }
        }
        parserContext.popContainingComponent();
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:27,代码来源:RedissonDefinitionParser.java

示例2: parse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
	Object source = parserContext.extractSource(element);

	// Obtain bean definitions for all relevant BeanPostProcessors.
	Set<BeanDefinitionHolder> processorDefinitions =
			AnnotationConfigUtils.registerAnnotationConfigProcessors(parserContext.getRegistry(), source);

	// Register component for the surrounding <context:annotation-config> element.
	CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source);
	parserContext.pushContainingComponent(compDefinition);

	// Nest the concrete beans in the surrounding component.
	for (BeanDefinitionHolder processorDefinition : processorDefinitions) {
		parserContext.registerComponent(new BeanComponentDefinition(processorDefinition));
	}

	// Finally register the composite component.
	parserContext.popAndRegisterContainingComponent();

	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:AnnotationConfigBeanDefinitionParser.java

示例3: registerComponents

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
protected void registerComponents(
		XmlReaderContext readerContext, Set<BeanDefinitionHolder> beanDefinitions, Element element) {

	Object source = readerContext.extractSource(element);
	CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), source);

	for (BeanDefinitionHolder beanDefHolder : beanDefinitions) {
		compositeDef.addNestedComponent(new BeanComponentDefinition(beanDefHolder));
	}

	// Register annotation config processors, if necessary.
	boolean annotationConfig = true;
	if (element.hasAttribute(ANNOTATION_CONFIG_ATTRIBUTE)) {
		annotationConfig = Boolean.valueOf(element.getAttribute(ANNOTATION_CONFIG_ATTRIBUTE));
	}
	if (annotationConfig) {
		Set<BeanDefinitionHolder> processorDefinitions =
				AnnotationConfigUtils.registerAnnotationConfigProcessors(readerContext.getRegistry(), source);
		for (BeanDefinitionHolder processorDefinition : processorDefinitions) {
			compositeDef.addNestedComponent(new BeanComponentDefinition(processorDefinition));
		}
	}

	readerContext.fireComponentRegistered(compositeDef);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:ComponentScanBeanDefinitionParser.java

示例4: parse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
	CompositeComponentDefinition compositeDef =
			new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));
	parserContext.pushContainingComponent(compositeDef);

	configureAutoProxyCreator(parserContext, element);

	List<Element> childElts = DomUtils.getChildElements(element);
	for (Element elt: childElts) {
		String localName = parserContext.getDelegate().getLocalName(elt);
		if (POINTCUT.equals(localName)) {
			parsePointcut(elt, parserContext);
		}
		else if (ADVISOR.equals(localName)) {
			parseAdvisor(elt, parserContext);
		}
		else if (ASPECT.equals(localName)) {
			parseAspect(elt, parserContext);
		}
	}

	parserContext.popAndRegisterContainingComponent();
	return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:ConfigBeanDefinitionParser.java

示例5: doParse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
private synchronized void doParse(Element element, ParserContext parserContext) {
    String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute("base-package"), ",; \t\n");
    AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);
    if (!parserContext.getRegistry().containsBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME)) {
        Object eleSource = parserContext.extractSource(element);

        RootBeanDefinition configMapDef = new RootBeanDefinition(ConcurrentHashMap.class);
        configMapDef.setSource(eleSource);
        configMapDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        String configMapName = parserContext.getReaderContext().registerWithGeneratedName(configMapDef);

        RootBeanDefinition interceptorDef = new RootBeanDefinition(JetCacheInterceptor.class);
        interceptorDef.setSource(eleSource);
        interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        interceptorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
        String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);

        RootBeanDefinition advisorDef = new RootBeanDefinition(CacheAdvisor.class);
        advisorDef.setSource(eleSource);
        advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("adviceBeanName", interceptorName));
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("cacheConfigMap", new RuntimeBeanReference(configMapName)));
        advisorDef.getPropertyValues().addPropertyValue(new PropertyValue("basePackages", basePackages));
        parserContext.getRegistry().registerBeanDefinition(CacheAdvisor.CACHE_ADVISOR_BEAN_NAME, advisorDef);

        CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
                eleSource);
        compositeDef.addNestedComponent(new BeanComponentDefinition(configMapDef, configMapName));
        compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
        compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CacheAdvisor.CACHE_ADVISOR_BEAN_NAME));
        parserContext.registerComponent(compositeDef);
    }
}
 
开发者ID:alibaba,项目名称:jetcache,代码行数:34,代码来源:CacheAnnotationParser.java

示例6: testPointcutEvents

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
@Test
public void testPointcutEvents() throws Exception {
	this.reader.loadBeanDefinitions(POINTCUT_EVENTS_CONTEXT);
	ComponentDefinition[] componentDefinitions = this.eventListener.getComponentDefinitions();
	assertEquals("Incorrect number of events fired", 1, componentDefinitions.length);
	assertTrue("No holder with nested components", componentDefinitions[0] instanceof CompositeComponentDefinition);

	CompositeComponentDefinition compositeDef = (CompositeComponentDefinition) componentDefinitions[0];
	assertEquals("aop:config", compositeDef.getName());

	ComponentDefinition[] nestedComponentDefs = compositeDef.getNestedComponents();
	assertEquals("Incorrect number of inner components", 2, nestedComponentDefs.length);
	PointcutComponentDefinition pcd = null;
	for (int i = 0; i < nestedComponentDefs.length; i++) {
		ComponentDefinition componentDefinition = nestedComponentDefs[i];
		if (componentDefinition instanceof PointcutComponentDefinition) {
			pcd = (PointcutComponentDefinition) componentDefinition;
			break;
		}
	}
	assertNotNull("PointcutComponentDefinition not found", pcd);
	assertEquals("Incorrect number of BeanDefinitions", 1, pcd.getBeanDefinitions().length);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:AopNamespaceHandlerEventTests.java

示例7: containsComponentDefinition

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
public boolean containsComponentDefinition(String name) {
	for (ComponentDefinition cd : this.registeredComponents) {
		if (cd instanceof CompositeComponentDefinition) {
			ComponentDefinition[] innerCds = ((CompositeComponentDefinition) cd).getNestedComponents();
			for (ComponentDefinition innerCd : innerCds) {
				if (innerCd.getName().equals(name)) {
					return true;
				}
			}
		}
		else {
			if (cd.getName().equals(name)) {
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:JmsNamespaceHandlerTests.java

示例8: registerComponents

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
protected void registerComponents(
        XmlReaderContext readerContext, Set<BeanDefinitionHolder> beanDefinitions, Element element) {

    Object source = readerContext.extractSource(element);
    CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(), source);

    for (BeanDefinitionHolder beanDefHolder : beanDefinitions) {
        compositeDef.addNestedComponent(new BeanComponentDefinition(beanDefHolder));
    }

    // Register annotation config processors, if necessary.
    Set<BeanDefinitionHolder> processorDefinitions =
            AnnotationConfigUtils.registerAnnotationConfigProcessors(readerContext.getRegistry(), source);
    for (BeanDefinitionHolder processorDefinition : processorDefinitions) {
        compositeDef.addNestedComponent(new BeanComponentDefinition(processorDefinition));
    }

    readerContext.fireComponentRegistered(compositeDef);
}
 
开发者ID:xyp260466,项目名称:dubbo-lite,代码行数:20,代码来源:AutoBeanDefinitionParser.java

示例9: parse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
public BeanDefinition parse(Element element, ParserContext parserContext) {
	CompositeComponentDefinition compositeDef =
			new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));
	parserContext.pushContainingComponent(compositeDef);

	configureAutoProxyCreator(parserContext, element);

	List<Element> childElts = DomUtils.getChildElements(element);
	for (Element elt: childElts) {
		String localName = parserContext.getDelegate().getLocalName(elt);
		if (POINTCUT.equals(localName)) {
			parsePointcut(elt, parserContext);
		}
		else if (ADVISOR.equals(localName)) {
			parseAdvisor(elt, parserContext);
		}
		else if (ASPECT.equals(localName)) {
			parseAspect(elt, parserContext);
		}
	}

	parserContext.popAndRegisterContainingComponent();
	return null;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:25,代码来源:ConfigBeanDefinitionParser.java

示例10: parse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
public BeanDefinition parse(Element element, ParserContext parserContext) {
	Object source = parserContext.extractSource(element);

	// Obtain bean definitions for all relevant BeanPostProcessors.
	Set<BeanDefinitionHolder> processorDefinitions =
			AnnotationConfigUtils.registerAnnotationConfigProcessors(parserContext.getRegistry(), source);

	// Register component for the surrounding <context:annotation-config> element.
	CompositeComponentDefinition compDefinition = new CompositeComponentDefinition(element.getTagName(), source);
	parserContext.pushContainingComponent(compDefinition);

	// Nest the concrete beans in the surrounding component.
	for (BeanDefinitionHolder processorDefinition : processorDefinitions) {
		parserContext.registerComponent(new BeanComponentDefinition(processorDefinition));
	}

	// Finally register the composite component.
	parserContext.popAndRegisterContainingComponent();

	return null;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:22,代码来源:AnnotationConfigBeanDefinitionParser.java

示例11: configureAutoProxyCreator

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
public static void configureAutoProxyCreator(Element element, ParserContext parserContext) {
	AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(parserContext, element);

	if (!parserContext.getRegistry().containsBeanDefinition(CACHE_ADVISOR_BEAN_NAME)) {
		Object eleSource = parserContext.extractSource(element);

		// Create the CacheOperationSource definition.
		RootBeanDefinition sourceDef = new RootBeanDefinition(AnnotationCacheOperationSource.class);
		sourceDef.setSource(eleSource);
		sourceDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
		String sourceName = parserContext.getReaderContext().registerWithGeneratedName(sourceDef);

		// Create the CacheInterceptor definition.
		RootBeanDefinition interceptorDef = new RootBeanDefinition(CacheInterceptor.class);
		interceptorDef.setSource(eleSource);
		interceptorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
		parseCacheManagerProperty(element, interceptorDef);
		CacheNamespaceHandler.parseKeyGenerator(element, interceptorDef);
		interceptorDef.getPropertyValues().add("cacheOperationSources", new RuntimeBeanReference(sourceName));
		String interceptorName = parserContext.getReaderContext().registerWithGeneratedName(interceptorDef);

		// Create the CacheAdvisor definition.
		RootBeanDefinition advisorDef = new RootBeanDefinition(BeanFactoryCacheOperationSourceAdvisor.class);
		advisorDef.setSource(eleSource);
		advisorDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
		advisorDef.getPropertyValues().add("cacheOperationSource", new RuntimeBeanReference(sourceName));
		advisorDef.getPropertyValues().add("adviceBeanName", interceptorName);
		if (element.hasAttribute("order")) {
			advisorDef.getPropertyValues().add("order", element.getAttribute("order"));
		}
		parserContext.getRegistry().registerBeanDefinition(CACHE_ADVISOR_BEAN_NAME, advisorDef);

		CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
				eleSource);
		compositeDef.addNestedComponent(new BeanComponentDefinition(sourceDef, sourceName));
		compositeDef.addNestedComponent(new BeanComponentDefinition(interceptorDef, interceptorName));
		compositeDef.addNestedComponent(new BeanComponentDefinition(advisorDef, CACHE_ADVISOR_BEAN_NAME));
		parserContext.registerComponent(compositeDef);
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:41,代码来源:AnnotationDrivenCacheBeanDefinitionParser.java

示例12: parse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
public BeanDefinition parse(Element element, ParserContext parserContext) {
	CompositeComponentDefinition compositeDef =
		new CompositeComponentDefinition(element.getTagName(), parserContext.extractSource(element));
	parserContext.pushContainingComponent(compositeDef);

	NodeList childNodes = element.getChildNodes();
	for (int i = 0; i < childNodes.getLength(); i++) {
		Node child = childNodes.item(i);
		if (child.getNodeType() == Node.ELEMENT_NODE) {
			String localName = parserContext.getDelegate().getLocalName(child);
			if (LISTENER_ELEMENT.equals(localName)) {
				parseListener((Element) child, element, parserContext);
			}
		}
	}

	parserContext.popAndRegisterContainingComponent();
	return null;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:20,代码来源:AbstractListenerContainerParser.java

示例13: parse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
@Override
public BeanDefinition parse( Element element, ParserContext parserContext ) {
    AopNamespaceUtils.registerAutoProxyCreatorIfNecessary( parserContext, element );
    if( !parserContext.getRegistry().containsBeanDefinition( BEAN_NAME ) ) {
        Object eleSource = parserContext.extractSource( element );

        RootBeanDefinition stageCreator = new RootBeanDefinition( SpringStageCreator.class );
        stageCreator.setSource( eleSource );
        stageCreator.setRole( BeanDefinition.ROLE_INFRASTRUCTURE );
        String executorName = parserContext.getReaderContext().registerWithGeneratedName( stageCreator );
        logger.debug( "Registered SpringStageCreator with name " + executorName );

        RootBeanDefinition beanFactoryPostProcessor = new RootBeanDefinition( JGivenBeanFactoryPostProcessor.class );
        beanFactoryPostProcessor.setRole( BeanDefinition.ROLE_INFRASTRUCTURE );
        parserContext.getRegistry().registerBeanDefinition( BEAN_NAME, beanFactoryPostProcessor );

        CompositeComponentDefinition componentDefinition = new CompositeComponentDefinition( element.getTagName(), eleSource );
        componentDefinition.addNestedComponent( new BeanComponentDefinition( stageCreator, executorName ) );
        componentDefinition.addNestedComponent( new BeanComponentDefinition( beanFactoryPostProcessor, BEAN_NAME ) );
        parserContext.registerComponent( componentDefinition );
    }
    return null;
}
 
开发者ID:TNG,项目名称:JGiven,代码行数:24,代码来源:AnnotationDrivenBeanDefinitionParser.java

示例14: registerBeans

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
/**
 * Register the given beans to the parser context
 * 
 * @param element
 *            the import XML DOM element
 * @param parserContext
 *            the parser context
 * @param beanDefinitions
 *            the loaded bean definitions
 */
protected void registerBeans(Element element, ParserContext parserContext,
        Map<String, Tuple<BeanDefinition, Boolean>> beanDefinitions) {
    CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
            parserContext.extractSource(element));
    parserContext.pushContainingComponent(compositeDef);

    BeanDefinitionRegistry registry = parserContext.getRegistry();
    for (Map.Entry<String, Tuple<BeanDefinition, Boolean>> entry : beanDefinitions.entrySet()) {
        String beanName = entry.getKey();
        BeanDefinition bean = entry.getValue().getKey();
        if (!registry.containsBeanDefinition(beanName)) {
            registry.registerBeanDefinition(beanName, bean);
            parserContext.registerComponent(new BeanComponentDefinition(bean, beanName));
        }
    }

    parserContext.popAndRegisterContainingComponent();
}
 
开发者ID:MarkusBernhardt,项目名称:spring-context-template,代码行数:29,代码来源:ImportBeanDefinitionParser.java

示例15: parse

import org.springframework.beans.factory.parsing.CompositeComponentDefinition; //导入依赖的package包/类
/**
	 * {@inheritDoc}
	 */
	public BeanDefinition parse(Element element, ParserContext parserContext) {
	
		Object source = parserContext.extractSource(element);
		CompositeComponentDefinition ccd = new CompositeComponentDefinition("jdal-swing", source);
		
		ccd.addNestedComponent(registerPropertyEditors(element, parserContext));
		ccd.addNestedComponent(registerAccessorFactory(element, parserContext));
		ccd.addNestedComponent(registerBinderFactory(element, parserContext));
		ccd.addNestedComponent(registerPaginatorView(element, parserContext));
		ccd.addNestedComponent(registerDefaultTableActions(element, parserContext));
		ccd.addNestedComponent(registerDefaultGuiFactory(element, parserContext));
		ccd.addNestedComponent(registerCollectionTableCellRenderer(element, parserContext));
//		ccd.addNestedComponent(registerControlInitializer(element, parserContext));
		
		parserContext.getReaderContext().fireComponentRegistered(ccd);
		
		return null;
	}
 
开发者ID:chelu,项目名称:jdal,代码行数:22,代码来源:DefaultsBeanDefinitionParser.java


注:本文中的org.springframework.beans.factory.parsing.CompositeComponentDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。