Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microprofile Health #25186

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
dd7c5e4
Initial implementation
Thihup Oct 13, 2024
a1c4b38
Update version
Thihup Oct 15, 2024
0490f26
Fix TCK tests
Thihup Oct 16, 2024
7be24a9
Fix Checkstyle issue
Thihup Oct 16, 2024
3b9cc17
Ignore Microprofile Config if it is not enabled
Thihup Oct 28, 2024
1ec8dd8
Remove unused system properties
Thihup Oct 28, 2024
f0b52b8
Remove unused method
Thihup Oct 28, 2024
b2842fe
Remove unused Import-Package declarations
Thihup Oct 29, 2024
cfab442
Fix checkstyle
Thihup Oct 29, 2024
84b51ef
Move config file from META-INF to WEB-INF/classes/META-INF
Thihup Oct 29, 2024
6f5fbdf
Remove unused BeansXmlTransformer
Thihup Oct 29, 2024
c21a583
Improve error handling
Thihup Oct 29, 2024
1df0d36
Rename Arquillian extension
Thihup Oct 29, 2024
7d13b7d
Remove unused archive processor
Thihup Oct 29, 2024
2d80b6d
Add license
Thihup Oct 29, 2024
88fcd1e
Rename variables
Thihup Oct 31, 2024
75ad0f6
Remove unused Helidon Health dependency
Thihup Oct 31, 2024
ef217b5
Merge branch 'master' of https://github.com/eclipse-ee4j/glassfish in…
Thihup Nov 5, 2024
2b2e6e8
Update version
Thihup Nov 5, 2024
9bea997
CI
Thihup Nov 5, 2024
4f2fc1e
Remove unused internal dependencies
Thihup Nov 8, 2024
87035d1
Avoid Impl suffix
Thihup Nov 8, 2024
35bb755
Add system property to allow disabling the Health servlet
Thihup Nov 8, 2024
96528c9
Split Health implementation
Thihup Dec 4, 2024
c8ceff3
Merge branch 'master' of https://github.com/eclipse-ee4j/glassfish in…
Thihup Dec 5, 2024
c1355d9
Update version
Thihup Dec 5, 2024
f80f757
Merge branch 'master' of https://github.com/eclipse-ee4j/glassfish in…
Thihup Dec 28, 2024
67e74ef
Fix imports
Thihup Dec 28, 2024
f629daa
Fix imports
Thihup Dec 28, 2024
f3052c6
Fix imports
Thihup Dec 28, 2024
eb5af30
Set content type and encoding for health response body
OndroMih Dec 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions appserver/distributions/glassfish/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
basedir="${patches}/microprofile-rest-client-api" includes="META-INF/MANIFEST.MF"
destfile="${glassfish.modules}/microprofile-rest-client-api.jar"
/>
<jarupdate if:set="java17orGreater"
basedir="${patches}/microprofile-health-api" includes="META-INF/MANIFEST.MF"
destfile="${glassfish.modules}/microprofile-health-api.jar"
/>
<jarupdate
basedir="${patches}/tyrus-client" includes="META-INF/MANIFEST.MF"
destfile="${glassfish.modules}/tyrus-client.jar"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Manifest-Version: 1.0
Bundle-Description: MicroProfile Health :: API
Bundle-License: Apache License, Version 2.0
Bundle-SymbolicName: org.eclipse.microprofile.health
Bnd-LastModified: 1664892780713
Bundle-ManifestVersion: 2
Bundle-DocURL: https://microprofile.io/project/eclipse/microprofile-he
alth/microprofile-health-api
Bundle-Vendor: Eclipse Foundation
Import-Package: jakarta.enterprise.util;version="[3.0,5)",jakarta.inje
ct;version="[2.0,4)",org.eclipse.microprofile.health;version="[3.0,5)
",org.eclipse.microprofile.health.spi;version="[1.1,2)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-5.2.0.202010142003
Export-Package: org.eclipse.microprofile.health;version="3.0";uses:="j
akarta.enterprise.util,jakarta.inject,org.eclipse.microprofile.health
.spi",org.eclipse.microprofile.health.spi;version="1.1";uses:="org.ec
lipse.microprofile.health"
Bundle-Name: MicroProfile Health Check Bundle
Bundle-Version: 4.0.1
Bundle-SCM: url="https://github.com/eclipse/microprofile-health/microp
rofile-health-api",connection="scm:git:https://github.com/eclipse/mic
roprofile-health.git/microprofile-health-api",developer-connection="s
cm:git:[email protected]:eclipse/microprofile-health.git/microprofile-he
alth-api",tag="4.0.1"
Build-Jdk-Spec: 1.8
Created-By: 1.8.0_292 (AdoptOpenJDK)

25 changes: 24 additions & 1 deletion appserver/featuresets/glassfish/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022, 2023 Contributors to Eclipse Foundation.
Copyright (c) 2022, 2024 Contributors to Eclipse Foundation.
Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -840,6 +840,29 @@
</exclusions>
</dependency>

<!-- MicroProfile Health -->
<dependency>
<groupId>org.eclipse.microprofile.health</groupId>
<artifactId>microprofile-health-api</artifactId>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.main.microprofile</groupId>
<artifactId>microprofile-health</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- MicroProfile JWT -->
<dependency>
<groupId>org.eclipse.microprofile.jwt</groupId>
Expand Down
119 changes: 119 additions & 0 deletions appserver/microprofile/health/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2024 Contributors to Eclipse Foundation.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.

SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glassfish.main.microprofile</groupId>
<artifactId>microprofile-parent</artifactId>
<version>7.0.20-SNAPSHOT</version>
</parent>

<artifactId>microprofile-health</artifactId>
<packaging>glassfish-jar</packaging>

<name>GlassFish MicroProfile Health</name>

<dependencies>
<!-- APIs -->
<dependency>
<groupId>org.eclipse.microprofile.health</groupId>
<artifactId>microprofile-health-api</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.main.microprofile</groupId>
<artifactId>microprofile-config</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
</dependency>

<!-- Internal Dependencies -->
Thihup marked this conversation as resolved.
Show resolved Hide resolved
<dependency>
<groupId>org.glassfish.main.common</groupId>
<artifactId>glassfish-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.common</groupId>
<artifactId>internal-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.web</groupId>
<artifactId>weld-integration</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>17</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<supportedProjectTypes>
<supportedProjectType>glassfish-jar</supportedProjectType>
</supportedProjectTypes>
<instructions>
<!-- A list of packages that are exposed to classes outside the bundle -->
<Export-Package>
org.glassfish.microprofile.health;
</Export-Package>
<Import-Package>
org.eclipse.microprofile.config;
org.eclipse.microprofile.health.spi;
org.eclipse.microprofile.health;
jakarta.enterprise.util;
jakarta.enterprise.inject;
jakarta.enterprise.inject.spi;
jakarta.servlet.http;
jakarta.servlet;
jakarta.json.bind;
jakarta.inject;
</Import-Package>
</instructions>
</configuration>
<executions>
<execution>
<id>osgi-bundle</id>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2024 Contributors to Eclipse Foundation.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.microprofile.health;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.HealthCheckResponseBuilder;

public class HealthCheckResponseBuilderImpl extends HealthCheckResponseBuilder {
Thihup marked this conversation as resolved.
Show resolved Hide resolved

private final Map<String, Object> data = new HashMap<>();
private String name;
private HealthCheckResponse.Status status;

@Override
public HealthCheckResponseBuilder name(String name) {
this.name = name;
return this;
}

@Override
public HealthCheckResponseBuilder withData(String key, String value) {
data.put(key, value);
return this;
}

@Override
public HealthCheckResponseBuilder withData(String key, long value) {
data.put(key, value);
return this;
}

@Override
public HealthCheckResponseBuilder withData(String key, boolean value) {
data.put(key, value);
return this;
}

@Override
public HealthCheckResponseBuilder up() {
return status(true);
}

@Override
public HealthCheckResponseBuilder down() {
return status(false);
}

@Override
public HealthCheckResponseBuilder status(boolean up) {
status = up ? HealthCheckResponse.Status.UP : HealthCheckResponse.Status.DOWN;
return this;
}

@Override
public HealthCheckResponse build() {
return new HealthCheckResponse(name, status, data.isEmpty() ? null : Optional.of(data));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 Contributors to Eclipse Foundation.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package org.glassfish.microprofile.health;

import org.eclipse.microprofile.health.HealthCheckResponseBuilder;
import org.eclipse.microprofile.health.spi.HealthCheckResponseProvider;

public class HealthCheckResponseProviderImpl implements HealthCheckResponseProvider {
Thihup marked this conversation as resolved.
Show resolved Hide resolved
@Override
public HealthCheckResponseBuilder createResponseBuilder() {
return new HealthCheckResponseBuilderImpl();
}
}
Loading