Typed WQL results: map CIM values to Java objects instead of strings
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
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 內容生成。
描述
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 declaredObjectbut always returns aString.- 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.
NULLis 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>forCIM_DATETIMEvalues, 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 aWqlRow.typed(String)/WqlRow.list(String)accessor family; the legacyList<Map<String, Object>>ofWindowsRemoteExecutor.executeWqlcould also carry typed values under an opt-in flag, soWinRMWqlExecutorkeeps 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 WSManGetof the class definition,winrm get wmi/...?__CLASS, or thep: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,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
MetricsHub/winrm-java 的其他 Issue
-
bug documentation
難度 2/5 1-3 小時 新手友好度 88/100
MetricsHub/winrm-java#202 ·
維護者通常 1 天內回覆
-
enhancement
難度 3/5 1-2 天 新手友好度 58/100
MetricsHub/winrm-java#201 ·
維護者通常 1 天內回覆
-
bug
難度 3/5 1-2 天 新手友好度 78/100
MetricsHub/winrm-java#199 ·
維護者通常 1 天內回覆
-
Streaming command fails with a spurious timeout when reconnecting after an idle pause可能已有人在做 @NassimBtk 於 1 天前認領。 未關閉
MetricsHub/winrm-java#198 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Long-lived `WinRMClient` keeps failing with WSManFault 2150859174 after a terminate Signal fails可能已有人在做 @NassimBtk 於 1 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 25/100
MetricsHub/winrm-java#196 · 4 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 MetricsHub/winrm-java 的全部 Issue
相似的 Issue
-
Fix Math.ceilDiv wrong result for exact positive divisions可能已有人在做 @pamod-madubashana 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 88/100
scala-native/scala-native#5094 ·
維護者通常 1 天內回覆
-
[Bug] AI unread message badge counts a batch of new bubbles as one message可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 74/100
apache/rocketmq-dashboard#5784 ·
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
PCL-Community/PCL-CE#3658 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
apache/skywalking#14127 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆