public Iterable<Element> getModules(final InstallationMode installationMode) { return elements(getPluginElement()).stream() .filter(element -> { String name = element.getName(); return !(PLUGIN_INFO.equalsIgnoreCase(name) || RESOURCE.equalsIgnoreCase(name)); }) .filter(module -> { if (!PluginUtils.doesModuleElementApplyToApplication(module, applications, installationMode)) { log.debug("Ignoring module descriptor for this application: {}", module.attributeValue("key")); return false; } return true; }) .collect(Collectors.toList()); }
public void execute(TransformContext context) throws PluginTransformationException { if (SpringHelper.shouldGenerateFile(context, SPRING_XML)) { Document springDoc = SpringHelper.createSpringDocument(); Element root = springDoc.getRootElement(); ServiceReference[] serviceReferences = context.getOsgiContainerManager().getRegisteredServices(); for (ComponentImport comp : context.getComponentImports().values()) { if (!PluginUtils.doesModuleElementApplyToApplication(comp.getSource(), context.getApplications(), context.getInstallationMode())) { continue; } Element osgiReference = root.addElement("osgi:reference"); // make sure the new bean id is not already in use. context.trackBean(comp.getKey(), BEAN_SOURCE); osgiReference.addAttribute("id", comp.getKey()); if (comp.getFilter() != null) { osgiReference.addAttribute("filter", comp.getFilter()); } Element interfaces = osgiReference.addElement("osgi:interfaces"); for (String infName : comp.getInterfaces()) { validateInterface(infName, context.getPluginFile().getName(), serviceReferences); context.getExtraImports().add(infName.substring(0, infName.lastIndexOf('.'))); Element e = interfaces.addElement("beans:value"); e.setText(infName); } } if (root.elements().size() > 0) { context.setShouldRequireSpring(true); context.getFileOverrides().put(SPRING_XML, SpringHelper.documentToBytes(springDoc)); } } }
if (!PluginUtils.doesModuleElementApplyToApplication(component, context.getApplications(), context.getInstallationMode())) { continue;
if (PluginUtils.doesModuleElementApplyToApplication(compImport.getSource(), context.getApplications(), context.getInstallationMode()) && regInterfaces.containsAll(compImport.getInterfaces())) { found = false; break;
if (!PluginUtils.doesModuleElementApplyToApplication(e, context.getApplications(), context.getInstallationMode())) { continue;