Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Typed WQL results: map CIM values to Java objects instead of strings

未關閉
#194 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
30/100
Issue 類型
功能
描述清晰度
需要釐清
活躍度
活躍
技術堆疊
java
領域
api, backend

研究方向

Start by tracing WqlRow.get(String), the WQL query execution path, and the legacy WinRMWqlExecutor.getRows() and WindowsRemoteExecutor.executeWql APIs. Review how WS-Management exposes CIM class and value information before deciding the typed opt-in shape. Done means a defined mapping for scalar, array, datetime, embedded, and NULL values while preserving the existing string API; the issue does not name tests or implementation files.

由索引模型根據 Issue 內容生成。

描述

enhancement

Follow-up to #189 (PR #193), where WMI array properties were fixed to come back as a single string joined with | (configurable with WinRMClient.Builder.arraySeparator(String)).

Problem

Every WQL value is exposed as a String, whatever its CIM type. Consumers parse numbers, booleans, dates and now |-joined arrays themselves:

  • WqlRow.get(String) is declared Object but always returns a String.
  • An array property is a joined string: a single-element array is indistinguishable from a scalar, and an element that contains the separator is ambiguous.
  • NULL is an empty string, indistinguishable from an empty string value.
  • CIM datetimes arrive in the WS-Management form (<cim:Datetime>2024-05-01T12:34:56.789Z</cim:Datetime> for CIM_DATETIME values, or an interval), which nobody wants to parse by hand.

Proposal

A typed result variant where the row values are native Java objects, alongside the existing string-based API (which stays the default, and the only one for the legacy WinRMWqlExecutor.getRows() / List<List<String>>).

Suggested shape, to be refined:

  • Opt in per query, e.g. client.wql(query).typed().execute(), or a WqlRow.typed(String) / WqlRow.list(String) accessor family; the legacy List<Map<String, Object>> of WindowsRemoteExecutor.executeWql could also carry typed values under an opt-in flag, so WinRMWqlExecutor keeps its strings.
  • Mapping from the type information WS-Management gives us. The instance XML carries no xsi:type; the CIM type must come from the class schema (a WSMan Get of the class definition, winrm get wmi/...?__CLASS, or the p: XML schema), or from the value form (<cim:Datetime> wrapper, xsi:nil, repeated elements).

Suggested mapping:

CIM type Java
string, char16 String
boolean Boolean
sint8/sint16/sint32/sint64, uint8/uint16/uint32 Integer / Long (uint64 → BigInteger or Long)
real32/real64 Float / Double
datetime java.time.Instant / OffsetDateTime for timestamps, Duration for intervals
reference String (the object path)
embedded object nested WqlRow
array of any of the above List<T>
NULL (xsi:nil="true") null

Open questions

  • Where the CIM type information comes from without an extra round trip per query (cache the class schema per client and class?).
  • Whether the WS-Management datetime encoding is consistent across Windows versions (2008 R2 through 2022 are available as test hosts).
  • Whether the CLI should emit JSON arrays/numbers/booleans/null when typed values are available (today it emits strings only).

Not in scope

The string API stays as it is: the | join and the empty-string NULL are documented behavior since 2.3.00.

主要語言
Java
星號
13
分支
4
平均合併
7 小時 38 分鐘
30 天內合併 PR
14

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

MetricsHub/winrm-java 的其他 Issue

查看 MetricsHub/winrm-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。