本文整理汇总了Java中org.apache.aries.blueprint.ComponentDefinitionRegistry.getComponentDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java ComponentDefinitionRegistry.getComponentDefinition方法的具体用法?Java ComponentDefinitionRegistry.getComponentDefinition怎么用?Java ComponentDefinitionRegistry.getComponentDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.aries.blueprint.ComponentDefinitionRegistry
的用法示例。
在下文中一共展示了ComponentDefinitionRegistry.getComponentDefinition方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
示例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;
}
示例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;
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: 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);
}
}
示例7: 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);
}
}
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}