/** * Adds a resource reference defined by the implementation keyed by name. * * @param definition the resource reference to add */ public void add(ResourceReference definition) { definition.setParent(this); resourceReferences.put(definition.getName(), 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); }
/** * Add a resource reference and its associated an injection site. * * @param definition the resource reference to add * @param injectionSite the injection site for the resource */ public void add(ResourceReference definition, InjectionSite injectionSite) { super.add(definition); Injectable injectable = new Injectable(InjectableType.RESOURCE, definition.getName()); addInjectionSite(injectionSite, injectable); injectionSiteMapping.put(definition, injectionSite); }
private void createResourceReferences(LogicalComponent<?> logicalComponent, ComponentType componentType) { for (ResourceReference reference : componentType.getResourceReferences().values()) { URI resourceUri = logicalComponent.getUri().resolve('#' + reference.getName()); LogicalResourceReference<ResourceReference> logicalReference = new LogicalResourceReference<>(resourceUri, reference, logicalComponent); logicalComponent.addResource(logicalReference); } }
private void createResourceReferences(LogicalComponent<?> logicalComponent, ComponentType componentType) { for (ResourceReference reference : componentType.getResourceReferences().values()) { URI resourceUri = logicalComponent.getUri().resolve('#' + reference.getName()); LogicalResourceReference<ResourceReference> logicalReference = new LogicalResourceReference<>(resourceUri, reference, logicalComponent); logicalComponent.addResource(logicalReference); } }