@Test void withDataSetDataStore() { final Map<String, String> files = generator .create("com.foo", build, "superfamily", "supercategory", singleton(new ProjectRequest.SourceConfiguration("mycomp", "", false, new ProjectRequest.DataStructure(new ArrayList<>(asList( new ProjectRequest.Entry("identifier", "string", null, null), new ProjectRequest.Entry("theDataSet", "com.foo.dataset.MyDataSet", "1234-4567-7890", null)))), new ProjectRequest.StructureConfiguration( new ProjectRequest.DataStructure(new ArrayList<>()), false))), emptyList(), asList( new ProjectRequest.ReusableConfiguration("1234-4567-7890", "com.foo.dataset.MyDataSet", new ProjectRequest.DataStructure( new ArrayList<>(singleton(new ProjectRequest.Entry("theDatastore", "com.foo.datastore.MyDataStore", "2234-4567-7890", null)))), "dataset"), new ProjectRequest.ReusableConfiguration("2234-4567-7890", "com.foo.datastore.MyDataStore", new ProjectRequest.DataStructure( new ArrayList<>(singleton(new ProjectRequest.Entry("person", "", null, new ProjectRequest.DataStructure(new ArrayList<>(asList( new ProjectRequest.Entry("name", "string", null, null), new ProjectRequest.Entry("age", "int", null, null)))))))), "datastore"))) .collect(toMap(FacetGenerator.InMemoryFile::getPath, i -> new String(i.getContent(), StandardCharsets.UTF_8))); assertEquals(resourceFileToString("generated/ComponentGeneratorTest/withDataSetDataStore/Messages.properties") .trim(), files.get("src/main/resources/com/foo/Messages.properties").trim()); assertEquals( resourceFileToString("generated/ComponentGeneratorTest/withDataSetDataStore/MyDataStore.java").trim(), files.get("src/main/java/com/foo/datastore/MyDataStore.java").trim()); assertEquals( resourceFileToString( "generated/ComponentGeneratorTest/withDataSetDataStore/MyDataStorePersonConfiguration.java") .trim(), files.get("src/main/java/com/foo/datastore/MyDataStorePersonConfiguration.java").trim()); assertEquals( resourceFileToString("generated/ComponentGeneratorTest/withDataSetDataStore/MyDataSet.java").trim(), files.get("src/main/java/com/foo/dataset/MyDataSet.java").trim()); assertEquals( resourceFileToString( "generated/ComponentGeneratorTest/withDataSetDataStore/MycompMapperConfiguration.java").trim(), files.get("src/main/java/com/foo/source/MycompMapperConfiguration.java").trim()); }
public Stream<FacetGenerator.InMemoryFile> create(final String tuple, final Build build, final String family, final String category, final Collection<ProjectRequest.SourceConfiguration> sources, final Collection<ProjectRequest.ProcessorConfiguration> processors, final Collection<ProjectRequest.ReusableConfiguration> configurations) { final String mainJava = build.getMainJavaDirectory() + '/' + tuple.replace('.', '/'); final Map<String, Map<String, String>> messageProperties = new HashMap<>(); messageProperties.put(tuple, new TreeMap<>()); if (family != null && !family.isEmpty()) { messageProperties.get(tuple).put(family + "._displayName", family); } final boolean hasService = (sources != null && !sources.isEmpty()) || (processors != null && !processors.isEmpty()); if (!hasService) { return Stream.empty(); } final String baseName = names.toJavaName(build.getArtifact()); final String serviceName = baseName + "Service"; final String usedFamily = ofNullable(family).orElse(build.getArtifact()); final String iconResourcesDirectory = build.getMainResourcesDirectory() + "/icons"; final Collection<FacetGenerator.InMemoryFile> files = new ArrayList<>(); files .add(new FacetGenerator.InMemoryFile(mainJava + "/package-info.java", tpl.render("generator/component/package-info.mustache", new HashMap<String, Object>() { { put("package", tuple); put("family", usedFamily); put("category", ofNullable(category).orElse(build.getArtifact())); put("iconResources", iconResourcesDirectory); } }))); files.add(generateIcon(iconResourcesDirectory, usedFamily)); files .add(new FacetGenerator.InMemoryFile(mainJava + "/service/" + serviceName + ".java", tpl.render("generator/component/Service.mustache", new HashMap<String, Object>() { { put("className", serviceName); put("package", tuple + ".service"); } }))); configurations.stream().filter(it -> it.getType() != null && !it.getType().isEmpty()).forEach(it -> { final String lowerType = it.getType().toLowerCase(ENGLISH); final String configPck = tuple + '.' + lowerType; final String name = it.getName().substring(it.getName().lastIndexOf('.') + 1); generateConfiguration(configPck + '.' + name, configPck, mainJava, it.getStructure(), name, files, lowerType); messageProperties .computeIfAbsent(tuple, k -> new TreeMap<>()) .put(family + "." + lowerType + "." + name + "._displayName", name); if (it.getStructure() != null) { final Map<String, String> i18n = messageProperties.computeIfAbsent(configPck, k -> new TreeMap<>()); toProperties(name, it.getStructure().getEntries()) .flatMap(this::toProperties) .forEach(t -> i18n.put(t.key, t.value)); } }); if (sources != null && !sources.isEmpty()) { files .addAll(createSourceFiles(tuple, iconResourcesDirectory, sources, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".source", new TreeMap<String, String>() { { putAll(sources .stream() .map(source -> new StringTuple2(family + "." + source.getName() + "._displayName", source.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(sources .stream() .filter(source -> source.getConfiguration() != null && source.getConfiguration().getEntries() != null) .flatMap(source -> toProperties( names.toConfigurationName(names.toMapperName(source.getName())), source.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } if (processors != null && !processors.isEmpty()) { files .addAll(createProcessorFiles(tuple, iconResourcesDirectory, processors, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".output", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isOutput) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isOutput) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); messageProperties.put(tuple + ".processor", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isProcessor) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isProcessor) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } files.addAll(generateProperties(build.getMainResourcesDirectory(), messageProperties).collect(toList())); return files.stream(); }
ComponentGenerator { public Stream<FacetGenerator.InMemoryFile> create(final String tuple, final Build build, final String family, final String category, final Collection<ProjectRequest.SourceConfiguration> sources, final Collection<ProjectRequest.ProcessorConfiguration> processors, final Collection<ProjectRequest.ReusableConfiguration> configurations) { final String mainJava = build.getMainJavaDirectory() + '/' + tuple.replace('.', '/'); final Map<String, Map<String, String>> messageProperties = new HashMap<>(); messageProperties.put(tuple, new TreeMap<>()); if (family != null && !family.isEmpty()) { messageProperties.get(tuple).put(family + "._displayName", family); } final boolean hasService = (sources != null && !sources.isEmpty()) || (processors != null && !processors.isEmpty()); if (!hasService) { return Stream.empty(); } final String baseName = names.toJavaName(build.getArtifact()); final String serviceName = baseName + "Service"; final String usedFamily = ofNullable(family).orElse(build.getArtifact()); final String iconResourcesDirectory = build.getMainResourcesDirectory() + "/icons"; final Collection<FacetGenerator.InMemoryFile> files = new ArrayList<>(); files .add(new FacetGenerator.InMemoryFile(mainJava + "/package-info.java", tpl.render("generator/component/package-info.mustache", new HashMap<String, Object>() { { put("package", tuple); put("family", usedFamily); put("category", ofNullable(category).orElse(build.getArtifact())); put("iconResources", iconResourcesDirectory); } }))); files.add(generateIcon(iconResourcesDirectory, usedFamily)); files .add(new FacetGenerator.InMemoryFile(mainJava + "/service/" + serviceName + ".java", tpl.render("generator/component/Service.mustache", new HashMap<String, Object>() { { put("className", serviceName); put("package", tuple + ".service"); } }))); configurations.stream().filter(it -> it.getType() != null && !it.getType().isEmpty()).forEach(it -> { final String lowerType = it.getType().toLowerCase(ENGLISH); final String configPck = tuple + '.' + lowerType; final String name = it.getName().substring(it.getName().lastIndexOf('.') + 1); generateConfiguration(configPck + '.' + name, configPck, mainJava, it.getStructure(), name, files, lowerType); messageProperties .computeIfAbsent(tuple, k -> new TreeMap<>()) .put(family + "." + lowerType + "." + name + "._displayName", name); if (it.getStructure() != null) { final Map<String, String> i18n = messageProperties.computeIfAbsent(configPck, k -> new TreeMap<>()); toProperties(name, it.getStructure().getEntries()) .flatMap(this::toProperties) .forEach(t -> i18n.put(t.key, t.value)); } }); if (sources != null && !sources.isEmpty()) { files .addAll(createSourceFiles(tuple, iconResourcesDirectory, sources, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".source", new TreeMap<String, String>() { { putAll(sources .stream() .map(source -> new StringTuple2(family + "." + source.getName() + "._displayName", source.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(sources .stream() .filter(source -> source.getConfiguration() != null && source.getConfiguration().getEntries() != null) .flatMap(source -> toProperties( names.toConfigurationName(names.toMapperName(source.getName())), source.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } if (processors != null && !processors.isEmpty()) { files .addAll(createProcessorFiles(tuple, iconResourcesDirectory, processors, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".output", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isOutput) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isOutput) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); messageProperties.put(tuple + ".processor", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isProcessor) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isProcessor) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } files.addAll(generateProperties(build.getMainResourcesDirectory(), messageProperties).collect(toList())); return files.stream(); } }
ComponentGenerator { public Stream<FacetGenerator.InMemoryFile> create(final String tuple, final Build build, final String family, final String category, final Collection<ProjectRequest.SourceConfiguration> sources, final Collection<ProjectRequest.ProcessorConfiguration> processors, final Collection<ProjectRequest.ReusableConfiguration> configurations) { final String mainJava = build.getMainJavaDirectory() + '/' + tuple.replace('.', '/'); final Map<String, Map<String, String>> messageProperties = new HashMap<>(); messageProperties.put(tuple, new TreeMap<>()); if (family != null && !family.isEmpty()) { messageProperties.get(tuple).put(family + "._displayName", family); } final boolean hasService = (sources != null && !sources.isEmpty()) || (processors != null && !processors.isEmpty()); if (!hasService) { return Stream.empty(); } final String baseName = names.toJavaName(build.getArtifact()); final String serviceName = baseName + "Service"; final String usedFamily = ofNullable(family).orElse(build.getArtifact()); final String iconResourcesDirectory = build.getMainResourcesDirectory() + "/icons"; final Collection<FacetGenerator.InMemoryFile> files = new ArrayList<>(); files .add(new FacetGenerator.InMemoryFile(mainJava + "/package-info.java", tpl.render("generator/component/package-info.mustache", new HashMap<String, Object>() { { put("package", tuple); put("family", usedFamily); put("category", ofNullable(category).orElse(build.getArtifact())); put("iconResources", iconResourcesDirectory); } }))); files.add(generateIcon(iconResourcesDirectory, usedFamily)); files .add(new FacetGenerator.InMemoryFile(mainJava + "/service/" + serviceName + ".java", tpl.render("generator/component/Service.mustache", new HashMap<String, Object>() { { put("className", serviceName); put("package", tuple + ".service"); } }))); configurations.stream().filter(it -> it.getType() != null && !it.getType().isEmpty()).forEach(it -> { final String lowerType = it.getType().toLowerCase(ENGLISH); final String configPck = tuple + '.' + lowerType; final String name = it.getName().substring(it.getName().lastIndexOf('.') + 1); generateConfiguration(configPck + '.' + name, configPck, mainJava, it.getStructure(), name, files, lowerType); messageProperties .computeIfAbsent(tuple, k -> new TreeMap<>()) .put(family + "." + lowerType + "." + name + "._displayName", name); if (it.getStructure() != null) { final Map<String, String> i18n = messageProperties.computeIfAbsent(configPck, k -> new TreeMap<>()); toProperties(name, it.getStructure().getEntries()) .flatMap(this::toProperties) .forEach(t -> i18n.put(t.key, t.value)); } }); if (sources != null && !sources.isEmpty()) { files .addAll(createSourceFiles(tuple, iconResourcesDirectory, sources, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".source", new TreeMap<String, String>() { { putAll(sources .stream() .map(source -> new StringTuple2(family + "." + source.getName() + "._displayName", source.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(sources .stream() .filter(source -> source.getConfiguration() != null && source.getConfiguration().getEntries() != null) .flatMap(source -> toProperties( names.toConfigurationName(names.toMapperName(source.getName())), source.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } if (processors != null && !processors.isEmpty()) { files .addAll(createProcessorFiles(tuple, iconResourcesDirectory, processors, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".output", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isOutput) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isOutput) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); messageProperties.put(tuple + ".processor", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isProcessor) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isProcessor) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } files.addAll(generateProperties(build.getMainResourcesDirectory(), messageProperties).collect(toList())); return files.stream(); }  }
ComponentGenerator { public Stream<FacetGenerator.InMemoryFile> create(final String tuple, final Build build, final String family, final String category, final Collection<ProjectRequest.SourceConfiguration> sources, final Collection<ProjectRequest.ProcessorConfiguration> processors, final Collection<ProjectRequest.ReusableConfiguration> configurations) { final String mainJava = build.getMainJavaDirectory() + '/' + tuple.replace('.', '/'); final Map<String, Map<String, String>> messageProperties = new HashMap<>(); messageProperties.put(tuple, new TreeMap<>()); if (family != null && !family.isEmpty()) { messageProperties.get(tuple).put(family + "._displayName", family); } final boolean hasService = (sources != null && !sources.isEmpty()) || (processors != null && !processors.isEmpty()); if (!hasService) { return Stream.empty(); } final String baseName = names.toJavaName(build.getArtifact()); final String serviceName = baseName + "Service"; final String usedFamily = ofNullable(family).orElse(build.getArtifact()); final String iconResourcesDirectory = build.getMainResourcesDirectory() + "/icons"; final Collection<FacetGenerator.InMemoryFile> files = new ArrayList<>(); files .add(new FacetGenerator.InMemoryFile(mainJava + "/package-info.java", tpl.render("generator/component/package-info.mustache", new HashMap<String, Object>() { { put("package", tuple); put("family", usedFamily); put("category", ofNullable(category).orElse(build.getArtifact())); put("iconResources", iconResourcesDirectory); } }))); files.add(generateIcon(iconResourcesDirectory, usedFamily)); files .add(new FacetGenerator.InMemoryFile(mainJava + "/service/" + serviceName + ".java", tpl.render("generator/component/Service.mustache", new HashMap<String, Object>() { { put("className", serviceName); put("package", tuple + ".service"); } }))); configurations.stream().filter(it -> it.getType() != null && !it.getType().isEmpty()).forEach(it -> { final String lowerType = it.getType().toLowerCase(ENGLISH); final String configPck = tuple + '.' + lowerType; final String name = it.getName().substring(it.getName().lastIndexOf('.') + 1); generateConfiguration(configPck + '.' + name, configPck, mainJava, it.getStructure(), name, files, lowerType); messageProperties .computeIfAbsent(tuple, k -> new TreeMap<>()) .put(family + "." + lowerType + "." + name + "._displayName", name); if (it.getStructure() != null) { final Map<String, String> i18n = messageProperties.computeIfAbsent(configPck, k -> new TreeMap<>()); toProperties(name, it.getStructure().getEntries()) .flatMap(this::toProperties) .forEach(t -> i18n.put(t.key, t.value)); } }); if (sources != null && !sources.isEmpty()) { files .addAll(createSourceFiles(tuple, iconResourcesDirectory, sources, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".source", new TreeMap<String, String>() { { putAll(sources .stream() .map(source -> new StringTuple2(family + "." + source.getName() + "._displayName", source.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(sources .stream() .filter(source -> source.getConfiguration() != null && source.getConfiguration().getEntries() != null) .flatMap(source -> toProperties( names.toConfigurationName(names.toMapperName(source.getName())), source.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } if (processors != null && !processors.isEmpty()) { files .addAll(createProcessorFiles(tuple, iconResourcesDirectory, processors, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".output", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isOutput) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isOutput) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); messageProperties.put(tuple + ".processor", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isProcessor) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isProcessor) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } files.addAll(generateProperties(build.getMainResourcesDirectory(), messageProperties).collect(toList())); return files.stream(); }  Stream<FacetGenerator.InMemoryFile> create(final String tuple, final Build build, final String family,
            final String category, final Collection<ProjectRequest.SourceConfiguration> sources,
            final Collection<ProjectRequest.ProcessorConfiguration> processors,
            final Collection<ProjectRequest.ReusableConfiguration> configurations); }
ComponentGenerator { public Stream<FacetGenerator.InMemoryFile> create(final String tuple, final Build build, final String family, final String category, final Collection<ProjectRequest.SourceConfiguration> sources, final Collection<ProjectRequest.ProcessorConfiguration> processors, final Collection<ProjectRequest.ReusableConfiguration> configurations) { final String mainJava = build.getMainJavaDirectory() + '/' + tuple.replace('.', '/'); final Map<String, Map<String, String>> messageProperties = new HashMap<>(); messageProperties.put(tuple, new TreeMap<>()); if (family != null && !family.isEmpty()) { messageProperties.get(tuple).put(family + "._displayName", family); } final boolean hasService = (sources != null && !sources.isEmpty()) || (processors != null && !processors.isEmpty()); if (!hasService) { return Stream.empty(); } final String baseName = names.toJavaName(build.getArtifact()); final String serviceName = baseName + "Service"; final String usedFamily = ofNullable(family).orElse(build.getArtifact()); final String iconResourcesDirectory = build.getMainResourcesDirectory() + "/icons"; final Collection<FacetGenerator.InMemoryFile> files = new ArrayList<>(); files .add(new FacetGenerator.InMemoryFile(mainJava + "/package-info.java", tpl.render("generator/component/package-info.mustache", new HashMap<String, Object>() { { put("package", tuple); put("family", usedFamily); put("category", ofNullable(category).orElse(build.getArtifact())); put("iconResources", iconResourcesDirectory); } }))); files.add(generateIcon(iconResourcesDirectory, usedFamily)); files .add(new FacetGenerator.InMemoryFile(mainJava + "/service/" + serviceName + ".java", tpl.render("generator/component/Service.mustache", new HashMap<String, Object>() { { put("className", serviceName); put("package", tuple + ".service"); } }))); configurations.stream().filter(it -> it.getType() != null && !it.getType().isEmpty()).forEach(it -> { final String lowerType = it.getType().toLowerCase(ENGLISH); final String configPck = tuple + '.' + lowerType; final String name = it.getName().substring(it.getName().lastIndexOf('.') + 1); generateConfiguration(configPck + '.' + name, configPck, mainJava, it.getStructure(), name, files, lowerType); messageProperties .computeIfAbsent(tuple, k -> new TreeMap<>()) .put(family + "." + lowerType + "." + name + "._displayName", name); if (it.getStructure() != null) { final Map<String, String> i18n = messageProperties.computeIfAbsent(configPck, k -> new TreeMap<>()); toProperties(name, it.getStructure().getEntries()) .flatMap(this::toProperties) .forEach(t -> i18n.put(t.key, t.value)); } }); if (sources != null && !sources.isEmpty()) { files .addAll(createSourceFiles(tuple, iconResourcesDirectory, sources, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".source", new TreeMap<String, String>() { { putAll(sources .stream() .map(source -> new StringTuple2(family + "." + source.getName() + "._displayName", source.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(sources .stream() .filter(source -> source.getConfiguration() != null && source.getConfiguration().getEntries() != null) .flatMap(source -> toProperties( names.toConfigurationName(names.toMapperName(source.getName())), source.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } if (processors != null && !processors.isEmpty()) { files .addAll(createProcessorFiles(tuple, iconResourcesDirectory, processors, mainJava, serviceName) .collect(toList())); messageProperties.put(tuple + ".output", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isOutput) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isOutput) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); messageProperties.put(tuple + ".processor", new TreeMap<String, String>() { { putAll(processors .stream() .filter(ComponentGenerator::isProcessor) .map(processor -> new StringTuple2(family + "." + processor.getName() + "._displayName", processor.getName())) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue))); putAll(processors .stream() .filter(processor -> processor.getConfiguration() != null && processor.getConfiguration().getEntries() != null) .filter(ComponentGenerator::isProcessor) .flatMap(p -> toProperties(names.toConfigurationName(names.toProcessorName(p)), p.getConfiguration().getEntries())) .flatMap(tuple3 -> toProperties(tuple3)) .collect(toMap(StringTuple2::getKey, StringTuple2::getValue, (k1, k2) -> k1))); } }); } files.addAll(generateProperties(build.getMainResourcesDirectory(), messageProperties).collect(toList())); return files.stream(); }  Stream<FacetGenerator.InMemoryFile> create(final String tuple, final Build build, final String family,
            final String category, final Collection<ProjectRequest.SourceConfiguration> sources,
            final Collection<ProjectRequest.ProcessorConfiguration> processors,
            final Collection<ProjectRequest.ReusableConfiguration> configurations);  }