private <B> Supplier<B> createWireFactory(Class<B> interfaze, Wire wire) throws Fabric3Exception { return proxyService.createSupplier(interfaze, wire, null); }
protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, Wire wire) throws ObjectCreationException { try { return proxyService.createObjectFactory(interfaze, wire, null); } catch (ProxyCreationException e) { throw new ObjectCreationException(e); } }
@SuppressWarnings({"unchecked"}) public <B, R extends ServiceReference<B>> R cast(B target) { return (R) proxyService.cast(target); }
private void processCallback(Wire wire, PhysicalWireTarget targetDefinition, JavaComponent source, Injectable injectable, Class<?> type) { URI callbackUri = targetDefinition.getUri(); ScopeContainer container = source.getScopeContainer(); Supplier<?> supplier = source.getSupplier(injectable); boolean multiThreaded = Scope.COMPOSITE.equals(container.getScope()); if (supplier == null) { supplier = proxyService.createCallbackSupplier(type, multiThreaded, callbackUri, wire); } else { supplier = proxyService.updateCallbackSupplier(supplier, type, multiThreaded, callbackUri, wire); } source.setSupplier(injectable, supplier); }
public void attach(NonManagedWireSource source, PhysicalWireTarget target, Wire wire) { Class<?> interfaze = source.getInterface(); Object proxy = proxyService.createSupplier(interfaze, wire, null).get(); source.setProxy(proxy); }
public void attach(NonManagedPhysicalWireSourceDefinition source, PhysicalWireTargetDefinition target, Wire wire) throws ContainerException { try { ClassLoader loader = registry.getClassLoader(source.getClassLoaderId()); Class<?> interfaze = loader.loadClass(source.getInterface()); Object proxy = proxyService.createObjectFactory(interfaze, wire, null).getInstance(); source.setProxy(proxy); } catch (ClassNotFoundException e) { throw new ContainerException(e); } }
public void attach(NonManagedWireSource source, PhysicalWireTarget target, Wire wire) { Class<?> interfaze = source.getInterface(); Object proxy = proxyService.createSupplier(interfaze, wire, null).get(); source.setProxy(proxy); }
public void attach(SpringSourceDefinition source, PhysicalTargetDefinition target, Wire wire) throws WiringException { SpringComponent component = getComponent(source); String referenceName = source.getReferenceName(); ClassLoader loader = classLoaderRegistry.getClassLoader(source.getClassLoaderId()); Class<?> interfaze; try { interfaze = loader.loadClass(source.getInterface()); // note callbacks not supported for spring beans ObjectFactory<?> factory = proxyService.createObjectFactory(interfaze, wire, null); component.attach(referenceName, interfaze, factory); for (WireListener listener : listeners) { listener.onAttach(wire); } } catch (ClassNotFoundException e) { throw new WiringException(e); } catch (ProxyCreationException e) { throw new WiringException(e); } }
public void attach(SpringWireSource source, PhysicalWireTarget target, Wire wire) { SpringComponent component = getComponent(source); String referenceName = source.getReferenceName(); ClassLoader loader = source.getClassLoader(); Class<?> interfaze; try { interfaze = loader.loadClass(source.getInterface()); // note callbacks not supported for spring beans Supplier<?> supplier = proxyService.createSupplier(interfaze, wire, null); component.attach(referenceName, interfaze, supplier); for (WireListener listener : listeners) { listener.onAttach(wire); } } catch (ClassNotFoundException e) { throw new Fabric3Exception(e); } }
public void attach(SpringWireSource source, PhysicalWireTarget target, Wire wire) { SpringComponent component = getComponent(source); String referenceName = source.getReferenceName(); ClassLoader loader = source.getClassLoader(); Class<?> interfaze; try { interfaze = loader.loadClass(source.getInterface()); // note callbacks not supported for spring beans Supplier<?> supplier = proxyService.createSupplier(interfaze, wire, null); component.attach(referenceName, interfaze, supplier); for (WireListener listener : listeners) { listener.onAttach(wire); } } catch (ClassNotFoundException e) { throw new Fabric3Exception(e); } }
private void processReference(Wire wire, JavaWireSource source, PhysicalWireTarget target, JavaComponent component, Injectable injectable, Class<?> type) { String callbackUri = null; URI uri = target.getCallbackUri(); if (uri != null) { callbackUri = uri.toString(); } Supplier<?> supplier = proxyService.createSupplier(type, wire, callbackUri); if (source.isKeyed() || source.isOrdered()) { Object key = getKey(source, target); int order = source.getOrder(); InjectionAttributes attributes = new InjectionAttributes(key, order); component.setSupplier(injectable, supplier, attributes); } else { component.setSupplier(injectable, supplier); } }
public void attach(SystemWireSource source, PhysicalWireTarget target, Wire wire) { if (proxyService == null) { throw new Fabric3Exception("Attempt to inject a non-optimized wire during runtime bootstrap."); } URI sourceName = UriHelper.getDefragmentedName(source.getUri()); SystemComponent component = (SystemComponent) manager.getComponent(sourceName); Injectable injectable = source.getInjectable(); Class<?> type = source.getInterfaceClass(); if (InjectableType.CALLBACK.equals(injectable.getType())) { throw new UnsupportedOperationException("Callbacks are not supported on system components"); } else { String callbackUri = null; URI uri = target.getCallbackUri(); if (uri != null) { callbackUri = uri.toString(); } Supplier<?> factory = proxyService.createSupplier(type, wire, callbackUri); if (source.isKeyed() || source.isOrdered()) { Object key = getKey(source, target); int order = source.getOrder(); InjectionAttributes attributes = new InjectionAttributes(key, order); component.setSupplier(injectable, factory, attributes); } else { component.setSupplier(injectable, factory); } } }