public void detach(SystemConnectionSource source, PhysicalConnectionTarget target) throws Fabric3Exception { URI sourceName = UriHelper.getDefragmentedName(source.getUri()); SystemComponent component = (SystemComponent) manager.getComponent(sourceName); Injectable injectable = source.getInjectable(); component.removeSupplier(injectable); }
public void attach( SystemConnectionSource source, PhysicalConnectionTarget target, ChannelConnection connection) { URI sourceUri = source.getUri(); URI sourceName = UriHelper.getDefragmentedName(sourceUri); SystemComponent component = (SystemComponent) manager.getComponent(sourceName); Injectable injectable = source.getInjectable(); Class<?> type = source.getServiceInterface(); Supplier<?> supplier; if (source.isDirectConnection()) { supplier = connection.getDirectConnection().get(); } else { supplier = proxyService.createSupplier(type, connection); } component.setSupplier(injectable, supplier); }
public void attach(PhysicalWireSource source, SystemWireTarget target, Wire wire) throws Fabric3Exception { URI targetId = UriHelper.getDefragmentedName(target.getUri()); SystemComponent targetComponent = (SystemComponent) manager.getComponent(targetId); Class<?> implementationClass = targetComponent.getImplementationClass(); for (InvocationChain chain : wire.getInvocationChains()) { PhysicalOperation operation = chain.getPhysicalOperation(); List<Class<?>> params = operation.getSourceParameterTypes(); Method method; try { method = implementationClass.getMethod( operation.getName(), params.toArray(new Class[params.size()])); } catch (NoSuchMethodException e) { throw new Fabric3Exception("No matching method found", e); } SystemInvokerInterceptor interceptor = new SystemInvokerInterceptor(method, targetComponent); chain.addInterceptor(interceptor); } }
public Supplier<?> createSupplier(SystemWireTarget target) throws Fabric3Exception { URI targetId = UriHelper.getDefragmentedName(target.getUri()); SystemComponent targetComponent = (SystemComponent) manager.getComponent(targetId); return targetComponent.createSupplier(); }