Skip to content

Commit b68678e

Browse files
authored
Merge pull request #3 from k2sd/prepare-for-alpha
Incorporate config, fault-tolerance, metrics and rest-client.
2 parents 12fe571 + 598bc4e commit b68678e

File tree

22 files changed

+867
-468
lines changed

22 files changed

+867
-468
lines changed

3RD-PARTY-LICENSE.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# geronimo-config-impl
21
# jackson-module-jaxb-annotations
32
# microprofile-config-api
3+
# microprofile-rest-client-api
4+
# smallrye-config
5+
# smallrye-fault-tolerance
6+
# smallrye-metrics
47

58
Apache License
69
Version 2.0, January 2004

README.adoc

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,31 @@
22

33
image::https://raw.githubusercontent.com/fujitsu/launcher/image/logo/launcher-logo.png[width=96,height=96]
44

5-
== About Launcher
6-
Launcher is one of MicroProfile implementations.
7-
Launcher 1.0 is conformed to MicroProfile 1.1 which includes CDI 1.2, JSON-P 1.0, JAX-RS 2.0 and MicroProfile Config 1.0 API.
8-
For the details of MicroProfile, please refer link:https://projects.eclipse.org/projects/technology.microprofile[MicroProfile].
5+
== Overview
6+
Launcher is an implementation of https://microprofile.io/[MicroProfile].
97

10-
In addition that, Launcher provides the feature to create a portable uber(fat) jar.
11-
For the details, please refer Usage.
8+
Launcher 2.0 alpha 2 conforms to a subset of MicroProfile 2.2.
9+
Currently supported APIs are as follows:
1210

11+
* CDI 2.0
12+
* JAX-RS 2.1
13+
* JSON-B 1.0
14+
* JSON-P 1.1
15+
* Common Annotations 1.3
16+
* MicroProfile Config 1.3
17+
* MicroProfile Fault Tolerance 2.0
18+
* MicroProfile Rest Client 1.2
1319

14-
== How to build
15-
[source]
20+
Launcher provides features to run MicroProfile applications and create portable uber (fat) JARs.
21+
For more details, please refer to link:docs/Usage.adoc[].
22+
23+
== Build instructions
1624
----
1725
$ mvn clean install
1826
----
1927

2028
== Usage
21-
Please refer link:doc/Usage.adoc[].
22-
23-
== Download
24-
A binary form can be downloaded from link:https://github.com/fujitsu/launcher/releases[].
29+
Refer to link:docs/Usage.adoc[].
2530

31+
== Downloads
32+
Binary distributions can be obtained from link:https://github.com/fujitsu/launcher/releases[].

doc/Usage.adoc

Lines changed: 0 additions & 33 deletions
This file was deleted.

docs/Usage.adoc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
= Launcher
2+
3+
== Usage
4+
----
5+
java -jar launcher-<version>.jar
6+
[--config-file file-path]
7+
[--http-listener port-number]
8+
[--https-listener port-number]
9+
[--contextroot context-root]
10+
[--libraries jar-filepath[,jar-filepath]*]
11+
--deploy war-file
12+
[--generate uber-jar]
13+
----
14+
15+
=== Options
16+
[options="autowidth, header"]
17+
|===
18+
| Name | Description | Default Value
19+
| `--config-file` | Specify the path to configuration file (domain.xml). Do not use `--http-listener` or `--https-listener` when using this option. |
20+
| `--http-listener` | Specify HTTP port number. Do not use `--config-file` when using this option. | `8080`
21+
| `--https-listener` |Specify HTTPS port number. Do not use `--config-file` when using this option. | `8181`
22+
| `--deploy` | Specify the path to WAR file to deploy. This option is mandatory. |
23+
| `--contextroot` | Specify the context-root. | `/`
24+
| `--libraries` | Specify the paths to JAR files referred from the application. To specify more than one files, use comma (`,`) as a separator. Files specified in this option will not be included in the generated uber JAR. |
25+
| `--generate` | Specify the path to uber JAR to generate. When this option is not specified, the application will run automatically. |
26+
|===
27+
28+
== Examples
29+
* Example 1: Run an application `my-app.war` without creating an uber JAR.
30+
----
31+
$ java -jar launcher-<version>.jar --deploy my-app.war
32+
----
33+
34+
* Example 2: Create an uber JAR `my-uber.jar` and run it.
35+
----
36+
$ java -jar launcher-<version>.jar --deploy my-app.war --generate my-uber.jar
37+
$ java -jar my-uber.jar
38+
----

launcher-dist/pom.xml

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@
3636
<artifactId>microprofile-config</artifactId>
3737
<version>${project.version}</version>
3838
</dependency>
39+
<dependency>
40+
<groupId>com.fujitsu.launcher</groupId>
41+
<artifactId>microprofile-fault-tolerance</artifactId>
42+
<version>${project.version}</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>com.fujitsu.launcher</groupId>
46+
<artifactId>microprofile-metrics</artifactId>
47+
<version>${project.version}</version>
48+
</dependency>
49+
<dependency>
50+
<groupId>com.fujitsu.launcher</groupId>
51+
<artifactId>microprofile-rest-client</artifactId>
52+
<version>${project.version}</version>
53+
</dependency>
3954
<dependency>
4055
<groupId>com.fujitsu.launcher</groupId>
4156
<artifactId>bootstrap</artifactId>
@@ -73,47 +88,30 @@
7388
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
7489
<mainClass>com.fujitsu.launcher.LauncherMain</mainClass>
7590
</transformer>
76-
7791
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
7892
<addHeader>true</addHeader>
7993
</transformer>
8094
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
8195
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
8296
<resource>META-INF/hk2-locator/default</resource>
8397
</transformer>
98+
<!-- aggregate license notices into META-INF/3RD-PARTY-LICENSE.txt for clarification -->
99+
<transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
100+
<resources>
101+
<resource>license.header</resource>
102+
<resource>license.html</resource>
103+
<resource>LICENSE</resource>
104+
<resource>LICENSE.md</resource>
105+
<resource>META-INF/LICENSE</resource>
106+
<resource>META-INF/LICENSE.md</resource>
107+
<resource>META-INF/LICENSE.txt</resource>
108+
</resources>
109+
</transformer>
84110
</transformers>
85111
<filters>
86-
<filter>
87-
<artifact>org.eclipse.microprofile.config:microprofile-config-api</artifact>
88-
<excludes>
89-
<exclude>META-INF/LICENSE</exclude>
90-
</excludes>
91-
</filter>
92-
<filter>
93-
<artifact>org.osgi:org.osgi.annotation.versioning</artifact>
94-
<excludes>
95-
<exclude>LICENSE</exclude>
96-
</excludes>
97-
</filter>
98-
<filter>
99-
<artifact>org.apache.geronimo.config:geronimo-config-impl</artifact>
100-
<excludes>
101-
<exclude>META-INF/LICENSE</exclude>
102-
<exclude>org/apache/geronimo/config/cdi/ConfigExtension.class</exclude>
103-
<exclude>org/apache/geronimo/config/DefaultConfigBuilder.class</exclude>
104-
</excludes>
105-
</filter>
106-
<filter>
107-
<artifact>org.eclipse.microprofile.opentracing:microprofile-opentracing-api</artifact>
108-
<excludes>
109-
<exclude>META-INF/LICENSE</exclude>
110-
</excludes>
111-
</filter>
112112
<filter>
113113
<artifact>org.glassfish.main.extras:glassfish-embedded-web</artifact>
114114
<excludes>
115-
<exclude>META-INF/LICENSE</exclude>
116-
<exclude>META-INF/LICENSE.txt</exclude>
117115
<exclude>META-INF/services/org.glassfish.jersey.internal.spi.AutoDiscoverable</exclude>
118116
<exclude>com/sun/enterprise/v3/admin/CommandRunnerImpl$1.class</exclude>
119117
<exclude>com/sun/enterprise/v3/admin/CommandRunnerImpl$2$1.class</exclude>
@@ -140,12 +138,6 @@
140138
<exclude>org/glassfish/embed/domain.xml</exclude>
141139
</excludes>
142140
</filter>
143-
<filter>
144-
<artifact>args4j:args4j</artifact>
145-
<excludes>
146-
<exclude>LICENSE</exclude>
147-
</excludes>
148-
</filter>
149141
</filters>
150142
</configuration>
151143
</execution>

launcher-dist/src/main/resources/META-INF/3RD-PARTY-LICENSE.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# geronimo-config-impl
21
# jackson-module-jaxb-annotations
32
# microprofile-config-api
3+
# microprofile-rest-client-api
4+
# smallrye-config
5+
# smallrye-fault-tolerance
6+
# smallrye-metrics
47

58
Apache License
69
Version 2.0, January 2004

launcher-impl/bootstrap/src/main/java/com/fujitsu/launcher/DeployProperties.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
package com.fujitsu.launcher;
1212

13+
import java.io.File;
1314
import java.util.ArrayList;
1415
import java.util.List;
1516
import java.util.Properties;
@@ -20,6 +21,9 @@
2021
*/
2122
public class DeployProperties extends Properties {
2223

24+
private static boolean relativeToApplibsDirectory = Boolean
25+
.getBoolean("com.fujitsu.launcher.deploy.libraries.relativeToApplibsDirectory");
26+
2327
public void setContextRoot(String contextroot) {
2428
setProperty("--contextroot", contextroot);
2529
}
@@ -39,9 +43,30 @@ public String[] getDeployOptions() {
3943
}
4044

4145
if (this.getProperty("--libraries") != null) {
42-
deployOptions.add("--libraries=" + getProperty("--libraries"));
46+
String libraries = getProperty("--libraries");
47+
48+
// Convert relative paths to absolute ones by taking them to be
49+
// relative to the current working directory.
50+
// By default GlassFish regards relative paths as relative to
51+
// instance-root/lib/applibs.
52+
if (!relativeToApplibsDirectory) {
53+
libraries = absolutizeDeployParamLibraries(libraries);
54+
}
55+
56+
deployOptions.add("--libraries=" + libraries);
4357
}
4458

4559
return deployOptions.toArray(new String[deployOptions.size()]);
4660
}
61+
62+
private static String absolutizeDeployParamLibraries(String libraries) {
63+
String[] split = libraries.split(",");
64+
65+
for (int i = 0; i < split.length; i++) {
66+
File f = new File(split[i]);
67+
split[i] = f.getAbsolutePath();
68+
}
69+
70+
return String.join(",", split);
71+
}
4772
}

launcher-impl/bootstrap/src/main/java/com/fujitsu/launcher/LauncherMain.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
import org.glassfish.embeddable.GlassFish;
3232
import org.glassfish.embeddable.GlassFishProperties;
3333
import org.glassfish.embeddable.GlassFishRuntime;
34+
import org.glassfish.internal.api.Globals;
3435
import org.kohsuke.args4j.CmdLineException;
3536
import org.kohsuke.args4j.CmdLineParser;
3637
import org.kohsuke.args4j.Option;
3738

39+
import com.sun.enterprise.server.logging.GFFileHandler;
40+
3841
/**
3942
*
4043
* @author Tsuyoshi Yoshitomi
@@ -48,7 +51,7 @@ public class LauncherMain {
4851
private int httpListener = 8080;
4952

5053
@Option(name = "--https-listener")
51-
private int httpsListener = 8081;
54+
private int httpsListener = 8181;
5255

5356
@Option(name = "--deploy")
5457
private String inputWar;
@@ -159,11 +162,19 @@ private void launch() {
159162
public void run() {
160163
try {
161164
glassfish.stop();
165+
// work-around for deleting server.log on disposal
166+
forceCloseLog();
162167
glassfish.dispose();
163168
} catch (Exception e) {
164169
// fall through;
165170
}
166171
}
172+
173+
private void forceCloseLog() {
174+
GFFileHandler h = Globals.get(GFFileHandler.class);
175+
h.preDestroy();
176+
h.close();
177+
}
167178
});
168179

169180
glassfish.start();

0 commit comments

Comments
 (0)