Interface WmiQueryExecutor

All Known Implementing Classes:
WmiQueryExecutorJNA, WmiQueryHandler

public interface WmiQueryExecutor
Common interface for executing WMI queries, abstracting JNA and FFM implementations.

JNA users who wish to customize COM initialization (e.g., to avoid per-query COM init/uninit overhead) should extend oshi.util.platform.windows.WmiQueryHandler in the oshi-core module. See the oshi-demo module for examples.

  • Method Details

    • queryWMI

      <T extends Enum<T>> WmiResult<T> queryWMI(WmiQuery<T> query)
      Query WMI for values. Initializes and uninitializes COM for each query.
      Type Parameters:
      T - the enum type for the query properties
      Parameters:
      query - the WMI query
      Returns:
      the query results
    • queryWMI

      <T extends Enum<T>> WmiResult<T> queryWMI(WmiQuery<T> query, boolean initCom)
      Query WMI for values.
      Type Parameters:
      T - the enum type for the query properties
      Parameters:
      query - the WMI query
      initCom - whether to initialize COM for this query. If false, assumes COM is already initialized.
      Returns:
      the query results
    • createInstance

      static WmiQueryExecutor createInstance()
      Creates a new instance of the platform-appropriate WMI query executor.

      On JNA, this returns an instance of WmiQueryHandler (or a user-configured subclass). On FFM, this returns an instance of WmiQueryHandlerFFM.

      Returns:
      a new executor instance, or null if creation fails