jmvs

JMVS modernisation plan

Record of moving JMVS from the legacy Java3D application to a modern, cross-platform viewer. Detailed rationale lives in the to-be ADRs and to-be arc42; the as-is system is described in arc42/legacy/ and adr/legacy/. This document is the index and status record; the modernisation is complete. Future features are planned in roadmap.md.

Status

Phase Scope Status
0 Documentation: this plan, AGENTS.md, to-be ADRs and arc42 Done
1 Build foundation: Gradle 9 multi-module, toolchains, legacy module, CI Done
2 Core: domain model, mmCIF reading, bonding, tests Done
3 Scene: renderer-neutral scene model and display modes Done
4 Renderer: libGDX rendering, camera, picking Done
5 Application: launcher, UI, async loading, quality validation Done
6 Packaging and cutover: installers, legacy archived Done

Problem

JMVS (~4k LOC) is a 1999/2003 Java3D viewer revived in 2022. The legacy risks and technical debt show it is pinned to JDK ≤ 11 by unmaintained Java3D 1.x and vendored macOS-only JOGL jars, carries vendored Sun-licensed sources, slows down beyond ~1000 atoms, terminates via System.exit, depends on the working directory, and is almost untested.

Decisions

Topic Decision ADR
Java Java 25 LTS via Gradle toolchains; Gradle 9 wrapper; version catalog 0001
Build structure Multi-module Gradle build with enforced dependency direction 0002
Migration Strangler: legacy app kept as legacy-app on a JDK 11 toolchain until parity, then archived as a standalone build 0003
Rendering libGDX (LWJGL3 backend) replaces Java3D/JOGL 0004
UI libGDX Scene2D UI + native file dialog 0005
Extensibility Renderer-neutral scene model; display-mode and colour-scheme SPI with built-in registry; no external jar loading 0006
Performance Instanced rendering; recolour without geometry rebuild 0007
mmCIF rcsb ciftools-java, gzip support 0008
Bonding Spatial-grid search with RasMol rules 0009
Dependencies Maven Central only; remove vendored jars and Sun sources 0010
Errors/logging Typed exceptions, System.Logger, no System.exit in library code 0011
Testing Golden files, RasMol parity, GPU-free scene tests 0012
CI/packaging GitHub Actions matrix; jpackage installers per OS 0013
Interaction Orbit camera; CPU ray picking 0014
Configuration Classpath .properties, parsed once into typed config 0015

Target module layout

settings.gradle.kts
gradle/libs.versions.toml
jmvs-core/        model, chemistry (elements, RasMol bonding), io (ciftools adapter, gzip); no UI/GL deps
jmvs-scene/       renderer-neutral scene data, DisplayMode/ColourScheme SPI, built-in modes and schemes
jmvs-render-gdx/  libGDX renderer: instanced spheres/cylinders, ribbon meshes, lighting, camera, picking
jmvs-app/         LWJGL3 launcher, Scene2D UI, file dialog, async loading, packaging
legacy-app/       original app/ as-is on a JDK 11 toolchain; since cutover a standalone build (own settings), not a module

Dependencies point one way: jmvs-app → jmvs-render-gdx → jmvs-scene → jmvs-core. Only jmvs-render-gdx and jmvs-app may depend on libGDX. See 05 Building block view.

Risk and debt resolution

References are to the legacy risks and technical debt.

Item Resolution Phase
R1 Java3D / JDK ≤ 11 lock libGDX renderer; Java 25 1, 4
R2 macOS-only natives LWJGL natives from Maven Central; CI on macOS, Linux, Windows 1, 4
R3 Binary jars in git Maven Central only; the jars remain only in the archived, standalone legacy-app 6
R4 Sun-copyright sources Not ported; remain only in the archived legacy-app 6
R5 Performance ceiling Spatial-grid bonding, instancing, no per-atom logging, incremental recolouring 2, 4
R6 System.exit in library code Typed exceptions surfaced in the UI 2, 5
R7 Relative shader paths All resources loaded from the classpath 4
R8 Minimal tests Golden-file, parity and scene tests in CI 1–3
D1 O(n²) bonding with logging Spatial grid, no per-bond output 2
D2 Secondary structure matched by seq id across all chains Lookup keyed by (model, chain, seq id) 2
D3 Model lookup by list index Models keyed by model number 2
D4 Wrong bounds/centroid Correct min/max initialisation and centroid 2
D5 Negative extent passed to centring Camera framed from the bounding sphere 4
D6 Fragile parser ciftools-java 2
D7 Dead/unfinished features Turns parsed and coloured; balls-and-sticks enabled; defaults honoured; picking implemented; unused paint() dropped 2–5
D8 Pre-Java-8 style Records, sealed types, pattern matching, immutable collections 2–5
D9 Config parsed per atom Typed config parsed once 3
D10 Duplicate colour logic, unstable chain colours Shared ColourScheme implementations; deterministic palette 3
D11 Static mutable singletons Injected ElementTable, no static state 2
D12 Unused Guava, unused/unattributed shaders Removed; new shaders written in-repo 1, 4, 6
D13 Duplicated/unreadable samples One copy per file; .gz readable 2, 6
D14 Deprecated dialog API, hard-coded reader Native dialog; reader selected by file extension 2, 5

Phases

Phase 0 — Documentation

Phase 1 — Build foundation

Phase 2 — Core (jmvs-core)

Phase 3 — Scene (jmvs-scene)

Phase 4 — Renderer (jmvs-render-gdx)

Phase 5 — Application (jmvs-app)

Phase 6 — Packaging and cutover

Considerations