Package com.ferrumx.formatter.cim
Class CIM_ML
java.lang.Object
com.ferrumx.formatter.cim.CIM_ML
This class queries all the WMI Classes based on the attributes passed to it's
one of the four methods called by the methods in other packages.
Supports Multi-line parsing of output from the power-shell Is recommended for
extracting multiple properties at once For single property extraction, see
CIM_SL
- Author:
- Egg-03
-
Method Summary
Modifier and TypeMethodDescriptiongetPropertiesAndTheirValues
(String win32Class, String property) Internally runs the command "Get-CimInstance -ClassName win32Class | Select-Object property | Format-List where the parameters are provided by the calling methodsgetPropertiesAndTheirValuesWhere
(String win32Class, String determinantProperty, String determinantValue, String extractProperty) Internally runs the command "Get-CimInstance -ClassName win32Class | Where-Object {$_.determinantProperty -eq determinantValue} | Select-Object extractProperty | Format-List where the parameters are provided by the calling methodsgetPropertyValue
(String win32Class, String property) Internally runs the command "Get-CimInstance -ClassName win32Class | Select-Object property | Format-List where the parameters are provided by the calling methodsgetPropertyValueWhere
(String win32Class, String determinantProperty, String determinantValue, String extractProperty) Internally runs the command "Get-CimInstance -ClassName win32Class | Where-Object {$_.determinantProperty -eq determinantValue} | Select-Object extractProperty | Format-List where the parameters are provided by the calling methods
-
Method Details
-
getPropertyValue
public static List<String> getPropertyValue(String win32Class, String property) throws IOException, IndexOutOfBoundsException, ShellException, InterruptedException Internally runs the command "Get-CimInstance -ClassName win32Class | Select-Object property | Format-List where the parameters are provided by the calling methods- Parameters:
win32Class
- the class name passed to by the method calling itproperty
- name passed to by the method calling it- Returns:
- a list of property values requested by the method calling it. The values returned belong to the property defined by Property
- Throws:
IOException
- in case of general I/O errorsIndexOutOfBoundsException
- in case of text parsing issues from power-shellShellException
- if any internal command used in the power-shell throws errorsInterruptedException
- if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();
-
getPropertyValueWhere
public static List<String> getPropertyValueWhere(String win32Class, String determinantProperty, String determinantValue, String extractProperty) throws IOException, IndexOutOfBoundsException, ShellException, InterruptedException Internally runs the command "Get-CimInstance -ClassName win32Class | Where-Object {$_.determinantProperty -eq determinantValue} | Select-Object extractProperty | Format-List where the parameters are provided by the calling methods- Parameters:
win32Class
- the class name passed to by the calling methoddeterminantProperty
- a filtering parameter, passed to by the calling methoddeterminantValue
- the value of the filtering parameter, also passed to by the calling methodextractProperty
- the property name whose value is to be extracted, provided by the calling method.- Returns:
- a list of values requested by the method calling it. The values returned are the values of the property extractProperty
- Throws:
IOException
- in case of general I/O errorsIndexOutOfBoundsException
- in case of text parsing issues from power-shellShellException
- if any internal command used in the power-shell throws errorsInterruptedException
- if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();
-
getPropertiesAndTheirValues
public static Map<String,String> getPropertiesAndTheirValues(String win32Class, String property) throws IOException, IndexOutOfBoundsException, ShellException, InterruptedException Internally runs the command "Get-CimInstance -ClassName win32Class | Select-Object property | Format-List where the parameters are provided by the calling methods- Parameters:
win32Class
- the class name passed to by the calling methodproperty
- a list of properties requested for a particular class. The properties requested by the calling methods can be found in their respective class descriptions- Returns:
- a
Map
of the attribute values requested by the calling method - Throws:
IOException
- in case of general I/O errorsIndexOutOfBoundsException
- in case of text parsing issues from power-shellShellException
- if any internal command used in the power-shell throws errorsInterruptedException
- if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();
-
getPropertiesAndTheirValuesWhere
public static Map<String,String> getPropertiesAndTheirValuesWhere(String win32Class, String determinantProperty, String determinantValue, String extractProperty) throws IOException, IndexOutOfBoundsException, ShellException, InterruptedException Internally runs the command "Get-CimInstance -ClassName win32Class | Where-Object {$_.determinantProperty -eq determinantValue} | Select-Object extractProperty | Format-List where the parameters are provided by the calling methods- Parameters:
win32Class
- win32Class the class-name passed to by the calling methoddeterminantProperty
- a filtering parameter, passed to by the calling methoddeterminantValue
- the value of the filtering parameter, also passed to by the calling methodextractProperty
- a list of properties requested for a particular class. The properties requested by the calling methods can be found in their respective class descriptions- Returns:
- a
Map
of the attribute values requested by the calling method - Throws:
IOException
- in case of general I/O errorsIndexOutOfBoundsException
- in case of text parsing issues from power-shellShellException
- if any internal command used in the power-shell throws errorsInterruptedException
- if the thread waiting for the process to exit, gets interrupted. When catching this exception, you may re-throw it's interrupted status by using Thread.currentThread().interrupt();
-