Interface OptionalCommonServiceInterface<S>

Type Parameters:
S - the entity type returned by the service implementation
All Known Implementing Classes:
HardwareIdService, Win32ComputerSystemService

public interface OptionalCommonServiceInterface<S>
Common service interface whose method implementations provide a way to fetch WMI data from PowerShell in the form of Optional

Useful for implementing services of classes which return exactly one instance such as the Win32_ComputerSystem WMI class

Since:
2.2.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
    Implementations of this method are expected to query the PowerShell using methods that automatically handle the PowerShell process lifecycle and then map the results to the expected entity types using a custom implementation or the default methods of CommonMappingInterface
    get(long timeout)
    Implementations of this method are expected to skip PowerShell entirely and rely on TerminalUtility instead for PowerShell session management and then map the results to the expected entity types using a custom implementation or the default methods of CommonMappingInterface
    get(com.profesorfalken.jpowershell.PowerShell powerShell)
    Implementations of this method are expected to query the PowerShell using methods that delegate the responsibility of managing the PowerShell session to the caller and then map the results to the expected entity types using a custom implementation or the default methods of CommonMappingInterface
  • Method Details

    • get

      Optional<S> get()
      Implementations of this method are expected to query the PowerShell using methods that automatically handle the PowerShell process lifecycle and then map the results to the expected entity types using a custom implementation or the default methods of CommonMappingInterface
      Returns:
      an Optional entity of type <S> defined by the caller
      Since:
      2.2.0
    • get

      Optional<S> get(com.profesorfalken.jpowershell.PowerShell powerShell)
      Implementations of this method are expected to query the PowerShell using methods that delegate the responsibility of managing the PowerShell session to the caller and then map the results to the expected entity types using a custom implementation or the default methods of CommonMappingInterface
      Parameters:
      powerShell - the caller-managed PowerShell session passed to the method
      Returns:
      an Optional entity of type <S> defined by the caller
      Since:
      2.2.0
    • get

      Optional<S> get(long timeout)
      Implementations of this method are expected to skip PowerShell entirely and rely on TerminalUtility instead for PowerShell session management and then map the results to the expected entity types using a custom implementation or the default methods of CommonMappingInterface
      Parameters:
      timeout - the maximum time (in seconds) to wait for the PowerShell command to complete before terminating the process
      Returns:
      an Optional entity of type <S> defined by the caller
      Since:
      3.1.0