use of org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl 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.parser.ComponentDefinitionRegistryImpl 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;
}
use of org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl in project aries by apache.
the class AbstractBlueprintTest method parse.
protected ComponentDefinitionRegistryImpl parse(String name, NamespaceHandlerSet handlers) throws Exception {
ComponentDefinitionRegistryImpl registry = new ComponentDefinitionRegistryImpl();
Parser parser = new Parser();
parser.parse(Collections.singletonList(getClass().getResource(name)));
parser.populate(handlers, registry);
return registry;
}
use of org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl in project aries by apache.
the class ExtPlaceholderTest method testStaticValues.
@Test
public void testStaticValues() throws Exception {
ComponentDefinitionRegistryImpl registry = parse("/test-staticvalues.xml");
Repository repository = new TestBlueprintContainer(registry).getRepository();
Object obj1 = repository.create("beanD");
assertNotNull(obj1);
assertTrue(obj1 instanceof BeanD);
BeanD beanD = (BeanD) obj1;
assertEquals(ExtNamespaceHandler.BLUEPRINT_EXT_NAMESPACE_V1_5, beanD.getName());
}
use of org.apache.aries.blueprint.parser.ComponentDefinitionRegistryImpl in project aries by apache.
the class ReferencesTest method testWiring.
public void testWiring() throws Exception {
ComponentDefinitionRegistryImpl registry = parse("/test-references.xml");
ProxyManager proxyManager = new AbstractProxyManager() {
@Override
protected Object createNewProxy(Bundle bundle, Collection<Class<?>> classes, Callable<Object> objectCallable, InvocationListener invocationListener) throws UnableToProxyException {
return new Object();
}
@Override
protected InvocationHandler getInvocationHandler(Object o) {
return null;
}
@Override
protected boolean isProxyClass(Class<?> aClass) {
return false;
}
};
Repository repository = new TestBlueprintContainer(registry, proxyManager).getRepository();
repository.create("refItf");
try {
repository.create("refClsErr");
fail("Should have failed");
} catch (ComponentDefinitionException e) {
}
repository.create("refClsOk");
}
Aggregations