From f05cd575f7a8bb6bbf1057ed74b8af708a4c5770 Mon Sep 17 00:00:00 2001 From: "Erdle, Tobias" Date: Fri, 5 Aug 2022 14:28:09 +0200 Subject: [PATCH] Remove extensions after their migration to krazo-extensions see: #319 --- ext/asciidoc/.gitignore | 1 - ext/asciidoc/pom.xml | 40 ---- .../ext/asciidoc/AsciiDocViewEngine.java | 81 ------- ext/asciidoc/src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 26 --- ext/freemarker/pom.xml | 40 ---- .../DefaultConfigurationProducer.java | 77 ------- .../ext/freemarker/FreemarkerViewEngine.java | 77 ------- ext/freemarker/src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 26 --- ext/handlebars/pom.xml | 39 ---- .../handlebars/DefaultHandlebarsProducer.java | 38 ---- .../ext/handlebars/HandlebarsViewEngine.java | 91 -------- ext/handlebars/src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 26 --- ext/jade/README.md | 33 --- ext/jade/pom.xml | 40 ---- .../ext/jade/JadeKrazoConfiguration.java | 158 -------------- .../krazo/ext/jade/JadeViewEngine.java | 79 ------- .../jade/ServletContextTemplateLoader.java | 79 ------- ext/jade/src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 26 --- ext/jetbrick/pom.xml | 44 ---- .../ext/jetbrick/JetbrickViewEngine.java | 83 ------- .../src/main/resources/META-INF/beans.xml | 26 --- ext/jinja2/pom.xml | 41 ---- .../ext/jinja2/DefaultJinjavaProducer.java | 22 -- .../krazo/ext/jinja2/Jinja2ViewEngine.java | 100 --------- .../src/main/resources/META-INF/beans.xml | 25 --- ext/mustache/pom.xml | 38 ---- .../DefaultMustacheFactoryProducer.java | 62 ------ .../ext/mustache/MustacheViewEngine.java | 77 ------- ext/mustache/src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 26 --- ext/pebble/README.md | 50 ----- ext/pebble/pom.xml | 45 ---- .../pebble/PebbleConfigurationProducer.java | 58 ----- .../ext/pebble/PebbleEngineProducer.java | 126 ----------- .../krazo/ext/pebble/PebbleProperty.java | 57 ----- .../krazo/ext/pebble/PebbleViewEngine.java | 83 ------- .../src/main/resources/META-INF/beans.xml | 26 --- .../ext/pebble/CustomEscapingStrategy.java | 29 --- .../ext/pebble/CustomExecutorService.java | 92 -------- .../krazo/ext/pebble/CustomExtensionOne.java | 78 ------- .../krazo/ext/pebble/CustomExtensionTwo.java | 77 ------- .../PebbleConfigurationProducerTest.java | 71 ------ .../ext/pebble/PebbleEngineProducerTest.java | 113 ---------- .../krazo/ext/pebble/PebblePropertyTest.java | 52 ----- .../ext/pebble/PebbleViewEngineTest.java | 35 --- .../src/test/resources/pebble.properties | 1 - ext/pom.xml | 129 ----------- ext/stringtemplate/pom.xml | 40 ---- .../StringTemplateViewEngine.java | 83 ------- .../src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 26 --- ext/thymeleaf/pom.xml | 38 ---- .../krazo/ext/thymeleaf/CDIWebContext.java | 143 ------------- ...aServletWebApplicationWrapperProducer.java | 51 ----- .../DefaultTemplateEngineProducer.java | 54 ----- .../JakartaServletWebApplicationWrapper.java | 31 --- .../ext/thymeleaf/ThymeleafViewEngine.java | 91 -------- ext/thymeleaf/src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 27 --- ext/velocity/pom.xml | 40 ---- .../DefaultVelocityEngineProducer.java | 49 ----- .../ServletContextResourceLoader.java | 71 ------ .../ext/velocity/VelocityViewEngine.java | 78 ------- ext/velocity/src/main/resources/LICENSE.txt | 202 ------------------ .../src/main/resources/META-INF/beans.xml | 26 --- pom.xml | 1 - testsuite/pom.xml | 70 ------ .../test/ext/asciidoc/HelloController.java | 48 ----- .../test/ext/asciidoc/MyApplication.java | 33 --- .../test/ext/freemarker/HelloController.java | 48 ----- .../test/ext/freemarker/MyApplication.java | 33 --- .../test/ext/handlebars/MyApplication.java | 33 --- .../krazo/test/ext/handlebars/Person.java | 64 ------ .../test/ext/handlebars/PersonController.java | 54 ----- .../krazo/test/ext/jade/DummyFilter.java | 39 ---- .../krazo/test/ext/jade/JadeApplication.java | 38 ---- .../krazo/test/ext/jade/JadeController.java | 70 ------ .../krazo/test/ext/jade/MathHelper.java | 31 --- .../test/ext/jetbrick/HelloController.java | 48 ----- .../test/ext/jetbrick/MyApplication.java | 34 --- .../test/ext/jinja2/HelloController.java | 42 ---- .../krazo/test/ext/jinja2/MyApplication.java | 26 --- .../test/ext/jsr223/Jsr223Application.java | 34 --- .../test/ext/jsr223/JythonController.java | 48 ----- .../test/ext/jsr223/NashornController.java | 48 ----- .../test/ext/mustache/HelloController.java | 48 ----- .../test/ext/mustache/MyApplication.java | 34 --- .../test/ext/pebble/PebbleApplication.java | 26 --- .../test/ext/pebble/PebbleController.java | 48 ----- .../ext/stringtemplate/HelloController.java | 45 ---- .../ext/stringtemplate/MyApplication.java | 34 --- .../krazo/test/ext/thymeleaf/Greeting.java | 40 ---- .../test/ext/thymeleaf/HelloController.java | 47 ---- .../test/ext/thymeleaf/MyApplication.java | 34 --- .../test/ext/velocity/HelloController.java | 58 ----- .../test/ext/velocity/MyApplication.java | 34 --- .../main/resources/asciidoc/views/hello.adoc | 3 - .../main/resources/freemarker/views/hello.ftl | 9 - .../main/resources/handlebars/views/head.hbs | 1 - .../resources/handlebars/views/person.hbs | 14 -- .../src/main/resources/jade/jade.properties | 4 - .../src/main/resources/jade/views/config.jade | 10 - .../src/main/resources/jade/views/helper.jade | 9 - .../resources/jade/views/includes/footer.jade | 2 - .../src/main/resources/jade/views/main.jade | 8 - .../main/resources/jade/views/markdown.jade | 15 -- .../main/resources/jetbrick/views/hello.jetx | 11 - .../src/main/resources/jinja2/views/hello.j2 | 11 - .../src/main/resources/jsr223/views/index.js | 1 - .../src/main/resources/jsr223/views/index.py | 1 - .../resources/jtwig/views/hello.twig.html | 11 - .../resources/mustache/views/hello.mustache | 9 - .../main/resources/pebble/pebble.properties | 1 - .../main/resources/pebble/views/filter.peb | 5 - .../src/main/resources/pebble/views/home.peb | 8 - .../resources/stringtemplate/views/hello.st | 13 -- .../main/resources/thymeleaf/views/hello.html | 11 - .../main/resources/velocity/views/hello.vm | 9 - .../resources/velocity/views/hello2.vhtml | 9 - .../eclipse/krazo/test/ext/AsciiDocIT.java | 79 ------- .../eclipse/krazo/test/ext/FreemarkerIT.java | 72 ------- .../eclipse/krazo/test/ext/HandlebarsIT.java | 82 ------- .../org/eclipse/krazo/test/ext/JadeIT.java | 118 ---------- .../eclipse/krazo/test/ext/JetbrickIT.java | 76 ------- .../org/eclipse/krazo/test/ext/Jinja2IT.java | 80 ------- .../eclipse/krazo/test/ext/MustacheIT.java | 73 ------- .../org/eclipse/krazo/test/ext/PebbleIT.java | 78 ------- .../krazo/test/ext/StringTemplateIT.java | 73 ------- .../eclipse/krazo/test/ext/ThymeleafIT.java | 81 ------- .../eclipse/krazo/test/ext/VelocityIT.java | 81 ------- 134 files changed, 7465 deletions(-) delete mode 100644 ext/asciidoc/.gitignore delete mode 100644 ext/asciidoc/pom.xml delete mode 100644 ext/asciidoc/src/main/java/org/eclipse/krazo/ext/asciidoc/AsciiDocViewEngine.java delete mode 100644 ext/asciidoc/src/main/resources/LICENSE.txt delete mode 100644 ext/asciidoc/src/main/resources/META-INF/beans.xml delete mode 100644 ext/freemarker/pom.xml delete mode 100644 ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/DefaultConfigurationProducer.java delete mode 100644 ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/FreemarkerViewEngine.java delete mode 100644 ext/freemarker/src/main/resources/LICENSE.txt delete mode 100644 ext/freemarker/src/main/resources/META-INF/beans.xml delete mode 100644 ext/handlebars/pom.xml delete mode 100644 ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/DefaultHandlebarsProducer.java delete mode 100644 ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/HandlebarsViewEngine.java delete mode 100644 ext/handlebars/src/main/resources/LICENSE.txt delete mode 100644 ext/handlebars/src/main/resources/META-INF/beans.xml delete mode 100644 ext/jade/README.md delete mode 100644 ext/jade/pom.xml delete mode 100644 ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeKrazoConfiguration.java delete mode 100644 ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeViewEngine.java delete mode 100644 ext/jade/src/main/java/org/eclipse/krazo/ext/jade/ServletContextTemplateLoader.java delete mode 100644 ext/jade/src/main/resources/LICENSE.txt delete mode 100644 ext/jade/src/main/resources/META-INF/beans.xml delete mode 100644 ext/jetbrick/pom.xml delete mode 100644 ext/jetbrick/src/main/java/org/eclipse/krazo/ext/jetbrick/JetbrickViewEngine.java delete mode 100644 ext/jetbrick/src/main/resources/META-INF/beans.xml delete mode 100644 ext/jinja2/pom.xml delete mode 100644 ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/DefaultJinjavaProducer.java delete mode 100644 ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/Jinja2ViewEngine.java delete mode 100644 ext/jinja2/src/main/resources/META-INF/beans.xml delete mode 100644 ext/mustache/pom.xml delete mode 100644 ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/DefaultMustacheFactoryProducer.java delete mode 100644 ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/MustacheViewEngine.java delete mode 100644 ext/mustache/src/main/resources/LICENSE.txt delete mode 100644 ext/mustache/src/main/resources/META-INF/beans.xml delete mode 100644 ext/pebble/README.md delete mode 100644 ext/pebble/pom.xml delete mode 100644 ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducer.java delete mode 100644 ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducer.java delete mode 100644 ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleProperty.java delete mode 100644 ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleViewEngine.java delete mode 100644 ext/pebble/src/main/resources/META-INF/beans.xml delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomEscapingStrategy.java delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExecutorService.java delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionOne.java delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionTwo.java delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducerTest.java delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducerTest.java delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebblePropertyTest.java delete mode 100644 ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleViewEngineTest.java delete mode 100644 ext/pebble/src/test/resources/pebble.properties delete mode 100644 ext/pom.xml delete mode 100644 ext/stringtemplate/pom.xml delete mode 100644 ext/stringtemplate/src/main/java/org/eclipse/krazo/ext/stringtemplate/StringTemplateViewEngine.java delete mode 100644 ext/stringtemplate/src/main/resources/LICENSE.txt delete mode 100644 ext/stringtemplate/src/main/resources/META-INF/beans.xml delete mode 100644 ext/thymeleaf/pom.xml delete mode 100644 ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/CDIWebContext.java delete mode 100644 ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultJakartaServletWebApplicationWrapperProducer.java delete mode 100644 ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultTemplateEngineProducer.java delete mode 100644 ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/JakartaServletWebApplicationWrapper.java delete mode 100644 ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/ThymeleafViewEngine.java delete mode 100644 ext/thymeleaf/src/main/resources/LICENSE.txt delete mode 100644 ext/thymeleaf/src/main/resources/META-INF/beans.xml delete mode 100644 ext/velocity/pom.xml delete mode 100644 ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/DefaultVelocityEngineProducer.java delete mode 100644 ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/ServletContextResourceLoader.java delete mode 100644 ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/VelocityViewEngine.java delete mode 100644 ext/velocity/src/main/resources/LICENSE.txt delete mode 100644 ext/velocity/src/main/resources/META-INF/beans.xml delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/Person.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/PersonController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/DummyFilter.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/MathHelper.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/Jsr223Application.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/JythonController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/NashornController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/Greeting.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/MyApplication.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/HelloController.java delete mode 100644 testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/MyApplication.java delete mode 100644 testsuite/src/main/resources/asciidoc/views/hello.adoc delete mode 100644 testsuite/src/main/resources/freemarker/views/hello.ftl delete mode 100644 testsuite/src/main/resources/handlebars/views/head.hbs delete mode 100644 testsuite/src/main/resources/handlebars/views/person.hbs delete mode 100644 testsuite/src/main/resources/jade/jade.properties delete mode 100644 testsuite/src/main/resources/jade/views/config.jade delete mode 100644 testsuite/src/main/resources/jade/views/helper.jade delete mode 100644 testsuite/src/main/resources/jade/views/includes/footer.jade delete mode 100644 testsuite/src/main/resources/jade/views/main.jade delete mode 100644 testsuite/src/main/resources/jade/views/markdown.jade delete mode 100644 testsuite/src/main/resources/jetbrick/views/hello.jetx delete mode 100644 testsuite/src/main/resources/jinja2/views/hello.j2 delete mode 100644 testsuite/src/main/resources/jsr223/views/index.js delete mode 100644 testsuite/src/main/resources/jsr223/views/index.py delete mode 100644 testsuite/src/main/resources/jtwig/views/hello.twig.html delete mode 100644 testsuite/src/main/resources/mustache/views/hello.mustache delete mode 100644 testsuite/src/main/resources/pebble/pebble.properties delete mode 100644 testsuite/src/main/resources/pebble/views/filter.peb delete mode 100644 testsuite/src/main/resources/pebble/views/home.peb delete mode 100644 testsuite/src/main/resources/stringtemplate/views/hello.st delete mode 100644 testsuite/src/main/resources/thymeleaf/views/hello.html delete mode 100644 testsuite/src/main/resources/velocity/views/hello.vm delete mode 100644 testsuite/src/main/resources/velocity/views/hello2.vhtml delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/AsciiDocIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/FreemarkerIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/HandlebarsIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/JadeIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/JetbrickIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/Jinja2IT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/MustacheIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/PebbleIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/StringTemplateIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/ThymeleafIT.java delete mode 100644 testsuite/src/test/java/org/eclipse/krazo/test/ext/VelocityIT.java diff --git a/ext/asciidoc/.gitignore b/ext/asciidoc/.gitignore deleted file mode 100644 index b83d2226..00000000 --- a/ext/asciidoc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target/ diff --git a/ext/asciidoc/pom.xml b/ext/asciidoc/pom.xml deleted file mode 100644 index c73779fe..00000000 --- a/ext/asciidoc/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - - krazo-asciidoc - jar - Eclipse Krazo AsciiDoc Extension - - - - org.asciidoctor - asciidoctorj - - - diff --git a/ext/asciidoc/src/main/java/org/eclipse/krazo/ext/asciidoc/AsciiDocViewEngine.java b/ext/asciidoc/src/main/java/org/eclipse/krazo/ext/asciidoc/AsciiDocViewEngine.java deleted file mode 100644 index 4438ef38..00000000 --- a/ext/asciidoc/src/main/java/org/eclipse/krazo/ext/asciidoc/AsciiDocViewEngine.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.asciidoc; - -import org.asciidoctor.Asciidoctor; -import org.asciidoctor.Asciidoctor.Factory; -import org.asciidoctor.Options; -import org.eclipse.krazo.engine.ViewEngineBase; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.ServletContext; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; - -/** - * Class AsciiDocViewEngine. - * - * @author Ricardo Arguello - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class AsciiDocViewEngine extends ViewEngineBase { - - private final Asciidoctor asciidoctor; - - @Inject - private ServletContext servletContext; - - public AsciiDocViewEngine() { - asciidoctor = Factory.create(); - } - - @Override - public boolean supports(String view) { - return view.endsWith(".adoc") || view.endsWith(".asciidoc"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - Charset charset = resolveCharsetAndSetContentType(context); - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset); - InputStream is = servletContext.getResourceAsStream(resolveView(context)); - InputStreamReader isr = new InputStreamReader(is, "UTF-8"); - BufferedReader reader = new BufferedReader(isr)) { - - Options options = new Options(); - options.setAttributes(new HashMap<>(context.getModels().asMap())); - - asciidoctor.convert(reader, writer, options); - } catch (IOException e) { - throw new ViewEngineException(e); - } - } -} diff --git a/ext/asciidoc/src/main/resources/LICENSE.txt b/ext/asciidoc/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/asciidoc/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/asciidoc/src/main/resources/META-INF/beans.xml b/ext/asciidoc/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/asciidoc/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/freemarker/pom.xml b/ext/freemarker/pom.xml deleted file mode 100644 index a84aa5f7..00000000 --- a/ext/freemarker/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - - krazo-freemarker - jar - Eclipse Krazo Freemarker Extension - - - - org.freemarker - freemarker - - - diff --git a/ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/DefaultConfigurationProducer.java b/ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/DefaultConfigurationProducer.java deleted file mode 100644 index bebc7c58..00000000 --- a/ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/DefaultConfigurationProducer.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.freemarker; - -import org.eclipse.krazo.engine.ViewEngineConfig; -import freemarker.cache.TemplateLoader; -import freemarker.template.Configuration; - -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; -import jakarta.servlet.ServletContext; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -/** - * Producer for the Freemarker {@link freemarker.template.Configuration} used by - * {@link FreemarkerViewEngine}. - * - * @author Christian Kaltepoth - */ -public class DefaultConfigurationProducer { - - @Inject - private ServletContext servletContext; - - @Produces - @ViewEngineConfig - public Configuration getConfiguration() { - - Configuration configuration = new Configuration(Configuration.VERSION_2_3_26); - configuration.setDefaultEncoding("UTF-8"); - configuration.setTemplateLoader(new TemplateLoader() { - - @Override - public Object findTemplateSource(String s) throws IOException { - return servletContext.getResourceAsStream("/" + s); // Freemarker drops "/" - } - - @Override - public long getLastModified(Object o) { - return -1; - } - - @Override - public Reader getReader(Object o, String s) throws IOException { - return new InputStreamReader((InputStream) o); - } - - @Override - public void closeTemplateSource(Object o) throws IOException { - ((InputStream) o).close(); - } - }); - - return configuration; - - } - -} diff --git a/ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/FreemarkerViewEngine.java b/ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/FreemarkerViewEngine.java deleted file mode 100644 index 689c17f1..00000000 --- a/ext/freemarker/src/main/java/org/eclipse/krazo/ext/freemarker/FreemarkerViewEngine.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.freemarker; - -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -/** - * Class FreemarkerViewEngine. - * - * @author Santiago Pericas-Geertsen - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class FreemarkerViewEngine extends ViewEngineBase { - - @Inject - @ViewEngineConfig - private Configuration configuration; - - @Override - public boolean supports(String view) { - return view.endsWith(".ftl"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - - Charset charset = resolveCharsetAndSetContentType(context); - - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset)) { - - Template template = configuration.getTemplate(resolveView(context)); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", context.getRequest(HttpServletRequest.class)); - - template.process(model, writer); - - } catch (TemplateException | IOException e) { - throw new ViewEngineException(e); - } - } -} diff --git a/ext/freemarker/src/main/resources/LICENSE.txt b/ext/freemarker/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/freemarker/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/freemarker/src/main/resources/META-INF/beans.xml b/ext/freemarker/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/freemarker/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/handlebars/pom.xml b/ext/handlebars/pom.xml deleted file mode 100644 index 13a58cb8..00000000 --- a/ext/handlebars/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 2.0.0-SNAPSHOT - - krazo-handlebars - jar - Eclipse Krazo Handlebars Extension - - - com.github.jknack - handlebars - 4.2.0 - - - diff --git a/ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/DefaultHandlebarsProducer.java b/ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/DefaultHandlebarsProducer.java deleted file mode 100644 index 0d6fe354..00000000 --- a/ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/DefaultHandlebarsProducer.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.handlebars; - -import com.github.jknack.handlebars.Handlebars; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.enterprise.inject.Produces; - -/** - * Producer for the Handlebars instance used by HandlebarsViewEngine. - * - * @author Christian Kaltepoth - */ -public class DefaultHandlebarsProducer { - @Produces - @ViewEngineConfig - public Handlebars getHandlebars() { - return new Handlebars(); - } - -} diff --git a/ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/HandlebarsViewEngine.java b/ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/HandlebarsViewEngine.java deleted file mode 100644 index baf8259d..00000000 --- a/ext/handlebars/src/main/java/org/eclipse/krazo/ext/handlebars/HandlebarsViewEngine.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.handlebars; - -import com.github.jknack.handlebars.Handlebars; -import com.github.jknack.handlebars.Template; -import com.github.jknack.handlebars.io.ServletContextTemplateLoader; -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * Class HandlebarsViewEngine - * - * @author Rahman Usta - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class HandlebarsViewEngine extends ViewEngineBase { - - @Inject - private ServletContext servletContext; - - @Inject - @ViewEngineConfig - private Handlebars handlebars; - - @Override - public boolean supports(String view) { - return view.endsWith(".hbs") || view.endsWith(".handlebars"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - handlebars.with(new ServletContextTemplateLoader(servletContext, getViewFolder(context))); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", context.getRequest(HttpServletRequest.class)); - - Charset charset = resolveCharsetAndSetContentType(context); - - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset); - - InputStream resourceAsStream = servletContext.getResourceAsStream(resolveView(context)); - InputStreamReader in = new InputStreamReader(resourceAsStream, "UTF-8"); - BufferedReader bufferedReader = new BufferedReader(in);) { - - String viewContent = bufferedReader.lines().collect(Collectors.joining("\n")); - - Template template = handlebars.compileInline(viewContent); - template.apply(model, writer); - - } catch (IOException e) { - throw new ViewEngineException(e); - } - } -} diff --git a/ext/handlebars/src/main/resources/LICENSE.txt b/ext/handlebars/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/handlebars/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/handlebars/src/main/resources/META-INF/beans.xml b/ext/handlebars/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/handlebars/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/jade/README.md b/ext/jade/README.md deleted file mode 100644 index 3f6be0fb..00000000 --- a/ext/jade/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Jade View Engine - -An Eclipse Krazo Extension for the [Jade Template Engine][jade] using [Jade4J][jade4j]. - -The extension can be configured via SystemProperties or a configuration file named "jade.properties" in the classpath (SystemProperties win). -The default values are: - - org.eclipse.krazo.ext.jade.mode=XHML - org.eclipse.krazo.ext.jade.caching=true - org.eclipse.krazo.ext.jade.prettyPrint=false - org.eclipse.krazo.ext.jade.encoding=UTF-8 - -[Filters][filters] and [Helpers][helpers] can be registered with their fully qualified class name: - - org.eclipse.krazo.ext.jade.filters.myFilter=com.foo.bar.MyFilter - org.eclipse.krazo.ext.jade.helpers.myHelper=com.foo.bar.MyHelper - -This extension does not register any Filter or Helper. Jade4j registers 3 filters per default: - - css=de.neuland.jade4j.filter.CssFilter - js=de.neuland.jade4j.filter.JsFilter - cdata=de.neuland.jade4j.filter.CDATAFilter - -## TODOs - -* The combination of filters and includes does not seem to work. See [jade4j #100][100]. - - - [jade]: http://jade-lang.com/ - [jade4j]: https://github.com/neuland/jade4j - [filters]: https://github.com/neuland/jade4j#api-filters - [helpers]: https://github.com/neuland/jade4j#api-helpers - [100]: https://github.com/neuland/jade4j/issues/100 diff --git a/ext/jade/pom.xml b/ext/jade/pom.xml deleted file mode 100644 index 01bf4ba5..00000000 --- a/ext/jade/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - - krazo-jade - jar - Eclipse Krazo Jade Extension - - - - de.neuland-bfi - jade4j - - - diff --git a/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeKrazoConfiguration.java b/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeKrazoConfiguration.java deleted file mode 100644 index c81234a0..00000000 --- a/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeKrazoConfiguration.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.jade; - -import de.neuland.jade4j.Jade4J.Mode; -import de.neuland.jade4j.JadeConfiguration; -import de.neuland.jade4j.filter.Filter; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.enterprise.inject.Disposes; -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; -import jakarta.servlet.ServletContext; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.Properties; - -/** - * The JadeKrazoConfiguration. The configuration properties are qualified by - * org.eclipse.krazo.ext.jade. Following precedence is used: - *
    - *
  1. System Properties
  2. - *
  3. Properties defined in a file named jade.properties in the classpath.
  4. - *
  5. Defaults
  6. - *
- * - * @author Florian Hirsch - */ -public class JadeKrazoConfiguration { - - /** - * One of HTML, XML, XHTML. Default: XHTML - */ - public static final String MODE = "org.eclipse.krazo.ext.jade.mode"; - - /** - * Parsed templates will be cached unless this property is set to false. - */ - public static final String CACHING = "org.eclipse.krazo.ext.jade.caching"; - - /** - * Jade will produce compressed HTML unless this property is set to true. - */ - public static final String PRETTY_PRINT = "org.eclipse.krazo.ext.jade.prettyPrint"; - - /** - * Qualifier for a {@link Filter} which shall be used by the Jade Engine. - * The key part after the qualifier will be used as name for the filter. The - * value should be a fully qualified class name of the filter. Example: - * org.eclipse.krazo.ext.jade.filter.shiny=com.foo.bar.ShinyFilter - * Jade4J by default registers following filters: cdata, css, js - */ - public static final String FILTER_QUALIFIER = "org.eclipse.krazo.ext.jade.filter"; - - /** - * Qualifier for a Helper. The key part after the qualifier will be used as - * name for the helper. The value should be a fully qualified class name of - * the filter. - * org.eclipse.krazo.ext.jade.helper.math=com.foo.bar.MathHelper - * - */ - public static final String HELPER_QUALIFIER = "org.eclipse.krazo.ext.jade.helper"; - - /** - * The encoding used for the templates. Defaults to UTF-8. - */ - public static final String ENCODING = "org.eclipse.krazo.ext.jade.encoding"; - - private Properties configFile; - - @Inject - private ServletContext servletContext; - - @Produces - @ViewEngineConfig - JadeConfiguration produce() { - loadConfig(); - JadeConfiguration jade = new JadeConfiguration(); - jade.setMode(Mode.valueOf(property(MODE).orElse("XHTML"))); - jade.setCaching(Boolean.valueOf(property(CACHING).orElse("true"))); - jade.setPrettyPrint(Boolean.valueOf(property(PRETTY_PRINT).orElse("false"))); - getExtensions(FILTER_QUALIFIER).entrySet().forEach(filter -> { - jade.setFilter(filter.getKey(), (Filter) filter.getValue()); - }); - jade.setSharedVariables(getExtensions(HELPER_QUALIFIER)); - String encoding = property(ENCODING).orElse("UTF-8"); - jade.setTemplateLoader(new ServletContextTemplateLoader(servletContext, encoding)); - return jade; - } - - private void loadConfig() { - configFile = new Properties(); - InputStream config = Thread.currentThread().getContextClassLoader().getResourceAsStream("jade.properties"); - if (config != null) { - try { - configFile.load(config); - } catch (IOException ignored) { - // ignored - } - } - } - - private Optional property(String key) { - String property = System.getProperty(key, configFile.getProperty(key)); - return Optional.ofNullable(property); - } - - private Map getExtensions(String qualifier) { - Map properties = new HashMap<>(); - properties.putAll(filterProps(configFile, qualifier)); - properties.putAll(filterProps(System.getProperties(), qualifier)); - Map extensions = new HashMap<>(); - properties.forEach((key, value) -> { - try { - Class filter = Class.forName(value); - extensions.put(key, filter.newInstance()); - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException ex) { - String msg = String.format("Jade initialization error: Could not register extension '%s' of type %s", key, value); - throw new IllegalArgumentException(msg, ex); - } - }); - return extensions; - } - - private Map filterProps(Properties props, String qualifier) { - Map filters = new HashMap<>(); - props.entrySet().stream() - .filter(prop -> prop.getKey().toString().startsWith(qualifier)) - .forEach(prop -> { - String key = prop.getKey().toString(); - filters.put(key.substring(key.indexOf(qualifier) + qualifier.length() + 1), prop.getValue().toString()); - }); - return filters; - } - - void dispose(@Disposes @ViewEngineConfig JadeConfiguration jade) { - jade.clearCache(); - } -} diff --git a/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeViewEngine.java b/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeViewEngine.java deleted file mode 100644 index 4cf053e9..00000000 --- a/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/JadeViewEngine.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.jade; - -import de.neuland.jade4j.JadeConfiguration; -import de.neuland.jade4j.exceptions.JadeException; -import de.neuland.jade4j.template.JadeTemplate; -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -/** - * The Jade View Engine. - * - * @author Florian Hirsch - * @see Jade - * @see Jade4J - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class JadeViewEngine extends ViewEngineBase { - - @Inject - @ViewEngineConfig - private JadeConfiguration jade; - - @Override - public boolean supports(String view) { - return view.endsWith(".".concat(jade.getTemplateLoader().getExtension())); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - - Charset charset = resolveCharsetAndSetContentType(context); - - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset)) { - - JadeTemplate template = jade.getTemplate(resolveView(context)); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", context.getRequest(HttpServletRequest.class)); - - jade.renderTemplate(template, model, writer); - - } catch (JadeException | IOException ex) { - throw new ViewEngineException(String.format("Could not process view %s.", context.getView()), ex); - } - } -} diff --git a/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/ServletContextTemplateLoader.java b/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/ServletContextTemplateLoader.java deleted file mode 100644 index 10113c3b..00000000 --- a/ext/jade/src/main/java/org/eclipse/krazo/ext/jade/ServletContextTemplateLoader.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.jade; - -import de.neuland.jade4j.template.TemplateLoader; - -import jakarta.servlet.ServletContext; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.charset.Charset; -import java.util.Objects; - -/** - * A TemplateLoader using {@link ServletContext#getResource(String)} for loading - * the given viewPath. - * - * @author Florian Hirsch - */ -class ServletContextTemplateLoader implements TemplateLoader { - - private final ServletContext servletContext; - - private final String encoding; - - public ServletContextTemplateLoader(ServletContext servletContext, String encoding) { - Objects.requireNonNull(servletContext, "servletContext must not be null!"); - Objects.requireNonNull(encoding, "encoding must not be null!"); - this.servletContext = servletContext; - this.encoding = encoding; - } - - @Override - public Reader getReader(String name) throws IOException { - InputStream inputStream = servletContext.getResourceAsStream(name); - if (inputStream == null) { - throw new FileNotFoundException(String.format("Jade Template '%s' not found.", name)); - } - return new BufferedReader(new InputStreamReader(inputStream, Charset.forName(encoding))); - } - - @Override - public long getLastModified(String name) throws IOException { - String path = servletContext.getRealPath(name); - if (path == null) { - return -1; - } - File template = new File(path); - if (!template.exists()) { - return -1; - } - return template.lastModified(); - } - - @Override - public String getExtension() { - return "jade"; - } -} diff --git a/ext/jade/src/main/resources/LICENSE.txt b/ext/jade/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/jade/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/jade/src/main/resources/META-INF/beans.xml b/ext/jade/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/jade/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/jetbrick/pom.xml b/ext/jetbrick/pom.xml deleted file mode 100644 index 238c03a8..00000000 --- a/ext/jetbrick/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 2.0.0-SNAPSHOT - - krazo-jetbrick - jar - Eclipse Krazo Jetbrick Extension - - - com.github.subchen - jetbrick-template - 2.1.10 - - - com.github.subchen - jetbrick-template-web - 2.1.10 - - - diff --git a/ext/jetbrick/src/main/java/org/eclipse/krazo/ext/jetbrick/JetbrickViewEngine.java b/ext/jetbrick/src/main/java/org/eclipse/krazo/ext/jetbrick/JetbrickViewEngine.java deleted file mode 100644 index cb7e881f..00000000 --- a/ext/jetbrick/src/main/java/org/eclipse/krazo/ext/jetbrick/JetbrickViewEngine.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.jetbrick; - -import jetbrick.template.JetEngine; -import jetbrick.template.JetTemplate; -import jetbrick.template.TemplateException; -import jetbrick.template.web.JetWebEngine; -import org.eclipse.krazo.engine.ViewEngineBase; - -import jakarta.annotation.PostConstruct; -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -/** - * @author Daniel Dias - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class JetbrickViewEngine extends ViewEngineBase { - - private JetEngine jetEngine; - - @PostConstruct - public void init() { - jetEngine = JetWebEngine.create(servletContext); - } - - @Inject - private ServletContext servletContext; - - @Override - public boolean supports(String view) { - return view.endsWith(".jetx"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - - Charset charset = resolveCharsetAndSetContentType(context); - - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset)) { - - JetTemplate template = jetEngine.getTemplate(resolveView(context)); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", context.getRequest(HttpServletRequest.class)); - - template.render(model, writer); - - } catch (TemplateException | IOException e) { - throw new ViewEngineException(e); - } - } -} diff --git a/ext/jetbrick/src/main/resources/META-INF/beans.xml b/ext/jetbrick/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/jetbrick/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/jinja2/pom.xml b/ext/jinja2/pom.xml deleted file mode 100644 index 76855d8d..00000000 --- a/ext/jinja2/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - - krazo-jinja2 - jar - Eclipse Krazo Jinja2 Extension - - - - com.hubspot.jinjava - jinjava - - - diff --git a/ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/DefaultJinjavaProducer.java b/ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/DefaultJinjavaProducer.java deleted file mode 100644 index bb4af22d..00000000 --- a/ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/DefaultJinjavaProducer.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.krazo.ext.jinja2; - -import com.hubspot.jinjava.Jinjava; - -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.enterprise.inject.Produces; - -/** - * Producer for {@link com.hubspot.jinjava.Jinjava} used by {@link Jinja2ViewEngine}. - * - * @author Jeremias Weber - */ -public class DefaultJinjavaProducer { - - @Produces - @ViewEngineConfig - public Jinjava getJinjava() { - return new Jinjava(); - } - -} diff --git a/ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/Jinja2ViewEngine.java b/ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/Jinja2ViewEngine.java deleted file mode 100644 index bc8a786a..00000000 --- a/ext/jinja2/src/main/java/org/eclipse/krazo/ext/jinja2/Jinja2ViewEngine.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2021 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.jinja2; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.List; -import java.util.stream.Collectors; - -import com.hubspot.jinjava.Jinjava; -import com.hubspot.jinjava.interpret.RenderResult; -import com.hubspot.jinjava.interpret.TemplateError; - -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.ServletContext; - -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class Jinja2ViewEngine extends ViewEngineBase { - - @Inject - @ViewEngineConfig - private Jinjava jinjava; - - @Inject - private ServletContext servletContext; - - @Override - public boolean supports(String view) { - return view.endsWith(".j2") || view.endsWith(".jinja") || view.endsWith(".jinja2"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - - Charset charset = resolveCharsetAndSetContentType(context); - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset); - InputStream is = servletContext.getResourceAsStream(resolveView(context)); - InputStreamReader isr = new InputStreamReader(is, "UTF-8"); - BufferedReader reader = new BufferedReader(isr)) { - - RenderResult result = jinjava.renderForResult( - reader.lines().collect(Collectors.joining()), - new HashMap<>(context.getModels().asMap()) - ); - if (result.hasErrors()) { - throw new ViewEngineException(formatTemplateErrors(result.getErrors())); - } - - writer.write(result.getOutput()); - } catch (IOException e) { - throw new ViewEngineException(e); - } - } - - private String formatTemplateErrors(List errors) { - StringBuilder builder = new StringBuilder("Errors rendering Jinja2 Template:\n"); - for (TemplateError error : errors) { - builder.append("Severity: "); - builder.append(error.getSeverity()); - - builder.append("; Line number: "); - builder.append(error.getLineno()); - - builder.append("; Message: "); - builder.append(error.getMessage()); - builder.append("\n"); - } - return builder.toString(); - } -} diff --git a/ext/jinja2/src/main/resources/META-INF/beans.xml b/ext/jinja2/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 5602a9e2..00000000 --- a/ext/jinja2/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/ext/mustache/pom.xml b/ext/mustache/pom.xml deleted file mode 100644 index 30ef99af..00000000 --- a/ext/mustache/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - krazo-mustache - jar - Eclipse Krazo Mustache Extension - - - com.github.spullara.mustache.java - compiler - - - diff --git a/ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/DefaultMustacheFactoryProducer.java b/ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/DefaultMustacheFactoryProducer.java deleted file mode 100644 index bd61f5ec..00000000 --- a/ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/DefaultMustacheFactoryProducer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.mustache; - -import com.github.mustachejava.DefaultMustacheFactory; -import com.github.mustachejava.MustacheFactory; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; -import jakarta.servlet.ServletContext; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Producer for the MustacheFactory used by MustacheViewEngine - * - * @author Christian Kaltepoth - */ -public class DefaultMustacheFactoryProducer { - - @Inject - private ServletContext servletContext; - - @Produces - @ViewEngineConfig - public MustacheFactory getMustacheFactory() { - return new KrazoMustacheFactory(); - } - - private class KrazoMustacheFactory extends DefaultMustacheFactory { - @Override - public Reader getReader(String resourceName) { - InputStream is = servletContext.getResourceAsStream(resourceName); - if (is != null) { - return new BufferedReader(new InputStreamReader(is, UTF_8)); - } - return super.getReader(resourceName); - } - } - -} diff --git a/ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/MustacheViewEngine.java b/ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/MustacheViewEngine.java deleted file mode 100644 index 2b8eac98..00000000 --- a/ext/mustache/src/main/java/org/eclipse/krazo/ext/mustache/MustacheViewEngine.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.mustache; - -import com.github.mustachejava.Mustache; -import com.github.mustachejava.MustacheFactory; -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -/** - * Class MustacheViewEngine. - * - * @author Rodrigo Turini - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class MustacheViewEngine extends ViewEngineBase { - - @Inject - @ViewEngineConfig - private MustacheFactory factory; - - @Override - public boolean supports(String view) { - return view.endsWith(".mustache"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - - Charset charset = resolveCharsetAndSetContentType(context); - - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset)) { - - Mustache mustache = factory.compile(resolveView(context)); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", context.getRequest(HttpServletRequest.class)); - - mustache.execute(writer, model).flush(); - - } catch (IOException e) { - throw new ViewEngineException(e); - } - } - -} diff --git a/ext/mustache/src/main/resources/LICENSE.txt b/ext/mustache/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/mustache/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/mustache/src/main/resources/META-INF/beans.xml b/ext/mustache/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/mustache/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/pebble/README.md b/ext/pebble/README.md deleted file mode 100644 index 64add3c4..00000000 --- a/ext/pebble/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Pebble View Engine - -An Eclipse Krazo extension for the [Pebble Template Engine][pebble]. - -Pebble extension can be configured either by setting system properties or by creating a configuration file named `pebble.properties` on the project's classpath. System properties have higher priority and will override values set in the properties file. - -## Available properties -```properties -org.eclipse.krazo.ext.pebble.autoEscaping # true or false -org.eclipse.krazo.ext.pebble.cacheActive # true or false -org.eclipse.krazo.ext.pebble.escapingStrategy # fully qualified class name -org.eclipse.krazo.ext.pebble.defaultLocale # e.q. de -org.eclipse.krazo.ext.pebble.newLineTrimming # true or false -org.eclipse.krazo.ext.pebble.strictVariables # true or false -org.eclipse.krazo.ext.pebble.executorService # comma separated, fully qualified class names -org.eclipse.krazo.ext.pebble.tagCacheMax # e.q. 150 -org.eclipse.krazo.ext.pebble.templateCacheMax # e.q. 150 -org.eclipse.krazo.ext.pebble.extension # comma separated, fully qualified class names -``` - -Properties with value equal to empty string will be ignored. -All the default values are the same as described in Pebble's documentation except one: - -`loader` is forced to ServletLoader as it is recommended for application server usage. - -## Providing custom `PebbleEngine` -If you would like to completely override the default `PebbleEngineProducer` you can make use of the following code sample: -```java -public class CustomPebbleEngineProducer extends PebbleEngineProducer { - - @Context - ServletContext servletContext; - - @Override - @Specializes - @Produces - @ViewEngineConfig - public PebbleEngine pebbleEngine() { - return new PebbleEngine.Builder() - .loader(new ServletLoader(servletContext)) - //.autoEscaping(...) - //.addEscapingStrategy(...) - //... - .build(); - } - -} -``` - - [pebble]: https://pebbletemplates.io/ diff --git a/ext/pebble/pom.xml b/ext/pebble/pom.xml deleted file mode 100644 index 568e1b56..00000000 --- a/ext/pebble/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - - krazo-pebble - jar - Eclipse Krazo Pebble Extension - - - - io.pebbletemplates - pebble - - - - junit - junit - - - diff --git a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducer.java b/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducer.java deleted file mode 100644 index c7fb7567..00000000 --- a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducer.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Produces; -import java.io.IOException; -import java.io.InputStream; -import java.util.Objects; -import java.util.Properties; -import java.util.stream.Stream; - -@ApplicationScoped -public class PebbleConfigurationProducer { - - @Produces - public Properties pebbleConfiguration() { - Properties pebbleProperties = loadFromFile("pebble.properties"); - - Stream.of(PebbleProperty.values()) - .forEach(property - -> property.systemPropertyValue().ifPresent(value -> pebbleProperties.put(property.key(), value)) - ); - - return pebbleProperties; - } - - public Properties loadFromFile(String fileName) { - Properties props = new Properties(); - - try (InputStream config = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)) { - if (Objects.nonNull(config)) { - props.load(config); - } - } catch (IOException e) { - // ignore exception - } - - return props; - } - -} diff --git a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducer.java b/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducer.java deleted file mode 100644 index 73237105..00000000 --- a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducer.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018-2021 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import com.mitchellbosecke.pebble.PebbleEngine; -import com.mitchellbosecke.pebble.extension.Extension; -import com.mitchellbosecke.pebble.extension.escaper.EscapingStrategy; -import com.mitchellbosecke.pebble.loader.Servlet5Loader; -import java.lang.reflect.InvocationTargetException; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; -import jakarta.servlet.ServletContext; -import java.util.Locale; -import java.util.Properties; -import java.util.concurrent.ExecutorService; -import java.util.stream.Stream; - -public class PebbleEngineProducer { - - protected Properties pebbleConfiguration; - protected ServletContext servletContext; - - @Inject - public PebbleEngineProducer(Properties pebbleConfiguration, ServletContext servletContext) { - this.pebbleConfiguration = pebbleConfiguration; - this.servletContext = servletContext; - } - - protected PebbleEngineProducer(ServletContext servletContext) { - this.servletContext = servletContext; - } - - protected PebbleEngineProducer() { - } - - @Produces - @ViewEngineConfig - public PebbleEngine pebbleEngine() { - PebbleEngine.Builder engine = new PebbleEngine.Builder(); - - pebbleConfiguration - .entrySet() - .stream() - .filter(e -> String.valueOf(e.getValue()).trim().length() > 0) - .forEach((e) -> { - - String val = String.valueOf(e.getValue()); - - switch (PebbleProperty.fromKey(String.valueOf(e.getKey()))) { - case AUTO_ESCAPING: - engine.autoEscaping(Boolean.valueOf(val)); - break; - case CACHE_ACTIVE: - engine.cacheActive(Boolean.valueOf(val)); - break; - case ESCAPING_STRATEGY: - try { - String escapingStrategyKey = "userDefinedEscapingStrategy"; - engine.addEscapingStrategy(escapingStrategyKey, (EscapingStrategy) Class.forName(val).getDeclaredConstructor().newInstance()); - engine.defaultEscapingStrategy(escapingStrategyKey); - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException ex) { - String msg = String.format("Pebble initialization error: Could not register escaping strategy '%s' of type %s", String.valueOf(e.getKey()), val); - throw new IllegalArgumentException(msg, ex); - } - break; - case DEFAULT_LOCALE: - engine.defaultLocale(Locale.forLanguageTag(val)); - break; - case NEW_LINE_TRIMMING: - engine.newLineTrimming(Boolean.valueOf(val)); - break; - case STRICT_VARIABLES: - engine.strictVariables(Boolean.valueOf(val)); - break; - case EXECUTOR_SERVICE: - try { - engine.executorService((ExecutorService) Class.forName(val).getDeclaredConstructor().newInstance()); - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException ex) { - String msg = String.format("Pebble initialization error: Could not register executor service type %s", val); - throw new IllegalArgumentException(msg, ex); - } - break; - case EXTENSION: - String[] extensions = val.split(","); - - Extension[] extensionArray = Stream.of(extensions) - .map(clazzName -> { - try { - return (Extension) Class.forName(clazzName.trim()).getDeclaredConstructor().newInstance(); - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException ex) { - String msg = String.format("Pebble initialization error: Could not register extension of type %s", clazzName); - throw new IllegalArgumentException(msg, ex); - } - }).toArray(Extension[]::new); - - engine.extension(extensionArray); - break; - default: - break; - } - }); - - engine.loader(new Servlet5Loader(servletContext)); - - return engine.build(); - } - -} diff --git a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleProperty.java b/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleProperty.java deleted file mode 100644 index d0332e98..00000000 --- a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleProperty.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import java.util.Optional; -import java.util.stream.Stream; - -public enum PebbleProperty { - - AUTO_ESCAPING("autoEscaping"), - CACHE_ACTIVE("cacheActive"), - ESCAPING_STRATEGY("escapingStrategy"), - DEFAULT_LOCALE("defaultLocale"), - NEW_LINE_TRIMMING("newLineTrimming"), - STRICT_VARIABLES("strictVariables"), - EXECUTOR_SERVICE("executorService"), - EXTENSION("extension"), - UNKNOWN("unknown"); - - private static final String GROUP_PREFIX = "org.eclipse.krazo.ext.pebble."; - private final String key; - - PebbleProperty(String key) { - this.key = key; - } - - public String key() { - return GROUP_PREFIX + this.key; - } - - public static PebbleProperty fromKey(String key) { - return Stream.of(PebbleProperty.values()) - .filter(property -> property.key().equals(key)) - .findFirst() - .orElse(UNKNOWN); - } - - public Optional systemPropertyValue() { - return Optional.ofNullable(System.getProperty(this.key())); - } -} diff --git a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleViewEngine.java b/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleViewEngine.java deleted file mode 100644 index a0f2a449..00000000 --- a/ext/pebble/src/main/java/org/eclipse/krazo/ext/pebble/PebbleViewEngine.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import com.mitchellbosecke.pebble.PebbleEngine; -import com.mitchellbosecke.pebble.error.PebbleException; -import com.mitchellbosecke.pebble.template.PebbleTemplate; -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -/** - * @see Pebble - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class PebbleViewEngine extends ViewEngineBase { - - private PebbleEngine pebbleEngine; - - @SuppressWarnings("unused") - protected PebbleViewEngine() { - // needs a default constructor to make it proxyable - } - - @Inject - public PebbleViewEngine(@ViewEngineConfig PebbleEngine pebbleEngine) { - this.pebbleEngine = pebbleEngine; - } - - @Override - public boolean supports(String view) { - return view.endsWith(".peb"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - - Charset charset = resolveCharsetAndSetContentType(context); - - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset)) { - - PebbleTemplate template = pebbleEngine.getTemplate(resolveView(context)); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", context.getRequest(HttpServletRequest.class)); - - template.evaluate(writer, model); - - } catch (PebbleException | IOException ex) { - throw new ViewEngineException(String.format("Could not process view %s.", context.getView()), ex); - } - } -} diff --git a/ext/pebble/src/main/resources/META-INF/beans.xml b/ext/pebble/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/pebble/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomEscapingStrategy.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomEscapingStrategy.java deleted file mode 100644 index bf76c200..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomEscapingStrategy.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import com.mitchellbosecke.pebble.extension.escaper.EscapingStrategy; - -public class CustomEscapingStrategy implements EscapingStrategy { - - @Override - public String escape(String string) { - return string; - } -} diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExecutorService.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExecutorService.java deleted file mode 100644 index b889d981..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExecutorService.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import java.util.Collection; -import java.util.List; -import java.util.concurrent.*; - -public class CustomExecutorService implements ExecutorService { - - @Override - public void shutdown() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List shutdownNow() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isShutdown() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isTerminated() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Future submit(Callable task) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Future submit(Runnable task, T result) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Future submit(Runnable task) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List> invokeAll(Collection> tasks) throws InterruptedException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public List> invokeAll(Collection> tasks, long timeout, TimeUnit unit) throws InterruptedException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public T invokeAny(Collection> tasks) throws InterruptedException, ExecutionException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public T invokeAny(Collection> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public void execute(Runnable command) { - throw new UnsupportedOperationException("Not supported yet."); - } - -} diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionOne.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionOne.java deleted file mode 100644 index 83754ac2..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionOne.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import com.mitchellbosecke.pebble.attributes.AttributeResolver; -import com.mitchellbosecke.pebble.extension.*; -import com.mitchellbosecke.pebble.operator.BinaryOperator; -import com.mitchellbosecke.pebble.operator.UnaryOperator; -import com.mitchellbosecke.pebble.tokenParser.TokenParser; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class CustomExtensionOne implements Extension { - - @Override - public Map getFilters() { - return Collections.EMPTY_MAP; - } - - @Override - public Map getTests() { - return Collections.EMPTY_MAP; - } - - @Override - public Map getFunctions() { - return Collections.EMPTY_MAP; - } - - @Override - public List getTokenParsers() { - return Collections.EMPTY_LIST; - } - - @Override - public List getBinaryOperators() { - return Collections.EMPTY_LIST; - } - - @Override - public List getUnaryOperators() { - return Collections.EMPTY_LIST; - } - - @Override - public Map getGlobalVariables() { - return Collections.EMPTY_MAP; - } - - @Override - public List getNodeVisitors() { - return Collections.EMPTY_LIST; - } - - @Override - public List getAttributeResolver() { - return Collections.EMPTY_LIST; - } - -} diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionTwo.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionTwo.java deleted file mode 100644 index 13a40386..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/CustomExtensionTwo.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import com.mitchellbosecke.pebble.attributes.AttributeResolver; -import com.mitchellbosecke.pebble.extension.*; -import com.mitchellbosecke.pebble.operator.BinaryOperator; -import com.mitchellbosecke.pebble.operator.UnaryOperator; -import com.mitchellbosecke.pebble.tokenParser.TokenParser; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - -public class CustomExtensionTwo implements Extension { - - @Override - public Map getFilters() { - return Collections.EMPTY_MAP; - } - - @Override - public Map getTests() { - return Collections.EMPTY_MAP; - } - - @Override - public Map getFunctions() { - return Collections.EMPTY_MAP; - } - - @Override - public List getTokenParsers() { - return Collections.EMPTY_LIST; - } - - @Override - public List getBinaryOperators() { - return Collections.EMPTY_LIST; - } - - @Override - public List getUnaryOperators() { - return Collections.EMPTY_LIST; - } - - @Override - public Map getGlobalVariables() { - return Collections.EMPTY_MAP; - } - - @Override - public List getNodeVisitors() { - return Collections.EMPTY_LIST; - } - - @Override - public List getAttributeResolver() { - return Collections.EMPTY_LIST; - } -} diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducerTest.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducerTest.java deleted file mode 100644 index 66be5462..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleConfigurationProducerTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import org.junit.Before; -import org.junit.Test; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class PebbleConfigurationProducerTest { - - PebbleConfigurationProducer pebbleConfigurationProducer; - - @Before - public void setup() { - pebbleConfigurationProducer = new PebbleConfigurationProducer(); - System.clearProperty(PebbleProperty.AUTO_ESCAPING.key()); - } - - @Test - public void shouldReturnEmptyPropertiesForNonExistingPropertiesFile() { - Properties pebbleConfiguration = pebbleConfigurationProducer.loadFromFile("unexisting.properties"); - - assertNotNull(pebbleConfiguration); - assertTrue(pebbleConfiguration.isEmpty()); - } - - @Test - public void shouldLoadPebbleConfigurationPropertiesFromFile() { - Properties pebbleConfiguration = pebbleConfigurationProducer.loadFromFile("pebble.properties"); - - assertNotNull(pebbleConfiguration); - assertEquals(pebbleConfiguration.getProperty("org.eclipse.krazo.ext.pebble.autoEscaping"), "true"); - } - - @Test - public void shouldReturnPebbleConfiguration() { - Properties pebbleConfiguration = pebbleConfigurationProducer.pebbleConfiguration(); - - assertNotNull(pebbleConfiguration); - assertEquals(pebbleConfiguration.getProperty("org.eclipse.krazo.ext.pebble.autoEscaping"), "true"); - } - - @Test - public void systemPropertyShouldHaveHigherPriorityThanTheOneFromPropertyFile() { - System.setProperty(PebbleProperty.AUTO_ESCAPING.key(), "false-override"); - - Properties pebbleConfiguration = pebbleConfigurationProducer.pebbleConfiguration(); - - assertNotNull(pebbleConfiguration); - assertEquals(pebbleConfiguration.getProperty(PebbleProperty.AUTO_ESCAPING.key()), "false-override"); - } -} diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducerTest.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducerTest.java deleted file mode 100644 index bd287ab0..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleEngineProducerTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018-2021 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import com.mitchellbosecke.pebble.PebbleEngine; -import com.mitchellbosecke.pebble.extension.escaper.EscapeFilter; -import com.mitchellbosecke.pebble.loader.Servlet5Loader; -import org.junit.Before; -import org.junit.Test; - -import java.util.Locale; -import java.util.Properties; - -import static org.junit.Assert.*; - - -public class PebbleEngineProducerTest { - - Properties properties; - PebbleEngineProducer pebbleEngineProducer; - - @Before - public void setup() { - properties = new Properties(); - pebbleEngineProducer = new PebbleEngineProducer(properties, null); - } - - @Test - public void shouldCreateAnInstanceOfPebbleEngine() { - assertNotNull(pebbleEngineProducer.pebbleEngine()); - } - - @Test - public void shouldUseServletContextLoader() { - assertTrue(pebbleEngineProducer.pebbleEngine().getLoader() instanceof Servlet5Loader); - } - - @Test - public void shouldSetCorrectLocale() { - properties.put(PebbleProperty.DEFAULT_LOCALE.key(), "de"); - - assertEquals(Locale.GERMAN, pebbleEngineProducer.pebbleEngine().getDefaultLocale()); - } - - @Test - public void shouldCorrectlySetStrictVariables() { - properties.put(PebbleProperty.STRICT_VARIABLES.key(), "true"); - - assertTrue(pebbleEngineProducer.pebbleEngine().isStrictVariables()); - - properties.put(PebbleProperty.STRICT_VARIABLES.key(), "false"); - - assertFalse(pebbleEngineProducer.pebbleEngine().isStrictVariables()); - } - - @Test - public void shouldCorrectlySetExecutorService() { - properties.put(PebbleProperty.EXECUTOR_SERVICE.key(), CustomExecutorService.class.getCanonicalName()); - - assertTrue(pebbleEngineProducer.pebbleEngine().getExecutorService() instanceof CustomExecutorService); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionWhileSettingExecutorService() { - properties.put(PebbleProperty.EXECUTOR_SERVICE.key(), "org.dummy.DummyExecutorService"); - - pebbleEngineProducer.pebbleEngine(); - } - - @Test - public void shouldCorrectlySetExtensions() { - properties.put(PebbleProperty.EXTENSION.key(), String.format("%s,%s", CustomExtensionOne.class.getCanonicalName(), CustomExtensionTwo.class.getCanonicalName())); - - pebbleEngineProducer.pebbleEngine(); - - properties.put(PebbleProperty.EXTENSION.key(), String.format("%s , %s", CustomExtensionOne.class.getCanonicalName(), CustomExtensionTwo.class.getCanonicalName())); - - pebbleEngineProducer.pebbleEngine(); - } - - @Test(expected = IllegalArgumentException.class) - public void shouldThrowExceptionWhileSettingExtensions() { - properties.put(PebbleProperty.EXTENSION.key(), String.format("%s-%s", CustomExtensionOne.class.getCanonicalName(), CustomExtensionTwo.class.getCanonicalName())); - - pebbleEngineProducer.pebbleEngine(); - } - - @Test - public void shouldCorrectlySetEscapingStrategy() { - properties.put(PebbleProperty.ESCAPING_STRATEGY.key(), CustomEscapingStrategy.class.getCanonicalName()); - - PebbleEngine pebbleEngine = pebbleEngineProducer.pebbleEngine(); - EscapeFilter ef = (EscapeFilter) pebbleEngine.getExtensionRegistry().getFilter("escape"); - - assertEquals(ef.getDefaultStrategy(), "userDefinedEscapingStrategy"); - } -} diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebblePropertyTest.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebblePropertyTest.java deleted file mode 100644 index 582a3784..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebblePropertyTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import org.junit.Test; - -import java.util.stream.Stream; - -import static org.junit.Assert.*; - -public class PebblePropertyTest { - - @Test - public void propertyKeyShouldStartWithGroupPrefix() { - final String groupPrefix = "org.eclipse.krazo.ext.pebble."; - - Stream.of(PebbleProperty.values()).forEach(property -> { - assertTrue(property.key().startsWith(groupPrefix)); - }); - } - - @Test - public void shouldResolvePebblePropertyFromStringKey() { - Stream.of(PebbleProperty.values()).forEach(property -> { - assertEquals(property, PebbleProperty.fromKey(property.key())); - }); - } - - @Test - public void shouldReturnSystemPropertyValueAsOptional() { - System.setProperty(PebbleProperty.STRICT_VARIABLES.key(), "false"); - - assertEquals("false", PebbleProperty.STRICT_VARIABLES.systemPropertyValue().get()); - assertFalse(PebbleProperty.NEW_LINE_TRIMMING.systemPropertyValue().isPresent()); - } -} diff --git a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleViewEngineTest.java b/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleViewEngineTest.java deleted file mode 100644 index cd0a5a09..00000000 --- a/ext/pebble/src/test/java/org/eclipse/krazo/ext/pebble/PebbleViewEngineTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.pebble; - -import org.junit.Test; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class PebbleViewEngineTest { - - @Test - public void shouldSupportOnlyFilesWithExtensionPeb() { - PebbleViewEngine engine = new PebbleViewEngine(null); - - assertTrue(engine.supports("view.peb")); - assertFalse(engine.supports("view.txt")); - } -} diff --git a/ext/pebble/src/test/resources/pebble.properties b/ext/pebble/src/test/resources/pebble.properties deleted file mode 100644 index e1043ed3..00000000 --- a/ext/pebble/src/test/resources/pebble.properties +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.krazo.ext.pebble.autoEscaping=true diff --git a/ext/pom.xml b/ext/pom.xml deleted file mode 100644 index 659c9477..00000000 --- a/ext/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - 4.0.0 - - - org.eclipse.krazo - krazo-parent - 3.0.0-SNAPSHOT - - - org.eclipse.krazo.ext - krazo-ext-parent - pom - Eclipse Krazo Extensions Parent - - - asciidoc - freemarker - - - jade - - - mustache - stringtemplate - thymeleaf - velocity - pebble - jinja2 - - - - - - org.asciidoctor - asciidoctorj - 2.5.2 - - - - org.freemarker - freemarker - 2.3.31 - - - - de.neuland-bfi - jade4j - 1.3.2 - - - - com.hubspot.jinjava - jinjava - 2.6.0 - - - - com.github.spullara.mustache.java - compiler - 0.9.10 - - - - io.pebbletemplates - pebble - 3.1.5 - - - - org.antlr - ST4 - 4.3.1 - - - - org.thymeleaf - thymeleaf - 3.1.0.M1 - - - - org.apache.velocity - velocity-engine-core - 2.3 - compile - - - - - - - jakarta.platform - jakarta.jakartaee-api - provided - - - jakarta.mvc - jakarta.mvc-api - provided - - - org.eclipse.krazo - krazo-core - ${project.version} - provided - - - diff --git a/ext/stringtemplate/pom.xml b/ext/stringtemplate/pom.xml deleted file mode 100644 index 20e7d365..00000000 --- a/ext/stringtemplate/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - - krazo-stringtemplate - jar - Eclipse Krazo StringTemplate Extension - - - - org.antlr - ST4 - - - diff --git a/ext/stringtemplate/src/main/java/org/eclipse/krazo/ext/stringtemplate/StringTemplateViewEngine.java b/ext/stringtemplate/src/main/java/org/eclipse/krazo/ext/stringtemplate/StringTemplateViewEngine.java deleted file mode 100644 index 13efa53a..00000000 --- a/ext/stringtemplate/src/main/java/org/eclipse/krazo/ext/stringtemplate/StringTemplateViewEngine.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.stringtemplate; - -import org.eclipse.krazo.engine.ViewEngineBase; -import org.stringtemplate.v4.*; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.*; -import jakarta.servlet.ServletContext; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.regex.Matcher; - -import static java.util.regex.Pattern.compile; - -/** - * Class StringTemplateViewEngine. - * - * @author Rodrigo Turini - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class StringTemplateViewEngine extends ViewEngineBase { - - @Inject - private ServletContext servletContext; - - @Override - public boolean supports(String view) { - return view.endsWith(".st"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - ST stringTemplate = getStringTemplate(resolveView(context)); - context.getModels().asMap().forEach((key, value) -> add(key, value, stringTemplate)); - Charset charset = resolveCharsetAndSetContentType(context); - try(Writer writer = new OutputStreamWriter(context.getOutputStream(), charset)) { - stringTemplate.write(new AutoIndentWriter(writer)); - stringTemplate.render(); - } catch (Exception e) { - throw new ViewEngineException(e); - } - } - - private void add(String key, Object value, ST template) { - if (template.getAttributes().containsKey(key)) template.add(key, value); - } - - public ST getStringTemplate(String resolvedView) throws ViewEngineException { - Matcher matcher = compile("(.+)/(.+)\\.st").matcher(resolvedView); - if (matcher.find()) { - String viewFolder = servletContext.getRealPath(matcher.group(1)); - String viewName = matcher.group(2); - STGroup stGroup = new STGroupDir(viewFolder, '$', '$'); - stGroup.registerRenderer(String.class, new StringRenderer()); - ST template = stGroup.getInstanceOf(viewName); - if (template != null) return template; - } - throw new ViewEngineException("Couldn't find view " + resolvedView); - } -} diff --git a/ext/stringtemplate/src/main/resources/LICENSE.txt b/ext/stringtemplate/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/stringtemplate/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/stringtemplate/src/main/resources/META-INF/beans.xml b/ext/stringtemplate/src/main/resources/META-INF/beans.xml deleted file mode 100644 index f90bbb57..00000000 --- a/ext/stringtemplate/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/ext/thymeleaf/pom.xml b/ext/thymeleaf/pom.xml deleted file mode 100644 index 93473366..00000000 --- a/ext/thymeleaf/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - krazo-thymeleaf - jar - Eclipse Krazo Thymeleaf Extension - - - org.thymeleaf - thymeleaf - - - diff --git a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/CDIWebContext.java b/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/CDIWebContext.java deleted file mode 100644 index 7142a804..00000000 --- a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/CDIWebContext.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2022 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.thymeleaf; - -import org.thymeleaf.context.IWebContext; -import org.thymeleaf.context.LazyContextVariable; -import org.thymeleaf.web.IWebExchange; - -import jakarta.enterprise.context.spi.CreationalContext; -import jakarta.enterprise.inject.Any; -import jakarta.enterprise.inject.spi.Bean; -import jakarta.enterprise.inject.spi.BeanManager; -import jakarta.enterprise.util.AnnotationLiteral; -import java.util.*; -import java.util.stream.Collectors; - -/** - * Thymeleaf context for resolving variables from the model or cdi context. In addition to the functions provided by - * {@link org.thymeleaf.context.WebContext} this allows to resolve beans annotated with {@linkplain jakarta.inject.Named} - * from the cdi context. - *

- * Beans will be resolved in this order: - *

    - *
  1. special variables (like "request")
  2. - *
  3. variables from the model
  4. - *
  5. named beans from the cdi context
  6. - *
- *

- * - * @author Gregor Tudan - */ -class CDIWebContext implements IWebContext { - - private final IWebExchange exchange; - private final Locale locale; - - private final BeanManager beanManager; - private final Set cdiNamedBeans; - - /** keeps track of creational contexts, so beans can get disposed by calling {@link #close()} */ - private final Queue> contexts = new LinkedList<>(); - - private final Map variables = new HashMap<>(); - - CDIWebContext(BeanManager beanManager, IWebExchange exchange, Locale locale) { - this.beanManager = beanManager; - this.exchange = exchange; - this.locale = locale; - this.cdiNamedBeans = enumerateNamedBeans(); - } - - @SuppressWarnings("serial") - private Set enumerateNamedBeans() { - Set> beans = beanManager.getBeans(Object.class, new AnnotationLiteral() { - }); - return beans.stream().map(Bean::getName).filter(Objects::nonNull).collect(Collectors.toSet()); - } - - @Override - public Locale getLocale() { - return locale; - } - - @Override - public boolean containsVariable(String name) { - Objects.requireNonNull(name, "The variable name must not be null"); - if (variables.containsKey(name)) { - return true; - } - return cdiNamedBeans.contains(name); - } - - @Override - public Set getVariableNames() { - final Set variableNames = new HashSet<>(variables.keySet()); - variableNames.addAll(this.cdiNamedBeans); - return variableNames; - } - - @Override - public Object getVariable(String name) { - Objects.requireNonNull(name, "The variable name must not be null"); - if (variables.containsKey(name)) { - return variables.get(name); - } else if (cdiNamedBeans.contains(name)) { - return getCdiBean(name); - } else { - return null; - } - } - - private Object getCdiBean(String name) { - return new LazyContextVariable() { - @Override - protected Object loadValue() { - jakarta.enterprise.inject.spi.Bean bean = beanManager.getBeans(name).iterator().next(); - CreationalContext ctx = beanManager.createCreationalContext(bean); - // push the context a list so they can be disposed after the template has been processed - contexts.add(ctx); - return beanManager.getReference(bean, bean.getBeanClass(), ctx); - } - }; - } - - void setVariables(Map variables) { - this.variables.clear(); - if (variables != null) { - this.variables.putAll(variables); - } - } - - /** - * Dispose all CDI creational contexts to depdenent scoped beans get disposed. - *

- * MUST be called after the template has been processed - */ - void close() { - for (CreationalContext ctx : contexts) { - ctx.release(); - } - } - - @Override - public IWebExchange getExchange() { - return this.exchange; - } -} diff --git a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultJakartaServletWebApplicationWrapperProducer.java b/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultJakartaServletWebApplicationWrapperProducer.java deleted file mode 100644 index 9a871d00..00000000 --- a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultJakartaServletWebApplicationWrapperProducer.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2022 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.thymeleaf; - -import org.thymeleaf.web.servlet.JakartaServletWebApplication; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; -import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; - -public class DefaultJakartaServletWebApplicationWrapperProducer { - - @Inject - private HttpServletRequest request; - - @Produces - @ApplicationScoped - public JakartaServletWebApplicationWrapper getJakartaServletWebApplicationWrapper() { - return new JakartaServletWebApplicationWrapper() { - private final JakartaServletWebApplication application = create(); - - @Override - public JakartaServletWebApplication get() { - return application; - } - - private JakartaServletWebApplication create() { - final ServletContext servletContext = request.getServletContext(); - return JakartaServletWebApplication.buildApplication(servletContext); - } - }; - } - -} diff --git a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultTemplateEngineProducer.java b/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultTemplateEngineProducer.java deleted file mode 100644 index 1ee14bb3..00000000 --- a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/DefaultTemplateEngineProducer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2022 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.thymeleaf; - -import org.eclipse.krazo.engine.ViewEngineConfig; -import org.thymeleaf.TemplateEngine; -import org.thymeleaf.templateresolver.WebApplicationTemplateResolver; -import org.thymeleaf.web.servlet.IServletWebApplication; -import org.thymeleaf.templateresolver.ITemplateResolver; - -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; - -/** - * Producer for the TemplateEngine used by ThymeleafViewEngine. - * - * @author Christian Kaltepoth - * @author Eddú Meléndez - */ -public class DefaultTemplateEngineProducer { - - @Inject - private JakartaServletWebApplicationWrapper applicationWrapper; - - @Produces - @ViewEngineConfig - public TemplateEngine getTemplateEngine() { - - IServletWebApplication servletApplication = applicationWrapper.get(); - ITemplateResolver resolver = new WebApplicationTemplateResolver(servletApplication); - - TemplateEngine engine = new TemplateEngine(); - engine.setTemplateResolver(resolver); - return engine; - - } - -} diff --git a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/JakartaServletWebApplicationWrapper.java b/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/JakartaServletWebApplicationWrapper.java deleted file mode 100644 index 203b917e..00000000 --- a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/JakartaServletWebApplicationWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2022 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.thymeleaf; - -import org.thymeleaf.web.servlet.JakartaServletWebApplication; - -/** - * Wrapper to circumvent {@link JakartaServletWebApplication} not being proxiable by CDI (because of it being final). - * - * @author Jeremias Weber - */ -public interface JakartaServletWebApplicationWrapper { - - public JakartaServletWebApplication get(); - -} diff --git a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/ThymeleafViewEngine.java b/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/ThymeleafViewEngine.java deleted file mode 100644 index ebb2df30..00000000 --- a/ext/thymeleaf/src/main/java/org/eclipse/krazo/ext/thymeleaf/ThymeleafViewEngine.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2022 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.thymeleaf; - -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; -import org.thymeleaf.TemplateEngine; -import org.thymeleaf.web.IWebExchange; -import org.thymeleaf.web.servlet.JakartaServletWebApplication; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.spi.BeanManager; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -/** - * Class Thymeleaf ViewEngine. - * - * @author Rodrigo Turini - * @author Gregor Tudan - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class ThymeleafViewEngine extends ViewEngineBase { - - @Inject - private JakartaServletWebApplicationWrapper applicationWrapper; - - @Inject - private BeanManager beanManager; - - @Inject - @ViewEngineConfig - private TemplateEngine engine; - - @Override - public boolean supports(String view) { - return view.endsWith(".html"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - try { - HttpServletRequest request = context.getRequest(HttpServletRequest.class); - HttpServletResponse response = context.getResponse(HttpServletResponse.class); - - JakartaServletWebApplication servletApplication = applicationWrapper.get(); - IWebExchange exchange = servletApplication.buildExchange(request, response); - - CDIWebContext ctx = new CDIWebContext(beanManager, exchange, context.getLocale()); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", request); - ctx.setVariables(model); - - try { - engine.process(resolveView(context), ctx, response.getWriter()); - response.flushBuffer(); - } finally { - ctx.close(); - } - } catch (IOException e) { - throw new ViewEngineException(e); - } - } - -} diff --git a/ext/thymeleaf/src/main/resources/LICENSE.txt b/ext/thymeleaf/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/thymeleaf/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/thymeleaf/src/main/resources/META-INF/beans.xml b/ext/thymeleaf/src/main/resources/META-INF/beans.xml deleted file mode 100644 index b17f1315..00000000 --- a/ext/thymeleaf/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/ext/velocity/pom.xml b/ext/velocity/pom.xml deleted file mode 100644 index f3a68cd1..00000000 --- a/ext/velocity/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 4.0.0 - - org.eclipse.krazo.ext - krazo-ext-parent - 3.0.0-SNAPSHOT - - - krazo-velocity - jar - Eclipse Krazo Velocity Extension - - - - org.apache.velocity - velocity-engine-core - - - diff --git a/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/DefaultVelocityEngineProducer.java b/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/DefaultVelocityEngineProducer.java deleted file mode 100644 index a93e0fc3..00000000 --- a/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/DefaultVelocityEngineProducer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.velocity; - -import org.apache.velocity.app.VelocityEngine; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; -import jakarta.servlet.ServletContext; - -/** - * Producer for the VelocityEngine used by VelocityViewEngine. - * - * @author Christian Kaltepoth - */ -public class DefaultVelocityEngineProducer { - - @Inject - private ServletContext servletContext; - - @Produces - @ViewEngineConfig - public VelocityEngine getVelocityEngine() { - VelocityEngine velocityEngine = new VelocityEngine(); - velocityEngine.setProperty("resource.loader", "webapp"); - velocityEngine.setProperty("webapp.resource.loader.class", ServletContextResourceLoader.class.getCanonicalName()); - velocityEngine.setApplicationAttribute("jakarta.servlet.ServletContext", servletContext); - velocityEngine.init(); - return velocityEngine; - } - -} diff --git a/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/ServletContextResourceLoader.java b/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/ServletContextResourceLoader.java deleted file mode 100644 index a8145351..00000000 --- a/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/ServletContextResourceLoader.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright © 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package org.eclipse.krazo.ext.velocity; - -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.runtime.resource.Resource; -import org.apache.velocity.runtime.resource.loader.ResourceLoader; -import org.apache.velocity.util.ExtProperties; - -import jakarta.servlet.ServletContext; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.UnsupportedEncodingException; - -/** - * Simple implementation of {@link ResourceLoader} for loading resources from {@link ServletContext} - * - * @author Christian Kaltepoth - */ -public class ServletContextResourceLoader extends ResourceLoader { - - private ServletContext servletContext; - - @Override - public void init(ExtProperties configuration) { - servletContext = (ServletContext) rsvc.getApplicationAttribute(ServletContext.class.getName()); - } - - @Override - public Reader getResourceReader(String source, String encoding) throws ResourceNotFoundException { - try { - - InputStream stream = servletContext.getResourceAsStream(source); - if (stream != null) { - return new InputStreamReader(stream, encoding); - } - return null; - - } catch (UnsupportedEncodingException e) { - throw new IllegalStateException(e); - } - } - - @Override - public boolean isSourceModified(Resource resource) { - return false; - } - - @Override - public long getLastModified(Resource resource) { - return 0; - } - -} diff --git a/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/VelocityViewEngine.java b/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/VelocityViewEngine.java deleted file mode 100644 index 8a4d3ebe..00000000 --- a/ext/velocity/src/main/java/org/eclipse/krazo/ext/velocity/VelocityViewEngine.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.ext.velocity; - -import org.apache.velocity.Template; -import org.apache.velocity.VelocityContext; -import org.apache.velocity.app.VelocityEngine; -import org.eclipse.krazo.engine.ViewEngineBase; -import org.eclipse.krazo.engine.ViewEngineConfig; - -import jakarta.annotation.Priority; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.mvc.engine.ViewEngine; -import jakarta.mvc.engine.ViewEngineContext; -import jakarta.mvc.engine.ViewEngineException; -import jakarta.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; - -/** - * Class VelocityViewEngine. - * - * @author Rodrigo Turini - */ -@ApplicationScoped -@Priority(ViewEngine.PRIORITY_FRAMEWORK) -public class VelocityViewEngine extends ViewEngineBase { - - @Inject - @ViewEngineConfig - private VelocityEngine velocityEngine; - - @Override - public boolean supports(String view) { - return view.endsWith(".vm") || view.endsWith(".vhtml"); - } - - @Override - public void processView(ViewEngineContext context) throws ViewEngineException { - - Charset charset = resolveCharsetAndSetContentType(context); - - try (Writer writer = new OutputStreamWriter(context.getOutputStream(), charset)) { - - Template template = velocityEngine.getTemplate(resolveView(context)); - - Map model = new HashMap<>(context.getModels().asMap()); - model.put("request", context.getRequest(HttpServletRequest.class)); - VelocityContext velocityContext = new VelocityContext(model); - - template.merge(velocityContext, writer); - - } catch (IOException e) { - throw new ViewEngineException(e); - } - } -} diff --git a/ext/velocity/src/main/resources/LICENSE.txt b/ext/velocity/src/main/resources/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/ext/velocity/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/ext/velocity/src/main/resources/META-INF/beans.xml b/ext/velocity/src/main/resources/META-INF/beans.xml deleted file mode 100644 index 63cfccd6..00000000 --- a/ext/velocity/src/main/resources/META-INF/beans.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - diff --git a/pom.xml b/pom.xml index 1da0825b..4012af4c 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,6 @@ jersey resteasy tck - ext examples testsuite documentation diff --git a/testsuite/pom.xml b/testsuite/pom.xml index 277c2b83..609f99c9 100644 --- a/testsuite/pom.xml +++ b/testsuite/pom.xml @@ -48,69 +48,6 @@ import pom - - - - - org.eclipse.krazo.ext - krazo-thymeleaf - ${project.version} - - - org.eclipse.krazo.ext - krazo-velocity - ${project.version} - - - org.eclipse.krazo.ext - krazo-freemarker - ${project.version} - - - org.eclipse.krazo.ext - krazo-handlebars - ${project.version} - - - org.eclipse.krazo.ext - krazo-mustache - ${project.version} - - - org.eclipse.krazo.ext - krazo-asciidoc - ${project.version} - - - org.eclipse.krazo.ext - krazo-pebble - ${project.version} - - - org.eclipse.krazo.ext - krazo-jade - ${project.version} - - - org.eclipse.krazo.ext - krazo-jsr223 - ${project.version} - - - org.eclipse.krazo.ext - krazo-jetbrick - ${project.version} - - - org.eclipse.krazo.ext - krazo-stringtemplate - ${project.version} - - - org.eclipse.krazo.ext - krazo-jinja2 - ${project.version} - @@ -164,13 +101,6 @@ net.sourceforge.htmlunit htmlunit - - - - de.neuland-bfi - jade4j - 1.3.2 - diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/HelloController.java deleted file mode 100644 index 10e8075b..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/HelloController.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.asciidoc; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * HelloController test. - * - * @author Santiago Pericas-Geertsen - */ -@Path("hello") -public class HelloController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("hello.adoc") - public void hello(@QueryParam("user") String user) { - models.put("user", user); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/MyApplication.java deleted file mode 100644 index 84a019e1..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/asciidoc/MyApplication.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.asciidoc; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Ricardo Arguello - */ -@ApplicationPath("resources") -public class MyApplication extends Application { -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/HelloController.java deleted file mode 100644 index 7af04950..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/HelloController.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.freemarker; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * HelloController test. - * - * @author Santiago Pericas-Geertsen - */ -@Path("hello") -public class HelloController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("hello.ftl") - public void hello(@QueryParam("user") String user) { - models.put("user", user); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/MyApplication.java deleted file mode 100644 index e20d90b6..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/freemarker/MyApplication.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.freemarker; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Santiago Pericas-Geertsen - */ -@ApplicationPath("resources") -public class MyApplication extends Application { -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/MyApplication.java deleted file mode 100644 index 279cd365..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/MyApplication.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.handlebars; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Rahman Usta - */ -@ApplicationPath("resources") -public class MyApplication extends Application { -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/Person.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/Person.java deleted file mode 100644 index e56a643b..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/Person.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.handlebars; - -/** - * Person model. - * - * @author Rahman Usta - */ -public class Person { - - private String name; - private String surname; - private Integer age; - - public Person() { - } - - public Person(String name, String surname, Integer age) { - this.name = name; - this.surname = surname; - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSurname() { - return surname; - } - - public void setSurname(String surname) { - this.surname = surname; - } - - public Integer getAge() { - return age; - } - - public void setAge(Integer age) { - this.age = age; - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/PersonController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/PersonController.java deleted file mode 100644 index 0e4bda61..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/handlebars/PersonController.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.handlebars; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; - -/** - * PersonController test. - * - * @author Rahman Usta - */ -@Path("person") -@Controller -public class PersonController { - - @Inject - private Models models; - - @GET - @Produces("text/html;Charset=UTF-8") - @View("person.hbs") - public void person() { - - Person person = new Person(); - person.setName("Hüseyin"); - person.setSurname("Akdoğan"); - person.setAge(35); - - models.put("person", person); - } - -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/DummyFilter.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/DummyFilter.java deleted file mode 100644 index 74293647..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/DummyFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jade; - -import de.neuland.jade4j.filter.Filter; -import de.neuland.jade4j.parser.node.Attr; -import java.util.List; - -import java.util.Map; - -/** - * Used to test if configuration works. - * - * @author Florian Hirsch - */ -public class DummyFilter implements Filter { - - @Override - public String convert(String source, List attributes, Map model) { - String content = source.trim(); - return String.format("

%s

", content, content); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeApplication.java deleted file mode 100644 index cb5bba35..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeApplication.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jade; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.HashSet; -import java.util.Set; - -/** - * @author Florian Hirsch - */ -@ApplicationPath("/jade") -public class JadeApplication extends Application { - - - public JadeApplication() { - // Register a filter to test if configuration via SystemProperties works - String filterName = String.format("%s.%s", "org.eclipse.krazo.ext.jade.filter", "systemProperties"); - System.setProperty(filterName, DummyFilter.class.getName()); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeController.java deleted file mode 100644 index 5290444c..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/JadeController.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jade; - -import jakarta.inject.Inject; -import jakarta.mvc.Models; -import jakarta.mvc.Controller; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.QueryParam; - -/** - * @author Florian Hirsch - */ -@Path("/") -@Controller -public class JadeController { - - @Inject - private Models models; - - @GET - @Controller - @View("main.jade") - public void get(@QueryParam("user") String user) { - models.put("user", user); - models.put("pageName", "Hello Jade"); - } - - @GET - @Path("/markdown") - @Controller - @View("markdown.jade") - public void getMarkdownd(@QueryParam("article") String article) { - models.put("pageName", "Markdown Introduction"); - } - - @GET - @Path("/config") - @Controller - @View("config.jade") - public void getCofig(@QueryParam("article") String article) { - models.put("pageName", "Configuration"); - } - - @GET - @Path("/helper") - @Controller - @View("helper.jade") - public void getCofig() { - models.put("pageName", "Helper"); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/MathHelper.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/MathHelper.java deleted file mode 100644 index c7b69661..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jade/MathHelper.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jade; - -/** - * A MathHelper (registered via jade.properties) - * - * @author Florian Hirsch - */ -public class MathHelper { - - public long round(double number) { - return Math.round(number); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/HelloController.java deleted file mode 100644 index 62cc6604..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/HelloController.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jetbrick; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * HelloController test. - * - * @author Daniel Dias - */ -@Path("hello") -public class HelloController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("hello.jetx") - public void hello(@QueryParam("user") String user) { - models.put("user", user); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/MyApplication.java deleted file mode 100644 index a5f12da3..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jetbrick/MyApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jetbrick; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Daniel Dias - */ -@ApplicationPath("resources") -public class MyApplication extends Application { - -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/HelloController.java deleted file mode 100644 index 88c43cc7..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/HelloController.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2021 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jinja2; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -@Path("hello") -public class HelloController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("hello.j2") - public void hello(@QueryParam("user") String user) { - models.put("user", user); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/MyApplication.java deleted file mode 100644 index 91cf28d0..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jinja2/MyApplication.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2021 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jinja2; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; - -@ApplicationPath("resources") -public class MyApplication extends Application { - -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/Jsr223Application.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/Jsr223Application.java deleted file mode 100644 index 8364dff8..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/Jsr223Application.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jsr223; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.HashSet; -import java.util.Set; - -/** - * A JSR-223 application. - * - * @author Manfred Riem (manfred.riem@oracle.com) - */ -@ApplicationPath("mvc") -public class Jsr223Application extends Application { - -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/JythonController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/JythonController.java deleted file mode 100644 index 3a45d154..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/JythonController.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jsr223; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * A Jython controller. - * - * @author Manfred Riem (manfred.riem@oracle.com) - */ -@Path("jython") -public class JythonController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("index.py") - public void index(@QueryParam("name") String name) { - models.put("name", name); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/NashornController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/NashornController.java deleted file mode 100644 index 4ef72709..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/jsr223/NashornController.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.jsr223; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * A Nashorn controller. - * - * @author Manfred Riem (manfred.riem@oracle.com) - */ -@Path("nashorn") -public class NashornController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("index.js") - public void index(@QueryParam("name") String name) { - models.put("name", name); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/HelloController.java deleted file mode 100644 index f3a2f07e..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/HelloController.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.mustache; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * HelloController test. - * - * @author Rodrigo Turini - */ -@Path("hello") -public class HelloController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("hello.mustache") - public void hello(@QueryParam("user") String user) { - models.put("user", user); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/MyApplication.java deleted file mode 100644 index 8ff084ce..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/mustache/MyApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.mustache; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Rodrigo Turini - */ -@ApplicationPath("resources") -public class MyApplication extends Application { - -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleApplication.java deleted file mode 100644 index be8ed7d6..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleApplication.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.pebble; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; - -@ApplicationPath("pebble") -public class PebbleApplication extends Application { -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleController.java deleted file mode 100644 index ee290643..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/pebble/PebbleController.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.pebble; - -import jakarta.inject.Inject; -import jakarta.mvc.Models; -import jakarta.mvc.Controller; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -@Path("") -@Controller -public class PebbleController { - - @Inject - Models models; - - @GET - @View("home.peb") - public void home() { - models.put("websiteTitle", "Pebble's home page"); - models.put("content", "Rock solid!"); - } - - @GET - @Path("filter") - @View("filter.peb") - public void filter() { - models.put("text", "To be filtered"); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/HelloController.java deleted file mode 100644 index 1cc33c2b..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/HelloController.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.stringtemplate; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.*; - -/** - * HelloController test. - * - * @author Rodrigo Turini - */ -@Path("hello") -public class HelloController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("hello.st") - public void hello(@QueryParam("user") String user) { - models.put("user", user); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/MyApplication.java deleted file mode 100644 index a263d5b2..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/stringtemplate/MyApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.stringtemplate; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Rodrigo Turini - */ -@ApplicationPath("resources") -public class MyApplication extends Application { - -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/Greeting.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/Greeting.java deleted file mode 100644 index 04d74c74..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/Greeting.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.thymeleaf; - -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Named; - -/** - * @author Gregor Tudan - */ -@RequestScoped -@Named("greeting") -public class Greeting { - - private String user; - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/HelloController.java deleted file mode 100644 index 0910f52a..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/HelloController.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.thymeleaf; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * HelloController test. - * - * @author Rodrigo Turini - */ -@Path("hello") -public class HelloController { - - @Inject - private Greeting greeting; - - @GET - @Controller - @Produces("text/html") - @View("hello.html") - public void hello(@QueryParam("user") String user) { - greeting.setUser(user); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/MyApplication.java deleted file mode 100644 index 55ac998e..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/thymeleaf/MyApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.thymeleaf; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Rodrigo Turini - */ -@ApplicationPath("resources") -public class MyApplication extends Application { - -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/HelloController.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/HelloController.java deleted file mode 100644 index 847c66e6..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/HelloController.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.velocity; - -import jakarta.inject.Inject; -import jakarta.mvc.Controller; -import jakarta.mvc.Models; -import jakarta.mvc.View; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; - -/** - * HelloController test. - * - * @author Rodrigo Turini - */ -@Path("hello") -public class HelloController { - - @Inject - private Models models; - - @GET - @Controller - @Produces("text/html") - @View("hello.vm") - @Path("v1") - public void hello(@QueryParam("user") String user) { - models.put("user", user); - } - - @GET - @Controller - @Produces("text/html") - @View("hello2.vhtml") - @Path("v2") - public void hello2(@QueryParam("user2") String user2) { - models.put("user2", user2); - } -} diff --git a/testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/MyApplication.java b/testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/MyApplication.java deleted file mode 100644 index 47b0c9cf..00000000 --- a/testsuite/src/main/java/org/eclipse/krazo/test/ext/velocity/MyApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext.velocity; - -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Application; -import java.util.Collections; -import java.util.Set; - -/** - * Class MyApplication. - * - * @author Rodrigo Turini - */ -@ApplicationPath("resources") -public class MyApplication extends Application { - -} diff --git a/testsuite/src/main/resources/asciidoc/views/hello.adoc b/testsuite/src/main/resources/asciidoc/views/hello.adoc deleted file mode 100644 index 0d9775ff..00000000 --- a/testsuite/src/main/resources/asciidoc/views/hello.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= AsciiDoc Test - -== Hello {user} diff --git a/testsuite/src/main/resources/freemarker/views/hello.ftl b/testsuite/src/main/resources/freemarker/views/hello.ftl deleted file mode 100644 index 2de02802..00000000 --- a/testsuite/src/main/resources/freemarker/views/hello.ftl +++ /dev/null @@ -1,9 +0,0 @@ - - - Hello There - - - -

Hello ${user?html}!

- - \ No newline at end of file diff --git a/testsuite/src/main/resources/handlebars/views/head.hbs b/testsuite/src/main/resources/handlebars/views/head.hbs deleted file mode 100644 index 6cea1906..00000000 --- a/testsuite/src/main/resources/handlebars/views/head.hbs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/testsuite/src/main/resources/handlebars/views/person.hbs b/testsuite/src/main/resources/handlebars/views/person.hbs deleted file mode 100644 index 8dab4e42..00000000 --- a/testsuite/src/main/resources/handlebars/views/person.hbs +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Person View - {{> head}} - - -

Person

-
{{person.name}}
-
{{person.surname}}
-
{{person.age}}
- - diff --git a/testsuite/src/main/resources/jade/jade.properties b/testsuite/src/main/resources/jade/jade.properties deleted file mode 100644 index 5a1513b7..00000000 --- a/testsuite/src/main/resources/jade/jade.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.eclipse.krazo.ext.jade.prettyPrint=true -org.eclipse.krazo.ext.jade.filter.configFile=org.eclipse.krazo.test.ext.jade.DummyFilter -org.eclipse.krazo.ext.jade.filter.markdown=de.neuland.jade4j.filter.MarkdownFilter -org.eclipse.krazo.ext.jade.helper.math=org.eclipse.krazo.test.ext.jade.MathHelper diff --git a/testsuite/src/main/resources/jade/views/config.jade b/testsuite/src/main/resources/jade/views/config.jade deleted file mode 100644 index 154f45b4..00000000 --- a/testsuite/src/main/resources/jade/views/config.jade +++ /dev/null @@ -1,10 +0,0 @@ -doctype html -html - head - title= pageName - link(rel='stylesheet', href='#{request.contextPath}/krazo.css') - body - :systemProperties - SystemProperties - :configFile - ConfigFile \ No newline at end of file diff --git a/testsuite/src/main/resources/jade/views/helper.jade b/testsuite/src/main/resources/jade/views/helper.jade deleted file mode 100644 index 76134ea5..00000000 --- a/testsuite/src/main/resources/jade/views/helper.jade +++ /dev/null @@ -1,9 +0,0 @@ -doctype html -html - head - title= pageName - link(rel='stylesheet', href='#{request.contextPath}/krazo.css') - body - h1 Hello Helper - p.result= math.round(3.14159) - include includes/footer.jade \ No newline at end of file diff --git a/testsuite/src/main/resources/jade/views/includes/footer.jade b/testsuite/src/main/resources/jade/views/includes/footer.jade deleted file mode 100644 index 36b5634c..00000000 --- a/testsuite/src/main/resources/jade/views/includes/footer.jade +++ /dev/null @@ -1,2 +0,0 @@ -#footer - p.footer Copyright (c) Eclipse Krazo committers and contributors \ No newline at end of file diff --git a/testsuite/src/main/resources/jade/views/main.jade b/testsuite/src/main/resources/jade/views/main.jade deleted file mode 100644 index 752d584c..00000000 --- a/testsuite/src/main/resources/jade/views/main.jade +++ /dev/null @@ -1,8 +0,0 @@ -doctype html -html - head - title= pageName - link(rel='stylesheet', href='#{request.contextPath}/krazo.css') - body - h1 Hello #{user} - include includes/footer.jade \ No newline at end of file diff --git a/testsuite/src/main/resources/jade/views/markdown.jade b/testsuite/src/main/resources/jade/views/markdown.jade deleted file mode 100644 index 184abe87..00000000 --- a/testsuite/src/main/resources/jade/views/markdown.jade +++ /dev/null @@ -1,15 +0,0 @@ -doctype html -html - head - title= pageName - link(rel='stylesheet', href='#{request.contextPath}/krazo.css') - body - :markdown - # Mardown introduction - - This is **bold** and this _italic_ text. - - ## This is how you make a list - * one - * two - * three \ No newline at end of file diff --git a/testsuite/src/main/resources/jetbrick/views/hello.jetx b/testsuite/src/main/resources/jetbrick/views/hello.jetx deleted file mode 100644 index 735af5e0..00000000 --- a/testsuite/src/main/resources/jetbrick/views/hello.jetx +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Hello - - - -

Hello ${user}!

- - \ No newline at end of file diff --git a/testsuite/src/main/resources/jinja2/views/hello.j2 b/testsuite/src/main/resources/jinja2/views/hello.j2 deleted file mode 100644 index df6784ed..00000000 --- a/testsuite/src/main/resources/jinja2/views/hello.j2 +++ /dev/null @@ -1,11 +0,0 @@ - - - Hello - - - -

Hello {{ user }}

- - - - diff --git a/testsuite/src/main/resources/jsr223/views/index.js b/testsuite/src/main/resources/jsr223/views/index.js deleted file mode 100644 index 9aac94dc..00000000 --- a/testsuite/src/main/resources/jsr223/views/index.js +++ /dev/null @@ -1 +0,0 @@ -'Hello ' + models.mvc.encoders.html(models['name']); \ No newline at end of file diff --git a/testsuite/src/main/resources/jsr223/views/index.py b/testsuite/src/main/resources/jsr223/views/index.py deleted file mode 100644 index c2d459da..00000000 --- a/testsuite/src/main/resources/jsr223/views/index.py +++ /dev/null @@ -1 +0,0 @@ -'Hello ' + models['mvc'].encoders.html(models['name']) \ No newline at end of file diff --git a/testsuite/src/main/resources/jtwig/views/hello.twig.html b/testsuite/src/main/resources/jtwig/views/hello.twig.html deleted file mode 100644 index a4e2d8aa..00000000 --- a/testsuite/src/main/resources/jtwig/views/hello.twig.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Hello - - - -

Hello {{ user }}

- - \ No newline at end of file diff --git a/testsuite/src/main/resources/mustache/views/hello.mustache b/testsuite/src/main/resources/mustache/views/hello.mustache deleted file mode 100644 index 8bafd7d9..00000000 --- a/testsuite/src/main/resources/mustache/views/hello.mustache +++ /dev/null @@ -1,9 +0,0 @@ - - - Hello - - - -

Hello {{user}}!

- - diff --git a/testsuite/src/main/resources/pebble/pebble.properties b/testsuite/src/main/resources/pebble/pebble.properties deleted file mode 100644 index ad31c425..00000000 --- a/testsuite/src/main/resources/pebble/pebble.properties +++ /dev/null @@ -1 +0,0 @@ -org.eclipse.krazo.ext.pebble.autoEscaping=false diff --git a/testsuite/src/main/resources/pebble/views/filter.peb b/testsuite/src/main/resources/pebble/views/filter.peb deleted file mode 100644 index 4f01a23c..00000000 --- a/testsuite/src/main/resources/pebble/views/filter.peb +++ /dev/null @@ -1,5 +0,0 @@ - - - {{ text | upper }} - - \ No newline at end of file diff --git a/testsuite/src/main/resources/pebble/views/home.peb b/testsuite/src/main/resources/pebble/views/home.peb deleted file mode 100644 index 83e5fa01..00000000 --- a/testsuite/src/main/resources/pebble/views/home.peb +++ /dev/null @@ -1,8 +0,0 @@ - - - {{ websiteTitle }} - - - {{ content }} - - \ No newline at end of file diff --git a/testsuite/src/main/resources/stringtemplate/views/hello.st b/testsuite/src/main/resources/stringtemplate/views/hello.st deleted file mode 100644 index 64e886d2..00000000 --- a/testsuite/src/main/resources/stringtemplate/views/hello.st +++ /dev/null @@ -1,13 +0,0 @@ -hello(user, mvc) ::= << - - - - Hello - - - -

Hello $user; format="xml-encode"$!

- - - ->> \ No newline at end of file diff --git a/testsuite/src/main/resources/thymeleaf/views/hello.html b/testsuite/src/main/resources/thymeleaf/views/hello.html deleted file mode 100644 index 89014ae9..00000000 --- a/testsuite/src/main/resources/thymeleaf/views/hello.html +++ /dev/null @@ -1,11 +0,0 @@ - - - Hello - - - -

Hello !

- - - - diff --git a/testsuite/src/main/resources/velocity/views/hello.vm b/testsuite/src/main/resources/velocity/views/hello.vm deleted file mode 100644 index b4c233f5..00000000 --- a/testsuite/src/main/resources/velocity/views/hello.vm +++ /dev/null @@ -1,9 +0,0 @@ - - - Hello - - - -

Hello $mvc.encoders.html($user)!

- - \ No newline at end of file diff --git a/testsuite/src/main/resources/velocity/views/hello2.vhtml b/testsuite/src/main/resources/velocity/views/hello2.vhtml deleted file mode 100644 index 6f0c2245..00000000 --- a/testsuite/src/main/resources/velocity/views/hello2.vhtml +++ /dev/null @@ -1,9 +0,0 @@ - - - Hello - - - -

Hello $mvc.encoders.html($user2)!

- - \ No newline at end of file diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/AsciiDocIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/AsciiDocIT.java deleted file mode 100644 index 7b4dba68..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/AsciiDocIT.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.helper.annotation.IgnoreOnWildfly; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.Archive; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertTrue; - -@RunWith(Arquillian.class) -// To get the test to work, we'd need to patch Wildfly with an own Asciidoctor module -// (see: https://github.com/asciidoctor/asciidoctorj/blob/26641dbe1510a83fbb9c5cab3974a8736b385bdd/README.adoc#running-asciidoctorj-on-wildfly-as) -// We think that isn't worth the effort in our case and skip the test for that reason. -@Category(IgnoreOnWildfly.class) -public class AsciiDocIT { - - private static final String WEB_INF_SRC = "src/main/resources/asciidoc/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "asciidoc") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.asciidoc") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.adoc").toFile(), "hello.adoc") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-asciidoc") - .build(); - } - - @Test - public void testView1() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello?user=mvc"); - final String h2 = page.getElementsByTagName("h2").get(0).getTextContent(); - assertTrue(h2.contains("mvc")); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/FreemarkerIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/FreemarkerIT.java deleted file mode 100644 index a8233218..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/FreemarkerIT.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertTrue; - -@RunWith(Arquillian.class) -public class FreemarkerIT { - - private static final String WEB_INF_SRC = "src/main/resources/freemarker/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "freemarker") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.freemarker") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.ftl").toFile(), "hello.ftl") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-freemarker") - .build(); - } - - @Test - public void testView() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello?user=mvc"); - final String h1 = page.getElementsByTagName("h1").get(0).getTextContent(); - assertTrue(h1.contains("mvc")); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/HandlebarsIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/HandlebarsIT.java deleted file mode 100644 index 6d34982f..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/HandlebarsIT.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.DomElement; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.Archive; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; -import java.util.List; - -import static org.junit.Assert.assertEquals; - -/** - * Class HandlebarsIT - * - * @author Rahman Usta - */ -@RunWith(Arquillian.class) -@Ignore // Disabled, because jakarta.* package namespace not supported yet -public class HandlebarsIT { - - private static final String WEB_INF_SRC = "src/main/resources/handlebars/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "handlebars") - public static Archive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.handlebars") - .addView(Paths.get(WEB_INF_SRC).resolve("views/head.hbs").toFile(), "head.hbs") - .addView(Paths.get(WEB_INF_SRC).resolve("views/person.hbs").toFile(), "person.hbs") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-handlebars") - .build(); - } - - @Test - public void testView1() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/person"); - final List divs = page.getElementsByTagName("div"); - assertEquals(3, divs.size()); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/JadeIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/JadeIT.java deleted file mode 100644 index 74a6137d..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/JadeIT.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.DomElement; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * @author Florian Hirsch - */ -@RunWith(Arquillian.class) -public class JadeIT { - - private static final String WEB_INF_SRC = "src/main/resources/jade/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "jade") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.jade") - .addView(Paths.get(WEB_INF_SRC).resolve("views/config.jade").toFile(), "config.jade") - .addView(Paths.get(WEB_INF_SRC).resolve("views/helper.jade").toFile(), "helper.jade") - .addView(Paths.get(WEB_INF_SRC).resolve("views/main.jade").toFile(), "main.jade") - .addView(Paths.get(WEB_INF_SRC).resolve("views/markdown.jade").toFile(), "markdown.jade") - .addView(Paths.get(WEB_INF_SRC).resolve("views/includes/footer.jade").toFile(), "includes/footer.jade") - .addResource(Paths.get(WEB_INF_SRC).resolve("jade.properties").toFile()) - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-jade") - .build(); - } - - @Test - public void testUsesModel() throws Exception { - String path = baseURL + "jade?user=mvc%d"; - final HtmlPage page = webClient.getPage(String.format(path, 0)); - assertTrue(page.getTitleText().contains("Jade")); - for (int i = 0; i < 10; i++) { // just to ensure that not the whole page is cached - final HtmlPage subPage = webClient.getPage(String.format(path, i)); - final DomElement h1 = subPage.getFirstByXPath("//html/body/h1"); - assertTrue(h1.getTextContent().contains("mvc" + i)); - } - } - - @Test - public void testIncludesViews() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "jade"); - final DomElement footer = page.getFirstByXPath("//p[@class='footer']"); - assertTrue(footer.getTextContent().contains("Eclipse Krazo committers and contributors")); - } - - @Test - public void testUsesFilters() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "jade/markdown"); - final List elements = page.getByXPath("//html/body/ul/li"); - assertEquals(3, elements.size()); - } - - @Test - public void testConfiguration() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "jade/config"); - final DomElement systemProperties = page.getFirstByXPath("//p[@class='SystemProperties']"); - assertEquals("SystemProperties", systemProperties.getTextContent()); - final DomElement configFile = page.getFirstByXPath("//p[@class='ConfigFile']"); - assertEquals("ConfigFile", configFile.getTextContent()); - } - - @Test - public void testHelper() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "jade/helper"); - final DomElement element = page.getFirstByXPath("//p[@class='result']"); - assertEquals("3", element.getTextContent()); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/JetbrickIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/JetbrickIT.java deleted file mode 100644 index 69634ab2..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/JetbrickIT.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.DomElement; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertTrue; - -@RunWith(Arquillian.class) -@Ignore // Disabled, because jakarta.* package namespace not supported yet -public class JetbrickIT { - - private static final String WEB_INF_SRC = "src/main/resources/jetbrick/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "jetbrick") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.jetbrick") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.jetx").toFile(), "hello.jetx") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-jetbrick") - .build(); - } - - @Test - public void testView1() throws Exception { - //FIXME: Jetbricks-Ext is broken if the container runs on Java 9 (and above) - final HtmlPage page = webClient.getPage(baseURL + "resources/hello?user=mvc"); - final DomElement h1 = page.getElementsByTagName("h1").get(0); - assertTrue(h1.getTextContent().contains("mvc")); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/Jinja2IT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/Jinja2IT.java deleted file mode 100644 index 908de719..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/Jinja2IT.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2021 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.net.URL; -import java.nio.file.Paths; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.DomElement; -import com.gargoylesoftware.htmlunit.html.HtmlPage; - -import org.eclipse.krazo.test.helper.annotation.IgnoreOnWildfly; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.container.test.api.RunAsClient; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; - -@RunWith(Arquillian.class) -@Category(IgnoreOnWildfly.class) -public class Jinja2IT { - - private static final String WEB_INF_SRC = "src/main/resources/jinja2/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "jinja2") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.jinja2") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.j2").toFile(), "hello.j2") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-jinja2") - .build(); - } - - @Test - @RunAsClient - public void test() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello?user=mvc"); - final DomElement h1 = page.getElementsByTagName("h1").get(0); - assertNotNull(h1); - assertTrue(h1.getTextContent().contains("mvc")); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/MustacheIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/MustacheIT.java deleted file mode 100644 index 2699c44e..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/MustacheIT.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.Archive; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertTrue; - -@RunWith(Arquillian.class) -public class MustacheIT { - - private static final String WEB_INF_SRC = "src/main/resources/mustache/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "mustache") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.mustache") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.mustache").toFile(), "hello.mustache") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-mustache") - .build(); - } - - @Test - public void testView() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello?user=mvc"); - final String h1 = page.getElementsByTagName("h1").get(0).getTextContent(); - assertTrue(h1.contains("mvc")); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/PebbleIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/PebbleIT.java deleted file mode 100644 index 234aedfb..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/PebbleIT.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -@RunWith(Arquillian.class) -public class PebbleIT { - - private static final String WEB_INF_SRC = "src/main/resources/pebble/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "pebble") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.pebble") - .addView(Paths.get(WEB_INF_SRC).resolve("views/filter.peb").toFile(), "filter.peb") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-pebble") - .build(); - } - - @Test - public void testUsesFilter() throws Exception { - String text = "To be filtered"; - - final HtmlPage page = webClient.getPage(baseURL + "pebble/filter"); - - final String body = page.getElementsByTagName("body").get(0).getTextContent(); - assertFalse(body.contains(text)); - assertTrue(body.contains(text.toUpperCase())); - } - -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/StringTemplateIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/StringTemplateIT.java deleted file mode 100644 index cc0d2b46..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/StringTemplateIT.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.DomElement; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertTrue; - -@RunWith(Arquillian.class) -public class StringTemplateIT { - - private static final String WEB_INF_SRC = "src/main/resources/stringtemplate/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "stringtemplate") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.stringtemplate") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.st").toFile(), "hello.st") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-stringtemplate") - .build(); - } - - @Test - public void testView1() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello?user=mvc"); - final DomElement h1 = page.getElementsByTagName("h1").get(0); - assertTrue(h1.getTextContent().contains("mvc")); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/ThymeleafIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/ThymeleafIT.java deleted file mode 100644 index 27d6f8f1..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/ThymeleafIT.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.DomElement; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.container.test.api.RunAsClient; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -/** - * @author Gregor Tudan - */ -@RunWith(Arquillian.class) -public class ThymeleafIT { - - private static final String WEB_INF_SRC = "src/main/resources/thymeleaf/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "thymeleaf") - public static WebArchive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.thymeleaf") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.html").toFile(), "hello.html") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-thymeleaf") - .build(); - } - - @Test - @RunAsClient - public void test() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello?user=mvc"); - final DomElement h1 = page.getElementsByTagName("h1").get(0); - assertNotNull(h1); - assertTrue(h1.getTextContent().contains("mvc")); - } -} diff --git a/testsuite/src/test/java/org/eclipse/krazo/test/ext/VelocityIT.java b/testsuite/src/test/java/org/eclipse/krazo/test/ext/VelocityIT.java deleted file mode 100644 index 6fb00c5c..00000000 --- a/testsuite/src/test/java/org/eclipse/krazo/test/ext/VelocityIT.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2014-2015 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, 2019 Eclipse Krazo committers and contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ -package org.eclipse.krazo.test.ext; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.html.DomElement; -import com.gargoylesoftware.htmlunit.html.HtmlPage; -import org.eclipse.krazo.test.util.WebArchiveBuilder; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.Archive; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -import java.net.URL; -import java.nio.file.Paths; - -import static org.junit.Assert.assertTrue; - -@RunWith(Arquillian.class) -public class VelocityIT { - - private static final String WEB_INF_SRC = "src/main/resources/velocity/"; - - @ArquillianResource - private URL baseURL; - - private WebClient webClient; - - @Before - public void setUp() { - webClient = new WebClient(); - webClient.getOptions() - .setThrowExceptionOnFailingStatusCode(false); - webClient.getOptions() - .setRedirectEnabled(true); - } - - @Deployment(testable = false, name = "velocity") - public static Archive createDeployment() { - return new WebArchiveBuilder() - .addPackage("org.eclipse.krazo.test.ext.velocity") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello2.vhtml").toFile(), "hello2.vhtml") - .addView(Paths.get(WEB_INF_SRC).resolve("views/hello.vm").toFile(), "hello.vm") - .addBeansXml() - .addDependency("org.eclipse.krazo.ext:krazo-velocity") - .build(); - } - - @Test - public void testView1() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello/v1?user=mvc"); - final DomElement h1 = page.getElementsByTagName("h1").get(0); - assertTrue(h1.getTextContent().contains("mvc")); - } - - @Test - public void testView2() throws Exception { - final HtmlPage page = webClient.getPage(baseURL + "resources/hello/v2?user2=mvc"); - final DomElement h1 = page.getElementsByTagName("h1").get(0); - assertTrue(h1.getTextContent().contains("mvc")); - } -}