Package org.metricshub.winrm.wql
Class WinRMWqlExecutor
java.lang.Object
org.metricshub.winrm.wql.WinRMWqlExecutor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic WinRMWqlExecutorexecuteWql(WinRMHttpProtocolEnum protocol, String hostname, Integer port, String username, char[] password, String namespace, String wqlQuery, long timeout, Path ticketCache, List<AuthenticationEnum> authentications) Execute a WQL query and process its result.longGet the execution time of the query.Get the headers of the query.getRows()Get the result rows of the query.
-
Constructor Details
-
WinRMWqlExecutor
The WinRMWqlExecutor constructor- Parameters:
executionTime- The execution time in millisecondsheaders- The headers list (copied defensively)rows- The value rows list (copied defensively)
-
-
Method Details
-
getExecutionTime
public long getExecutionTime()Get the execution time of the query.- Returns:
-
getHeaders
Get the headers of the query.- Returns:
- an unmodifiable view of the headers list
-
getRows
Get the result rows of the query.- Returns:
- an unmodifiable view of the result rows
-
executeWql
public static WinRMWqlExecutor executeWql(WinRMHttpProtocolEnum protocol, String hostname, Integer port, String username, char[] password, String namespace, String wqlQuery, long timeout, Path ticketCache, List<AuthenticationEnum> authentications) throws WinRMException, WqlQuerySyntaxException, TimeoutException Execute a WQL query and process its result.- Parameters:
protocol- The HTTP protocol (HTTP by default)hostname- Host to connect to. (Mandatory)port- The port (5985 for HTPP or 5986 for HTTPS by default)username- The username name. (Mandatory)password- The passwordnamespace- The namespace default value: "ROOT\\CIMV2"wqlQuery- The WQL query (Mandatory)timeout- The timeout in milliseconds (throws an IllegalArgumentException if negative or zero)ticketCache- The Ticket Cache pathauthentications- List of authentications. only NTLM if absent- Returns:
- WinRMWqlExecutor result instance with header, rows and execution time.
- Throws:
WinRMException- For any problem encountered on remoteWqlQuerySyntaxException- On WQL syntax errorsTimeoutException- To notify userName of timeout
-