/**
   * performInstanceOf
   *
   * @param params a {@link org.opennms.protocols.wmi.WmiParams} object.
   * @return a {@link org.opennms.protocols.wmi.WmiResult} object.
   * @throws org.opennms.protocols.wmi.WmiException if any.
   */
  public WmiResult performInstanceOf(final WmiParams params) throws WmiException {
    final ArrayList<Object> wmiObjects = new ArrayList<Object>();
    final OnmsWbemObjectSet wos = m_WmiClient.performInstanceOf(params.getWmiClass());

    for (int i = 0; i < wos.count(); i++) {
      wmiObjects.add(wos.get(i).getWmiProperties().getByName(params.getWmiObject()).getWmiValue());
    }

    final WmiResult result = new WmiResult(wmiObjects);

    if (params.getCompareOperation().equals("NOOP")) {
      result.setResultCode(WmiResult.RES_STATE_OK);
    } else if (params.getCompareOperation().equals("EQ")
        || params.getCompareOperation().equals("NEQ")
        || params.getCompareOperation().equals("GT")
        || params.getCompareOperation().equals("LT")) {
      performResultCheck(result, params);
    } else {
      result.setResultCode(WmiResult.RES_STATE_UNKNOWN);
    }

    return result;
  }
 /**
  * This is for tests to harness and create a mock client. Do not use!
  *
  * @param client allows a IWmiClient to be pre-instantiated. Used for mock testing.
  * @throws org.opennms.protocols.wmi.WmiException is thrown if there are any problems connecting.
  */
 public void init(final IWmiClient client) throws WmiException {
   m_WmiClient = client;
   m_WmiClient.connect(m_Domain, m_Username, m_Password);
 }
 /**
  * close
  *
  * @throws org.opennms.protocols.wmi.WmiException if any.
  */
 public void close() throws WmiException {
   if (m_WmiClient == null) {
     throw new WmiException("Failed to close client: WmiClient was not initialized.");
   }
   m_WmiClient.disconnect();
 }
 /**
  * This creates a new WmiClient and creates a connection to the host.
  *
  * @throws org.opennms.protocols.wmi.WmiException An exception will be thrown if the system is
  *     unable to look up the host and if J-Interop throws an exception this will re-throw that
  *     exception so that implementors need not know J-Interop exceptions.
  */
 public void init() throws WmiException {
   m_WmiClient = (IWmiClient) new WmiClient(m_HostName);
   m_WmiClient.connect(m_Domain, m_Username, m_Password);
 }