Skip to content

Commit 3ca4fc2

Browse files
committed
Rename quarkus-qute-resteasy to quarkus-resteasy-qute
- plus other fixes
1 parent 34dbe49 commit 3ca4fc2

File tree

34 files changed

+89
-179
lines changed

34 files changed

+89
-179
lines changed

bom/deployment/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@
516516
</dependency>
517517
<dependency>
518518
<groupId>io.quarkus</groupId>
519-
<artifactId>quarkus-qute-resteasy-deployment</artifactId>
519+
<artifactId>quarkus-resteasy-qute-deployment</artifactId>
520520
<version>${project.version}</version>
521521
</dependency>
522522

bom/runtime/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@
744744
</dependency>
745745
<dependency>
746746
<groupId>io.quarkus</groupId>
747-
<artifactId>quarkus-qute-resteasy</artifactId>
747+
<artifactId>quarkus-resteasy-qute</artifactId>
748748
<version>${project.version}</version>
749749
</dependency>
750750

core/deployment/src/main/java/io/quarkus/runner/RuntimeClassLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,5 +542,5 @@ private ProtectionDomain createDefaultProtectionDomain(Path applicationClasspath
542542
ProtectionDomain protectionDomain = new ProtectionDomain(codesource, null, this, null);
543543
return protectionDomain;
544544
}
545-
545+
546546
}

docs/src/main/asciidoc/qute.adoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ In your `pom.xml` file, add:
3030
----
3131
<dependency>
3232
<groupId>io.quarkus</groupId>
33-
<artifactId>quarkus-qute-resteasy</artifactId>
33+
<artifactId>quarkus-resteasy-qute</artifactId>
3434
</dependency>
3535
----
3636

@@ -72,12 +72,13 @@ public class HelloResource {
7272
}
7373
}
7474
----
75-
<1> If there is no `@ResourcePath` qualifier provided the field name is used to locate the template. In this particular case, we're injecting a template with path `templates/hello.txt`.
75+
<1> If there is no `@ResourcePath` qualifier provided, the field name is used to locate the template. In this particular case, we're injecting a template with path `templates/hello.txt`.
7676
<2> `Template.data()` returns a new template instance that can be customized before the actual rendering is triggered. In this case, we put the name value under the key `name`. The data map is accessible during rendering.
7777
<3> Note that we don't trigger the rendering - this is done automatically by a special `ContainerResponseFilter` implementation.
7878

79-
If running your application, you can request the endpoint:
79+
If your application is running, you can request the endpoint:
8080

81+
[source, shell]
8182
```
8283
$ curl -w "\n" http://localhost:8080/hello?name=Martin
8384
Hello Martin!
@@ -176,7 +177,7 @@ public class ItemResource {
176177
== Rendering Periodic Reports
177178

178179
Templating engine could be also very useful when rendering periodic reports.
179-
You'll need to add `quarkus-scheduler` and `quarkus-qute` extensions first.
180+
You'll need to add the `quarkus-scheduler` and `quarkus-qute` extensions first.
180181
In your `pom.xml` file, add:
181182

182183
[source,xml]
@@ -230,7 +231,7 @@ The template is simple:
230231
</html>
231232
----
232233
<1> The loop section makes it possible to iterate over iterables, maps and streams.
233-
<2> This value expression is using https://en.wikipedia.org/wiki/Elvis_operator[elvis operator] - if the name is null the default value is used.
234+
<2> This value expression is using the https://en.wikipedia.org/wiki/Elvis_operator[elvis operator] - if the name is null the default value is used.
234235

235236
[source,java]
236237
.ReportGenerator.java

extensions/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<module>resteasy-jsonb</module>
4646
<module>resteasy-jackson</module>
4747
<module>resteasy-jaxb</module>
48+
<module>resteasy-qute</module>
4849
<module>rest-client</module>
4950
<module>smallrye-openapi-common</module>
5051
<module>smallrye-openapi</module>
@@ -135,7 +136,6 @@
135136

136137
<!-- Templating -->
137138
<module>qute</module>
138-
<module>qute-resteasy</module>
139139
</modules>
140140

141141
<!-- Unfortunately the config below introduces a build dependency on the maven plugin

extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/GeneratedValueResolverBuildItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import io.quarkus.builder.item.MultiBuildItem;
44

5+
/**
6+
* Holds a name of a generated {@link io.quarkus.qute.ValueResolver} class.
7+
*/
58
public final class GeneratedValueResolverBuildItem extends MultiBuildItem {
69

710
private final String className;

extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
import org.jboss.jandex.MethodInfo;
3737
import org.jboss.jandex.ParameterizedType;
3838
import org.jboss.jandex.Type;
39-
import org.slf4j.Logger;
40-
import org.slf4j.LoggerFactory;
39+
import org.jboss.logging.Logger;
4140

4241
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
4342
import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem;
@@ -87,7 +86,7 @@
8786

8887
public class QuteProcessor {
8988

90-
private static final Logger LOGGER = LoggerFactory.getLogger(QuteProcessor.class);
89+
private static final Logger LOGGER = Logger.getLogger(QuteProcessor.class);
9190

9291
public static final DotName RESOURCE_PATH = DotName.createSimple(ResourcePath.class.getName());
9392
public static final DotName TEMPLATE = DotName.createSimple(Template.class.getName());
@@ -147,7 +146,9 @@ TemplatesAnalysisBuildItem analyzeTemplates(List<TemplatePathBuildItem> template
147146
long start = System.currentTimeMillis();
148147
List<TemplateAnalysis> analysis = new ArrayList<>();
149148

149+
// A dummy engine instance is used to parse and validate all templates during the build. The real engine instance is created at startup.
150150
Engine dummyEngine = Engine.builder().addDefaultSectionHelpers().computeSectionHelper(name -> {
151+
// Create a dummy section helper factory for an uknown section that could be potentially registered at runtime
151152
return new SectionHelperFactory<SectionHelper>() {
152153
@Override
153154
public SectionHelper initialize(SectionInitContext context) {
@@ -169,7 +170,7 @@ public CompletionStage<ResultNode> resolve(SectionResolutionContext context) {
169170
LOGGER.warn("Unable to analyze the template from path: " + path.getFullPath(), e);
170171
}
171172
}
172-
LOGGER.debug("Finished analysis of {} templates in {} ms",
173+
LOGGER.debugf("Finished analysis of %s templates in %s ms",
173174
analysis.size(), System.currentTimeMillis() - start);
174175
return new TemplatesAnalysisBuildItem(analysis);
175176
}
@@ -216,7 +217,7 @@ void validateExpressions(TemplatesAnalysisBuildItem templatesAnalysis, BeanArchi
216217
member = findTemplateExtensionMethod(name, match.clazz, templateExtensionMethods);
217218
}
218219
if (member == null && excludes.stream().anyMatch(e -> e.getPredicate().test(name, match.clazz))) {
219-
LOGGER.debug("No property found for {} in [{}] but it is intentionally ignored", name,
220+
LOGGER.debugf("No property found for %s in [%s] but it is intentionally ignored", name,
220221
expression.toOriginalString(), match.clazz);
221222
break;
222223
}
@@ -324,7 +325,7 @@ void validateInjectedBeans(ApplicationArchivesBuildItem applicationArchivesBuild
324325
}
325326
if (member == null
326327
&& excludes.stream().anyMatch(e -> e.getPredicate().test(name, match.clazz))) {
327-
LOGGER.debug("No property found for {} in [{}] but it is intentionally ignored", name,
328+
LOGGER.debugf("No property found for %s in [%s] but it is intentionally ignored", name,
328329
expression.toOriginalString(), match.clazz);
329330
break;
330331
}
@@ -409,7 +410,7 @@ public void write(String name, byte[] data) {
409410
}
410411
String className = name.substring(0, idx).replace("/", ".");
411412
boolean appClass = appClassPredicate.test(className);
412-
LOGGER.debug("Writing {} [appClass={}]", name, appClass);
413+
LOGGER.debugf("Writing %s [appClass=%s]", name, appClass);
413414
generatedClass.produce(new GeneratedClassBuildItem(appClass, name, data));
414415
}
415416
};
@@ -443,18 +444,18 @@ public void write(String name, byte[] data) {
443444
generator.generate(data);
444445
}
445446

446-
Set<String> generateTypes = new HashSet<>();
447-
generateTypes.addAll(generator.getGeneratedTypes());
447+
Set<String> generatedTypes = new HashSet<>();
448+
generatedTypes.addAll(generator.getGeneratedTypes());
448449

449450
ExtensionMethodGenerator extensionMethodGenerator = new ExtensionMethodGenerator(classOutput);
450451
for (TemplateExtensionMethodBuildItem templateExtension : templateExtensionMethods) {
451452
extensionMethodGenerator.generate(templateExtension.getMethod());
452453
}
453-
generateTypes.addAll(extensionMethodGenerator.getGeneratedTypes());
454+
generatedTypes.addAll(extensionMethodGenerator.getGeneratedTypes());
454455

455-
LOGGER.debug("Generated types: {}", generateTypes);
456+
LOGGER.debugf("Generated types: %s", generatedTypes);
456457

457-
for (String generateType : generateTypes) {
458+
for (String generateType : generatedTypes) {
458459
generatedResolvers.produce(new GeneratedValueResolverBuildItem(generateType));
459460
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, generateType));
460461
}
@@ -483,7 +484,7 @@ void collectTemplates(QuteConfig config, ApplicationArchivesBuildItem applicatio
483484
while (tagFiles.hasNext()) {
484485
Path path = tagFiles.next();
485486
String tagPath = path.getFileName().toString();
486-
LOGGER.debug("Found tag: {}", path);
487+
LOGGER.debugf("Found tag: %s", path);
487488
produceTemplateBuildItems(templatePaths, watchedPaths, nativeImageResources, tagBasePath, tagPath, path, true);
488489
}
489490
}
@@ -563,7 +564,7 @@ void processInjectionPoints(QuteConfig config, ApplicationArchivesBuildItem appl
563564
Map<String, List<String>> variants = new HashMap<>();
564565
scanVariants(basePath, templatesPath, templatesPath, variantBases, variants);
565566
templateVariants.produce(new TemplateVariantsBuildItem(variants));
566-
LOGGER.debug("Variant templates found: {}", variants);
567+
LOGGER.debugf("Variant templates found: %s", variants);
567568
}
568569
}
569570

@@ -749,7 +750,7 @@ private void processsTemplateData(IndexView index, AnnotationInstance templateDa
749750
new AnnotationValue[] { ignoreValue, propertiesValue });
750751
});
751752
} else {
752-
LOGGER.warn("@TemplateData#target() not available: {}", annotationTarget.asClass().name());
753+
LOGGER.warnf("@TemplateData#target() not available: %s", annotationTarget.asClass().name());
753754
}
754755
}
755756
}
@@ -808,12 +809,12 @@ private void scan(Path root, Path directory, String basePath, BuildProducer<HotD
808809
while (files.hasNext()) {
809810
Path path = files.next();
810811
if (Files.isRegularFile(path)) {
811-
LOGGER.debug("Found template: {}", path);
812+
LOGGER.debugf("Found template: %s", path);
812813
String templatePath = root.relativize(path).toString();
813814
produceTemplateBuildItems(templatePaths, watchedPaths, nativeImageResources, basePath, templatePath, path,
814815
false);
815816
} else if (Files.isDirectory(path) && !path.getFileName().toString().equals("tags")) {
816-
LOGGER.debug("Scan directory: {}", path);
817+
LOGGER.debugf("Scan directory: %s", path);
817818
scan(root, path, basePath, watchedPaths, templatePaths, nativeImageResources);
818819
}
819820
}

extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplateExtensionMethodBuildItem.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
import io.quarkus.builder.item.MultiBuildItem;
77
import io.quarkus.qute.TemplateExtension;
88

9+
/**
10+
* Represents a template extension method.
11+
*
12+
* @see TemplateExtension
13+
*/
914
public final class TemplateExtensionMethodBuildItem extends MultiBuildItem {
1015

1116
private final MethodInfo method;

extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplatePathBuildItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
import io.quarkus.builder.item.MultiBuildItem;
66

7+
/**
8+
* Represents a template path.
9+
*/
710
public final class TemplatePathBuildItem extends MultiBuildItem {
811

912
private final String path;

extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplateVariantsBuildItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
import io.quarkus.builder.item.SimpleBuildItem;
77

8+
/**
9+
* Holds all template variants found.
10+
*/
811
public final class TemplateVariantsBuildItem extends SimpleBuildItem {
912

1013
private final Map<String, List<String>> variants;

0 commit comments

Comments
 (0)