Skip to content

Commit 54ef38d

Browse files
committed
add tomee
1 parent 4a81c7f commit 54ef38d

File tree

17 files changed

+444
-0
lines changed

17 files changed

+444
-0
lines changed

microprofile/tomee/pom.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>br.org.soujava.rio</groupId>
6+
<artifactId>tomee.microprofile</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>tomee-microprofile</name>
9+
<packaging>war</packaging>
10+
<description>tomee-microprofile</description>
11+
12+
<properties>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<tomee.version>8.0.0-M2</tomee.version>
15+
<failOnMissingWebXml>false</failOnMissingWebXml>
16+
<maven.compiler.source>1.8</maven.compiler.source>
17+
<maven.compiler.target>1.8</maven.compiler.target>
18+
</properties>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>org.eclipse.microprofile</groupId>
23+
<artifactId>microprofile</artifactId>
24+
<version>2.0.1</version>
25+
<type>pom</type>
26+
<scope>provided</scope>
27+
</dependency>
28+
</dependencies>
29+
30+
<build>
31+
<finalName>tomee-demo</finalName>
32+
<plugins>
33+
<plugin>
34+
<groupId>org.apache.tomee.maven</groupId>
35+
<artifactId>tomee-maven-plugin</artifactId>
36+
<version>${tomee.version}</version>
37+
<executions>
38+
<execution>
39+
<id>executable-jar</id>
40+
<phase>package</phase>
41+
<goals>
42+
<goal>exec</goal>
43+
</goals>
44+
</execution>
45+
</executions>
46+
<configuration>
47+
<context>ROOT</context>
48+
<tomeeClassifier>microprofile</tomeeClassifier>
49+
</configuration>
50+
</plugin>
51+
</plugins>
52+
</build>
53+
</project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package br.org.soujava.rio.boot;
2+
3+
/*
4+
* The MIT License
5+
* Copyright © 2017 Daniel Dias
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
26+
import javax.ws.rs.ApplicationPath;
27+
import javax.ws.rs.core.Application;
28+
29+
/**
30+
* @author Daniel Dias
31+
* github:Daniel-Dos
32+
* daniel.dias@soujava.org.br
33+
* twitter:@danieldiasjava
34+
*/
35+
@ApplicationPath("app")
36+
public class Boot extends Application { }
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package br.org.soujava.rio.resources;
2+
3+
/*
4+
* The MIT License
5+
* Copyright © 2017 Daniel Dias
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
26+
import javax.inject.Inject;
27+
import javax.json.Json;
28+
import javax.json.JsonObject;
29+
import javax.ws.rs.GET;
30+
import javax.ws.rs.Path;
31+
import javax.ws.rs.Produces;
32+
import javax.ws.rs.core.MediaType;
33+
import javax.ws.rs.core.Response;
34+
35+
import org.eclipse.microprofile.config.inject.ConfigProperty;
36+
import org.eclipse.microprofile.openapi.annotations.Operation;
37+
import org.eclipse.microprofile.openapi.annotations.media.Content;
38+
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
39+
40+
/**
41+
* @author Daniel Dias
42+
* github:Daniel-Dos
43+
* daniel.dias@soujava.org.br
44+
* twitter:@danieldiasjava
45+
*/
46+
47+
@Path("JUG")
48+
@Produces(MediaType.APPLICATION_JSON)
49+
public class JUGService {
50+
51+
@Inject
52+
@ConfigProperty(name = "jug.nome")
53+
private String jugNome;
54+
55+
@Inject
56+
@ConfigProperty(name = "jug.leaders")
57+
private String jugLeaders;
58+
59+
@Inject
60+
@ConfigProperty(name = "jug.descricao")
61+
private String descricao;
62+
63+
@GET
64+
@Operation(summary = "Exibi uma JUG",
65+
description = "Gera um documento Json com 3 atributos.")
66+
@APIResponse(description = "A JUG",
67+
content = @Content(mediaType = "application/json"),
68+
responseCode = "200")
69+
public Response getJUG() {
70+
71+
JsonObject json = Json.createObjectBuilder()
72+
.add("Jug", jugNome)
73+
.add("Lideres", jugLeaders)
74+
.add("Descrição", descricao)
75+
.build();
76+
77+
String resultado = json.toString();
78+
79+
return Response.ok().entity(resultado).build();
80+
}
81+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0"?>
2+
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
5+
bean-discovery-mode="all">
6+
</beans>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
jug.nome = SouJava Rio
2+
jug.leaders = Daniel Dias, Paulo Simões, Ulisses Telemaco
3+
jug.descricao = SouJava - Fortalecendo a comunidade Java brasileira.
4+
5+
#openapi
6+
mp.openapi.servers=http://localhost:8080/app

microprofile/tomee/src/main/webapp/css/swagger-ui.css

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

microprofile/tomee/src/main/webapp/css/swagger-ui.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
445 Bytes
Loading
1.11 KB
Loading
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!-- HTML for static distribution bundle build -->
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Swagger UI</title>
7+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
8+
<link rel="stylesheet" type="text/css" href="css/swagger-ui.css" >
9+
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
10+
<link rel="icon" type="image/png" href="img/favicon-16x16.png" sizes="16x16" />
11+
<style>
12+
html
13+
{
14+
box-sizing: border-box;
15+
overflow: -moz-scrollbars-vertical;
16+
overflow-y: scroll;
17+
}
18+
19+
*,
20+
*:before,
21+
*:after
22+
{
23+
box-sizing: inherit;
24+
}
25+
26+
body
27+
{
28+
margin:0;
29+
background: #fafafa;
30+
}
31+
</style>
32+
</head>
33+
34+
<body>
35+
<div id="swagger-ui"></div>
36+
37+
<script src="js/swagger-ui-bundle.js"> </script>
38+
<script src="js/swagger-ui-standalone-preset.js"> </script>
39+
<script>
40+
window.onload = function() {
41+
42+
// Build a system
43+
const ui = SwaggerUIBundle({
44+
url: "http://localhost:8080/app/openapi",
45+
dom_id: '#swagger-ui',
46+
deepLinking: true,
47+
presets: [
48+
SwaggerUIBundle.presets.apis,
49+
SwaggerUIStandalonePreset
50+
],
51+
plugins: [
52+
SwaggerUIBundle.plugins.DownloadUrl
53+
],
54+
layout: "StandaloneLayout"
55+
})
56+
57+
window.ui = ui
58+
}
59+
</script>
60+
</body>
61+
</html>

0 commit comments

Comments
 (0)