Skip to content

Add summary data model classes#1

Open
onkar717 wants to merge 2 commits into
web-servers:mainfrom
onkar717:feat/catalina-discovery
Open

Add summary data model classes#1
onkar717 wants to merge 2 commits into
web-servers:mainfrom
onkar717:feat/catalina-discovery

Conversation

@onkar717
Copy link
Copy Markdown

Description:

Introduces the root data model for a discovered JBoss Web Server / Apache Tomcat installation. These classes are the foundation that the discovery pipeline (Week 1-2) will populate and the summary formatter (Week 3) will consume.

Classes added in summary/model/:

Class and Purpose

  • JwsInstallation :- Root model catalinaHome, catalinaBase, tomcatVersion, jwsVersion, pid, and all sub-models
  • JvmInfo :- JVM version, vendor, javaHome, jvmArgs
  • OsInfo :- OS name, version, architecture
  • ContainerInfo :- Detected container runtime + detection method
  • ContainerType :- Enum: DOCKER, PODMAN, KUBERNETES, BARE_METAL
  • NativeInfo :- APR version, OpenSSL version, loaded flag

Design decisions:

  • All models are immutable with a builder pattern populated field-by-field as each detector runs
  • @JsonInclude(NON_NULL) on every class missing detections are omitted from JSON output rather than serialized as null
  • Path fields use ToStringSerializer so JSON output renders plain strings, not Java object structure

To test:

mvn verify

All 7 existing tests pass. No new tests in this commit discovery unit tests follow in the next PR.

Introduces JwsInstallation as the root model for a discovered Tomcat
installation, along with supporting value objects: JvmInfo, OsInfo,
ContainerInfo (with ContainerType enum), and NativeInfo.

All models are immutable (builder pattern), null-safe, and annotated
for Jackson JSON serialization. Path fields use ToStringSerializer so
they render as plain strings in JSON output.
@onkar717
Copy link
Copy Markdown
Author

@dsoumis PTAL !


private final String aprVersion;
private final String opensslVersion;
private final boolean loaded;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Boolean so it can be null and excluded by @JsonInclude(NON_NULL).

@dsoumis
Copy link
Copy Markdown
Member

dsoumis commented May 26, 2026

Your design document (Section 5) defines the JSON schema. The implementation should match it.


private final String version;
private final String vendor;
private final String javaHome;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not type of Path?

private final OsInfo osInfo;
private final ContainerInfo containerInfo;
private final NativeInfo nativeInfo;
private final Integer pid;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uptime" field from the design doc is missing.

@JsonInclude(JsonInclude.Include.NON_NULL)
public final class JwsInstallation {

private final Path catalinaHome;
Copy link
Copy Markdown
Member

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.

}

@JsonSerialize(using = ToStringSerializer.class)
@JsonProperty("catalinaHome")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JsonProperty("fieldName") annotations are redundant.

@Override
public String toString() {
return "JvmInfo{version='" + version + "', vendor='" + vendor
+ "', javaHome='" + javaHome + "', jvmArgs=" + jvmArgs + '}';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your design doc has a "No secrets in output" security constraint. The jvmArgs list stores values as-is with no redaction. It can contain secrets like -Djavax.net.ssl.keyStorePassword=secret. Make sure the detector that populates this field applies redaction before passing the list to the builder.

@dsoumis
Copy link
Copy Markdown
Member

dsoumis commented May 26, 2026

Following CONTRIBUTING.md guidelines you should include tests for this PR.

@onkar717
Copy link
Copy Markdown
Author

@dsoumis

@dsoumis
Copy link
Copy Markdown
Member

dsoumis commented May 29, 2026

The JSON output still doesn't match the schema the design doc describes.
e.g ContainerInfo.detectionMethod vs design doc's detectedVia or "jvmInfo" vs design doc's "jvm"

}

@Test
void jvmArgsListIsImmutable() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't actually verify immutability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants