/** * Constructor. * * @param uri URI of the resource. * @param definition the resource reference definition. * @param parent the parent component */ public LogicalResourceReference(URI uri, RD definition, LogicalComponent<?> parent) { super(uri, definition != null ? definition.getServiceContract() : null, parent); this.definition = definition; }
private void generateResourceInjectionMapping(ResourceReference definition, WebComponentType type, Map<String, Map<String, InjectionSite>> mappings) { Map<String, InjectionSite> mapping = mappings.get(definition.getName()); if (mapping == null) { mapping = new HashMap<>(); mappings.put(definition.getName(), mapping); } for (Map.Entry<String, Map<InjectionSite, Injectable>> entry : type.getInjectionSites().entrySet()) { for (Map.Entry<InjectionSite, Injectable> siteMap : entry.getValue().entrySet()) { if (siteMap.getValue().getName().equals(definition.getName())) { mapping.put(entry.getKey(), siteMap.getKey()); } } } ServiceContract contract = definition.getServiceContract(); Class<?> interfaceClass = contract.getInterfaceClass(); // also inject the reference into the servlet context WebContextInjectionSite servletContextSite = new WebContextInjectionSite(interfaceClass, SERVLET_CONTEXT); mapping.put(SERVLET_CONTEXT_SITE, servletContextSite); }
public void generateResourceWireSource(JavaWireSource source, LogicalResourceReference<?> resourceReference) { URI uri = resourceReference.getUri(); JavaServiceContract serviceContract = (JavaServiceContract) resourceReference.getDefinition().getServiceContract(); source.setUri(uri); source.setInjectable(new Injectable(InjectableType.RESOURCE, uri.getFragment())); source.setInterfaceClass(serviceContract.getInterfaceClass()); }
ResourceReference definition = componentType.getResourceReferences().get(name); if (definition != null) { ServiceContract source = definition.getServiceContract(); ServiceContract target = entry.getValue().getServiceContract(); MatchResult result = matcher.isAssignableFrom(source, target, false); if (!result.isAssignable()) {