本文整理汇总了Java中org.apache.aries.blueprint.ComponentDefinitionRegistry类的典型用法代码示例。如果您正苦于以下问题:Java ComponentDefinitionRegistry类的具体用法?Java ComponentDefinitionRegistry怎么用?Java ComponentDefinitionRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentDefinitionRegistry类属于org.apache.aries.blueprint包,在下文中一共展示了ComponentDefinitionRegistry类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: process
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
@Override
public void process(ComponentDefinitionRegistry cdr) {
BlueprintContainer container = getComponent(cdr, "blueprintContainer");
Bundle bundle = getComponent(cdr, "blueprintBundle");
cdr.registerComponentDefinition(createServiceRef(JPA_COORDINATOR, Coordinator.class));
Set<String> components = new HashSet<String>(cdr.getComponentDefinitionNames());
for (String component : components) {
ComponentMetadata compDef = cdr.getComponentDefinition(component);
if (compDef instanceof MutableBeanMetadata && !((MutableBeanMetadata)compDef).isProcessor()) {
// Normal bean def
handleComponent((MutableBeanMetadata)compDef, bundle, cdr, container);
} else if(compDef instanceof MutableServiceMetadata) {
// Bean inlined into service def
MutableServiceMetadata sMeta = (MutableServiceMetadata)compDef;
Target target = sMeta.getServiceComponent();
if (target instanceof MutableBeanMetadata) {
handleComponent((MutableBeanMetadata)target, bundle, cdr, container);
}
}
}
}
开发者ID:apache,项目名称:aries-jpa,代码行数:24,代码来源:JpaComponentProcessor.java
示例2: registerComponentProcessor
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private static MutableBeanMetadata registerComponentProcessor(final ParserContext context) {
ComponentDefinitionRegistry registry = context.getComponentDefinitionRegistry();
MutableBeanMetadata metadata = (MutableBeanMetadata) registry.getComponentDefinition(COMPONENT_PROCESSOR_NAME);
if (metadata == null) {
metadata = createBeanMetadata(context, COMPONENT_PROCESSOR_NAME, ComponentProcessor.class, false, true);
metadata.setProcessor(true);
addBlueprintBundleRefProperty(context, metadata);
metadata.addProperty("blueprintContainerRestartService", createServiceRef(context,
BlueprintContainerRestartService.class, null));
LOG.debug("Registering ComponentProcessor bean: {}", metadata);
registry.registerComponentDefinition(metadata);
}
return metadata;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:18,代码来源:OpendaylightNamespaceHandler.java
示例3: getServiceRef
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private MutableRefMetadata getServiceRef(ComponentDefinitionRegistry cdr, String unitName, Class<?> iface) {
ComponentMetadata serviceRef = cdr.getComponentDefinition(getId(unitName, iface));
if (serviceRef == null) {
serviceRef = createJPAServiceRef(unitName, iface);
cdr.registerComponentDefinition(serviceRef);
}
MutableRefMetadata ref = pc.createMetadata(MutableRefMetadata.class);
ref.setComponentId(serviceRef.getId());
return ref;
}
开发者ID:apache,项目名称:aries-jpa,代码行数:11,代码来源:JpaComponentProcessor.java
示例4: parseElement
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private void parseElement(Element elt, ParserContext pc) {
ComponentDefinitionRegistry cdr = pc.getComponentDefinitionRegistry();
if ("enable".equals(elt.getLocalName()) &&
!cdr.containsComponentDefinition(JpaComponentProcessor.class.getSimpleName())) {
MutableBeanMetadata meta = pc.createMetadata(MutableBeanMetadata.class);
meta.setId(JpaComponentProcessor.class.getSimpleName());
meta.setRuntimeClass(JpaComponentProcessor.class);
meta.setProcessor(true);
meta.addProperty("pc", passThrough(pc, pc));
cdr.registerComponentDefinition(meta);
}
}
开发者ID:apache,项目名称:aries-jpa,代码行数:14,代码来源:JpaNsHandler.java
示例5: registerRoutedRpcRegistrationConverter
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private static void registerRoutedRpcRegistrationConverter(final ParserContext context) {
ComponentDefinitionRegistry registry = context.getComponentDefinitionRegistry();
if (registry.getComponentDefinition(ROUTED_RPC_REG_CONVERTER_NAME) == null) {
MutableBeanMetadata metadata = createBeanMetadata(context, ROUTED_RPC_REG_CONVERTER_NAME,
RoutedRpcRegistrationConverter.class, false, false);
metadata.setActivation(ReferenceMetadata.ACTIVATION_LAZY);
registry.registerTypeConverter(metadata);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:OpendaylightNamespaceHandler.java
示例6: registerRefBean
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private static void registerRefBean(final ParserContext context, final String name, final Class<?> clazz) {
ComponentDefinitionRegistry registry = context.getComponentDefinitionRegistry();
if (registry.getComponentDefinition(name) == null) {
MutableReferenceMetadata metadata = createServiceRef(context, clazz, null);
metadata.setId(name);
registry.registerComponentDefinition(metadata);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:OpendaylightNamespaceHandler.java
示例7: registerNotificationServiceRefBean
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private static void registerNotificationServiceRefBean(final ParserContext context) {
ComponentDefinitionRegistry registry = context.getComponentDefinitionRegistry();
if (registry.getComponentDefinition(NOTIFICATION_SERVICE_NAME) == null) {
MutableReferenceMetadata metadata = createServiceRef(context, NotificationService.class, null);
metadata.setId(NOTIFICATION_SERVICE_NAME);
registry.registerComponentDefinition(metadata);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:OpendaylightNamespaceHandler.java
示例8: process
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
@Override
public void process(final ComponentDefinitionRegistry registry) {
LOG.debug("{}: In process", logName());
for (String name : registry.getComponentDefinitionNames()) {
ComponentMetadata component = registry.getComponentDefinition(name);
if (component instanceof MutableBeanMetadata) {
processMutableBeanMetadata((MutableBeanMetadata) component);
} else if (component instanceof MutableServiceReferenceMetadata) {
processServiceReferenceMetadata((MutableServiceReferenceMetadata)component);
}
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:14,代码来源:ComponentProcessor.java
示例9: parseElement
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private void parseElement( Element elt, ParserContext pc )
{
ComponentDefinitionRegistry cdr = pc.getComponentDefinitionRegistry();
if ( "enable".equals( elt.getLocalName() ) && !cdr
.containsComponentDefinition( AuthorizationBeanProcessor.AUTH_PROCESSOR_BEAN_NAME ) )
{
cdr.registerComponentDefinition( authBeanProcessor( pc, cdr ) );
}
}
开发者ID:subutai-io,项目名称:base,代码行数:11,代码来源:AuthorizationNsHandler.java
示例10: authBeanProcessor
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private MutableBeanMetadata authBeanProcessor( ParserContext pc, ComponentDefinitionRegistry cdr )
{
MutableBeanMetadata meta = pc.createMetadata( MutableBeanMetadata.class );
meta.setId( AuthorizationBeanProcessor.AUTH_PROCESSOR_BEAN_NAME );
meta.setRuntimeClass( AuthorizationBeanProcessor.class );
meta.setProcessor( true );
meta.addProperty( "cdr", passThrough( pc, cdr ) );
return meta;
}
开发者ID:subutai-io,项目名称:base,代码行数:10,代码来源:AuthorizationNsHandler.java
示例11: getDataformatResolverReference
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private static ComponentMetadata getDataformatResolverReference(ParserContext context, String dataformat) {
// we cannot resolve dataformat names using property placeholders at this point in time
if (dataformat.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
return null;
}
ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry();
ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.dataformatResolver." + dataformat);
if (cm == null) {
MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class);
svc.setId(".camelBlueprint.dataformatResolver." + dataformat);
svc.setFilter("(dataformat=" + dataformat + ")");
svc.setAvailability(componentDefinitionRegistry.containsComponentDefinition(dataformat) ? AVAILABILITY_OPTIONAL : AVAILABILITY_MANDATORY);
try {
// Try to set the runtime interface (only with aries blueprint > 0.1
svc.getClass().getMethod("setRuntimeInterface", Class.class).invoke(svc, DataFormatResolver.class);
} catch (Throwable t) {
// Check if the bundle can see the class
try {
PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle");
Bundle b = (Bundle) ptm.getObject();
if (b.loadClass(DataFormatResolver.class.getName()) != DataFormatResolver.class) {
throw new UnsupportedOperationException();
}
svc.setInterface(DataFormatResolver.class.getName());
} catch (Throwable t2) {
throw new UnsupportedOperationException();
}
}
componentDefinitionRegistry.registerComponentDefinition(svc);
cm = svc;
}
return cm;
}
开发者ID:HydAu,项目名称:Camel,代码行数:34,代码来源:CamelNamespaceHandler.java
示例12: getLanguageResolverReference
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private static ComponentMetadata getLanguageResolverReference(ParserContext context, String language) {
// we cannot resolve language names using property placeholders at this point in time
if (language.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
return null;
}
ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry();
ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.languageResolver." + language);
if (cm == null) {
MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class);
svc.setId(".camelBlueprint.languageResolver." + language);
svc.setFilter("(language=" + language + ")");
svc.setAvailability(componentDefinitionRegistry.containsComponentDefinition(language) ? AVAILABILITY_OPTIONAL : AVAILABILITY_MANDATORY);
try {
// Try to set the runtime interface (only with aries blueprint > 0.1
svc.getClass().getMethod("setRuntimeInterface", Class.class).invoke(svc, LanguageResolver.class);
} catch (Throwable t) {
// Check if the bundle can see the class
try {
PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle");
Bundle b = (Bundle) ptm.getObject();
if (b.loadClass(LanguageResolver.class.getName()) != LanguageResolver.class) {
throw new UnsupportedOperationException();
}
svc.setInterface(LanguageResolver.class.getName());
} catch (Throwable t2) {
throw new UnsupportedOperationException();
}
}
componentDefinitionRegistry.registerComponentDefinition(svc);
cm = svc;
}
return cm;
}
开发者ID:HydAu,项目名称:Camel,代码行数:34,代码来源:CamelNamespaceHandler.java
示例13: getComponentResolverReference
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
private static ComponentMetadata getComponentResolverReference(ParserContext context, String component) {
// we cannot resolve component names using property placeholders at this point in time
if (component.startsWith(PropertiesComponent.DEFAULT_PREFIX_TOKEN)) {
return null;
}
ComponentDefinitionRegistry componentDefinitionRegistry = context.getComponentDefinitionRegistry();
ComponentMetadata cm = componentDefinitionRegistry.getComponentDefinition(".camelBlueprint.componentResolver." + component);
if (cm == null) {
MutableReferenceMetadata svc = context.createMetadata(MutableReferenceMetadata.class);
svc.setId(".camelBlueprint.componentResolver." + component);
svc.setFilter("(component=" + component + ")");
svc.setAvailability(componentDefinitionRegistry.containsComponentDefinition(component) ? AVAILABILITY_OPTIONAL : AVAILABILITY_MANDATORY);
try {
// Try to set the runtime interface (only with aries blueprint > 0.1
svc.getClass().getMethod("setRuntimeInterface", Class.class).invoke(svc, ComponentResolver.class);
} catch (Throwable t) {
// Check if the bundle can see the class
try {
PassThroughMetadata ptm = (PassThroughMetadata) componentDefinitionRegistry.getComponentDefinition("blueprintBundle");
Bundle b = (Bundle) ptm.getObject();
if (b.loadClass(ComponentResolver.class.getName()) != ComponentResolver.class) {
throw new UnsupportedOperationException();
}
svc.setInterface(ComponentResolver.class.getName());
} catch (Throwable t2) {
throw new UnsupportedOperationException();
}
}
componentDefinitionRegistry.registerComponentDefinition(svc);
cm = svc;
}
return cm;
}
开发者ID:HydAu,项目名称:Camel,代码行数:34,代码来源:CamelNamespaceHandler.java
示例14: decorate
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
@Override
public ComponentMetadata decorate(Node node, ComponentMetadata componentMetadata, ParserContext parserContext)
{
if (node instanceof Element) {
String comment = ((Element) node).getAttribute("text");
if (componentMetadata instanceof BeanMetadata)
{
ComponentDefinitionRegistry cdr = parserContext.getComponentDefinitionRegistry();
cdr.registerInterceptorWithComponent(componentMetadata, new TestInterceptor(comment));
}
}
return componentMetadata;
}
开发者ID:WASdev,项目名称:sample.osgi.blueprint-cm,代码行数:14,代码来源:Handler.java
示例15: getComponent
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T>T getComponent(ComponentDefinitionRegistry cdr, String id) {
return (T)((PassThroughMetadata) cdr.getComponentDefinition(id)).getObject();
}
开发者ID:apache,项目名称:aries-jpa,代码行数:5,代码来源:JpaComponentProcessor.java
示例16: setCdr
import org.apache.aries.blueprint.ComponentDefinitionRegistry; //导入依赖的package包/类
public void setCdr( ComponentDefinitionRegistry cdr )
{
this.cdr = cdr;
}
开发者ID:subutai-io,项目名称:base,代码行数:5,代码来源:AuthorizationBeanProcessor.java
注:本文中的org.apache.aries.blueprint.ComponentDefinitionRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论