use of org.apache.aries.blueprint.ComponentDefinitionRegistry in project aries by apache.
the class ParserServiceImportXSDsBetweenNamespaceHandlersTest method testXSDImports.
@Test
public void testXSDImports() throws Exception {
waitForConfig();
ParserService parserService = context().getService(ParserService.class);
URL blueprintXML = context().getBundleByName(TEST_BUNDLE).getEntry("OSGI-INF/blueprint/ImportNamespacesTest.xml");
ComponentDefinitionRegistry cdr = parserService.parse(blueprintXML, context().getBundleByName(TEST_BUNDLE));
assertNotNull(cdr.getComponentDefinition("aries-1503"));
}
use of org.apache.aries.blueprint.ComponentDefinitionRegistry in project aries by apache.
the class AnnotationEnablingNameSpaceHandlerTest method testAnnotationDisabled.
@Test
public void testAnnotationDisabled() throws Exception {
ComponentDefinitionRegistry cdr = parseCDR("enable-annotations2.xml");
checkCompTop(cdr);
BeanMetadata pmd = (BeanMetadata) cdr.getComponentDefinition(TxNamespaceHandler.ANNOTATION_PARSER_BEAN_NAME);
assertNull(pmd);
}
use of org.apache.aries.blueprint.ComponentDefinitionRegistry in project aries by apache.
the class BaseNameSpaceHandlerSetup method parseCDR.
protected ComponentDefinitionRegistry parseCDR(String name) throws Exception {
Parser p = new Parser();
URL bpxml = this.getClass().getResource(name);
p.parse(Arrays.asList(bpxml));
Set<URI> nsuris = p.getNamespaces();
NamespaceHandlerSet nshandlers = nhri.getNamespaceHandlers(nsuris, b);
ComponentDefinitionRegistry cdr = new ComponentDefinitionRegistryImpl();
cdr.registerComponentDefinition(new PassThroughMetadataImpl("blueprintBundle", b));
p.populate(nshandlers, cdr);
return cdr;
}
use of org.apache.aries.blueprint.ComponentDefinitionRegistry in project aries by apache.
the class TxNamespaceHandler method createAnnotationParserBean.
private MutableBeanMetadata createAnnotationParserBean(ParserContext pc, ComponentDefinitionRegistry cdr) {
MutableBeanMetadata meta = pc.createMetadata(MutableBeanMetadata.class);
meta.setId(ANNOTATION_PARSER_BEAN_NAME);
meta.setRuntimeClass(AnnotationProcessor.class);
meta.setProcessor(true);
meta.addArgument(passThrough(pc, cdr), ComponentDefinitionRegistry.class.getName(), 0);
meta.addArgument(passThrough(pc, tm), TransactionManager.class.getName(), 1);
meta.addArgument(passThrough(pc, coordinator), Coordinator.class.getName(), 1);
return meta;
}
use of org.apache.aries.blueprint.ComponentDefinitionRegistry in project aries by apache.
the class ParserServiceImpl method validateAndPopulate.
private ComponentDefinitionRegistry validateAndPopulate(Parser parser, Bundle clientBundle, boolean validate) throws IOException, SAXException {
Set<URI> nsuris = parser.getNamespaces();
ComponentDefinitionRegistry cdr;
NamespaceHandlerSet nshandlers = _namespaceHandlerRegistry.getNamespaceHandlers(nsuris, clientBundle);
try {
if (validate) {
parser.validate(nshandlers.getSchema());
}
cdr = new ComponentDefinitionRegistryImpl();
parser.populate(nshandlers, cdr);
} finally {
nshandlers.destroy();
}
return cdr;
}
Aggregations