-
Notifications
You must be signed in to change notification settings - Fork 2
Add summary data model classes #1
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
Open
onkar717
wants to merge
2
commits into
web-servers:main
Choose a base branch
from
onkar717:feat/catalina-discovery
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/main/java/org/jboss/jws/diag/summary/model/ContainerInfo.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package org.jboss.jws.diag.summary.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
|
||
| /** | ||
| * Container runtime detected for the running Tomcat process. | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public final class ContainerInfo { | ||
|
|
||
| private final ContainerType type; | ||
| private final String detectionMethod; | ||
|
|
||
| private ContainerInfo(Builder builder) { | ||
| this.type = builder.type; | ||
| this.detectionMethod = builder.detectionMethod; | ||
| } | ||
|
|
||
| public ContainerType getType() { | ||
| return type; | ||
| } | ||
|
|
||
| public String getDetectionMethod() { | ||
| return detectionMethod; | ||
| } | ||
|
|
||
| public static Builder builder() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| public static final class Builder { | ||
| private ContainerType type; | ||
| private String detectionMethod; | ||
|
|
||
| public Builder type(ContainerType type) { | ||
| this.type = type; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder detectionMethod(String detectionMethod) { | ||
| this.detectionMethod = detectionMethod; | ||
| return this; | ||
| } | ||
|
|
||
| public ContainerInfo build() { | ||
| return new ContainerInfo(this); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "ContainerInfo{type=" + type + ", detectionMethod='" + detectionMethod + "'}"; | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
src/main/java/org/jboss/jws/diag/summary/model/ContainerType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package org.jboss.jws.diag.summary.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonValue; | ||
|
|
||
| /** | ||
| * Container runtime in which the Tomcat process is running. | ||
| */ | ||
| public enum ContainerType { | ||
|
|
||
| DOCKER("docker"), | ||
| PODMAN("podman"), | ||
| KUBERNETES("kubernetes"), | ||
| BARE_METAL("bare_metal"); | ||
|
|
||
| private final String value; | ||
|
|
||
| ContainerType(String value) { | ||
| this.value = value; | ||
| } | ||
|
|
||
| @JsonValue | ||
| public String getValue() { | ||
| return value; | ||
| } | ||
| } |
93 changes: 93 additions & 0 deletions
93
src/main/java/org/jboss/jws/diag/summary/model/JvmInfo.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| package org.jboss.jws.diag.summary.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
| import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
|
|
||
| import java.nio.file.Path; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * JVM information collected from system properties and the running process. | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public final class JvmInfo { | ||
|
|
||
| private final String version; | ||
| private final String vendor; | ||
| private final Path javaHome; | ||
| /** | ||
| * JVM args as seen in {@code /proc/<pid>/cmdline}. Callers must redact sensitive | ||
| * {@code -D} flags (e.g. {@code -Djavax.net.ssl.keyStorePassword}) before passing | ||
| * this list to the builder. | ||
| */ | ||
| private final List<String> jvmArgs; | ||
|
|
||
| private JvmInfo(Builder builder) { | ||
| this.version = builder.version; | ||
| this.vendor = builder.vendor; | ||
| this.javaHome = builder.javaHome; | ||
| this.jvmArgs = builder.jvmArgs != null | ||
| ? Collections.unmodifiableList(builder.jvmArgs) | ||
| : null; | ||
| } | ||
|
|
||
| public String getVersion() { | ||
| return version; | ||
| } | ||
|
|
||
| public String getVendor() { | ||
| return vendor; | ||
| } | ||
|
|
||
| @JsonSerialize(using = ToStringSerializer.class) | ||
| public Path getJavaHome() { | ||
| return javaHome; | ||
| } | ||
|
|
||
| public List<String> getJvmArgs() { | ||
| return jvmArgs; | ||
| } | ||
|
|
||
| public static Builder builder() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| public static final class Builder { | ||
| private String version; | ||
| private String vendor; | ||
| private Path javaHome; | ||
| private List<String> jvmArgs; | ||
|
|
||
| public Builder version(String version) { | ||
| this.version = version; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder vendor(String vendor) { | ||
| this.vendor = vendor; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder javaHome(Path javaHome) { | ||
| this.javaHome = javaHome; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder jvmArgs(List<String> jvmArgs) { | ||
| this.jvmArgs = jvmArgs; | ||
| return this; | ||
| } | ||
|
|
||
| public JvmInfo build() { | ||
| return new JvmInfo(this); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "JvmInfo{version='" + version + "', vendor='" + vendor | ||
| + "', javaHome=" + javaHome + ", jvmArgs=" + jvmArgs + '}'; | ||
| } | ||
| } |
175 changes: 175 additions & 0 deletions
175
src/main/java/org/jboss/jws/diag/summary/model/JwsInstallation.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| package org.jboss.jws.diag.summary.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
| import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
|
|
||
| import java.nio.file.Path; | ||
|
|
||
| /** | ||
| * Root model representing a discovered JBoss Web Server / Apache Tomcat installation. | ||
| * All fields except {@code schemaVersion} are optional; discovery may populate a subset | ||
| * depending on what is detectable in the environment. | ||
| */ | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public final class JwsInstallation { | ||
|
|
||
| private static final String SCHEMA_VERSION = "1.0"; | ||
|
|
||
| private final Path catalinaHome; | ||
| private final Path catalinaBase; | ||
| private final String tomcatVersion; | ||
| private final String jwsVersion; | ||
| private final JvmInfo jvmInfo; | ||
| private final OsInfo osInfo; | ||
| private final ContainerInfo containerInfo; | ||
| private final NativeInfo nativeInfo; | ||
| private final Integer pid; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "uptime" field from the design doc is missing. |
||
| private final String uptime; | ||
|
|
||
| private JwsInstallation(Builder builder) { | ||
| this.catalinaHome = builder.catalinaHome; | ||
| this.catalinaBase = builder.catalinaBase; | ||
| this.tomcatVersion = builder.tomcatVersion; | ||
| this.jwsVersion = builder.jwsVersion; | ||
| this.jvmInfo = builder.jvmInfo; | ||
| this.osInfo = builder.osInfo; | ||
| this.containerInfo = builder.containerInfo; | ||
| this.nativeInfo = builder.nativeInfo; | ||
| this.pid = builder.pid; | ||
| this.uptime = builder.uptime; | ||
| } | ||
|
|
||
| public String getSchemaVersion() { | ||
| return SCHEMA_VERSION; | ||
| } | ||
|
|
||
| @JsonSerialize(using = ToStringSerializer.class) | ||
| public Path getCatalinaHome() { | ||
| return catalinaHome; | ||
| } | ||
|
|
||
| @JsonSerialize(using = ToStringSerializer.class) | ||
| public Path getCatalinaBase() { | ||
| return catalinaBase; | ||
| } | ||
|
|
||
| public String getTomcatVersion() { | ||
| return tomcatVersion; | ||
| } | ||
|
|
||
| public String getJwsVersion() { | ||
| return jwsVersion; | ||
| } | ||
|
|
||
| public JvmInfo getJvmInfo() { | ||
| return jvmInfo; | ||
| } | ||
|
|
||
| public OsInfo getOsInfo() { | ||
| return osInfo; | ||
| } | ||
|
|
||
| public ContainerInfo getContainerInfo() { | ||
| return containerInfo; | ||
| } | ||
|
|
||
| public NativeInfo getNativeInfo() { | ||
| return nativeInfo; | ||
| } | ||
|
|
||
| public Integer getPid() { | ||
| return pid; | ||
| } | ||
|
|
||
| public String getUptime() { | ||
| return uptime; | ||
| } | ||
|
|
||
| public static Builder builder() { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| public static final class Builder { | ||
| private Path catalinaHome; | ||
| private Path catalinaBase; | ||
| private String tomcatVersion; | ||
| private String jwsVersion; | ||
| private JvmInfo jvmInfo; | ||
| private OsInfo osInfo; | ||
| private ContainerInfo containerInfo; | ||
| private NativeInfo nativeInfo; | ||
| private Integer pid; | ||
| private String uptime; | ||
|
|
||
| public Builder catalinaHome(Path catalinaHome) { | ||
| this.catalinaHome = catalinaHome; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder catalinaBase(Path catalinaBase) { | ||
| this.catalinaBase = catalinaBase; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder tomcatVersion(String tomcatVersion) { | ||
| this.tomcatVersion = tomcatVersion; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder jwsVersion(String jwsVersion) { | ||
| this.jwsVersion = jwsVersion; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder jvmInfo(JvmInfo jvmInfo) { | ||
| this.jvmInfo = jvmInfo; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder osInfo(OsInfo osInfo) { | ||
| this.osInfo = osInfo; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder containerInfo(ContainerInfo containerInfo) { | ||
| this.containerInfo = containerInfo; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder nativeInfo(NativeInfo nativeInfo) { | ||
| this.nativeInfo = nativeInfo; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder pid(Integer pid) { | ||
| this.pid = pid; | ||
| return this; | ||
| } | ||
|
|
||
| public Builder uptime(String uptime) { | ||
| this.uptime = uptime; | ||
| return this; | ||
| } | ||
|
|
||
| public JwsInstallation build() { | ||
| return new JwsInstallation(this); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "JwsInstallation{" | ||
| + "catalinaHome=" + catalinaHome | ||
| + ", catalinaBase=" + catalinaBase | ||
| + ", tomcatVersion='" + tomcatVersion + '\'' | ||
| + ", jwsVersion='" + jwsVersion + '\'' | ||
| + ", pid=" + pid | ||
| + ", uptime='" + uptime + '\'' | ||
| + ", jvmInfo=" + jvmInfo | ||
| + ", osInfo=" + osInfo | ||
| + ", containerInfo=" + containerInfo | ||
| + ", nativeInfo=" + nativeInfo | ||
| + '}'; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"schemaVersion" field from the design doc is missing.