Class JsonConfigLoader
java.lang.Object
org.jenkinsci.plugins.vmanager.charts.util.JsonConfigLoader
Builds a
VManagerChartsJobProperty from a JSON configuration
(typically exported from the job-property UI and dropped into the build's
workspace). The loader intentionally ignores any credentialsId
field that may be present in the JSON: credentials are never imported,
they always come from the GUI.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringCanonical filename used when the build listener mirrors the JSON config into the run dir on the controller. -
Method Summary
Modifier and TypeMethodDescriptionstatic VManagerChartsJobPropertyeffectiveForJob(Job<?, ?> job, VManagerChartsJobProperty gui) Returns the effective property for job-level views (the job-sidebar "vManager Charts" page).static VManagerChartsJobPropertyeffectiveForRun(Run<?, ?> run, VManagerChartsJobProperty gui) Returns the effective property to use for view/data purposes given aRun.static VManagerChartsJobPropertyParsesjsonTextand returns a populated property (no credentials).static FilelocateConfigFile(Run<?, ?> run, String userPath) Resolves the controller-sideFilethat should be read for the JSON config of a given run.static StringSerializes aVManagerChartsJobPropertyinto the canonical JSON shape thatload(String)can read back (round-trippable).
-
Field Details
-
DEFAULT_CONFIG_FILE_NAME
Canonical filename used when the build listener mirrors the JSON config into the run dir on the controller. The view layer always looks here first regardless of the user's configured path on the agent side.- See Also:
-
-
Method Details
-
toJson
Serializes aVManagerChartsJobPropertyinto the canonical JSON shape thatload(String)can read back (round-trippable). The following fields are intentionally NEVER exported and NEVER imported — they always come from the GUI at build time:credentialsIdserverUrlsessionSource/sessionInputFile
-
load
ParsesjsonTextand returns a populated property (no credentials). -
effectiveForRun
public static VManagerChartsJobProperty effectiveForRun(Run<?, ?> run, VManagerChartsJobProperty gui) Returns the effective property to use for view/data purposes given aRun. When the GUI property hasconfigSource = FILE, the JSON mirrored next to the build log is parsed and used to overlay the GUI booleans / customCharts. The GUI-only fields (server URL, credentials, session source/file, verbose-logging) are always taken from the saved GUI property. When the mirrored file cannot be located or parsed, the GUI property is returned unchanged. -
effectiveForJob
public static VManagerChartsJobProperty effectiveForJob(Job<?, ?> job, VManagerChartsJobProperty gui) Returns the effective property for job-level views (the job-sidebar "vManager Charts" page). WhenconfigSource = FILE, the JSON file from the latest completed build (falling back to the latest build) is used. -
locateConfigFile
Resolves the controller-sideFilethat should be read for the JSON config of a given run. The build-completion listener mirrors the loaded JSON intorun.getRootDir()underDEFAULT_CONFIG_FILE_NAME, which is preferred. Falls back to the user-configured path (absolute, or relative to the run dir) for legacy builds where the mirror is not yet present.
-