@Override
  public void run() {
    _init();
    Thread thread = Thread.currentThread();
    thread.setName("ExcellerisController" + "[" + thread.getId() + "]");

    logger.debug("Running [" + thread.getName() + "]");

    Node rootTag = null;
    String messageCount = null;
    String messageFormat = null;
    String messageVersion = null;
    // NamedNodeMap nodemap = null;
    // Document response = null;
    // Node code = null;
    String ackReturnCode = null;
    setLastFileCount(0);

    if (hostLogin()) {

      try {
        // fetch data
        logger.info("Fetching Excelleris labs from " + FETCH);
        getLabConnection().fetch(FETCH);
      } catch (SocketTimeoutException e) {
        handleError(
            "Connection timeout occured while attempting to fetch lab files. Check internet connectivity. ",
            e,
            ERROR);
      } catch (IOException e) {
        handleError("Expedius has failed to fetch lab files. Contact support. ", e, ERROR);
      } /*catch (ParserConfigurationException e) {
        	handleError("There was a problem with parsing the server response while fetching lab files.", e, ERROR);
        }  */ finally {
        // for maintenance.
        close();
      }

      // save data
      if (getLabConnection().getResponseCode() == HttpsURLConnection.HTTP_OK) {

        if (getLabConnection().hasResponse()) {

          rootTag = getDocumentHandler().getRoot();

          if (NODE_HL7MESSAGES.equalsIgnoreCase(rootTag.getNodeName())) {
            messageCount = getDocumentHandler().getNodeAttributeValue(NODE_MESSAGECOUNT, rootTag);
            messageFormat = getDocumentHandler().getNodeAttributeValue(NODE_MESSAGEFORMAT, rootTag);
            messageVersion = getDocumentHandler().getNodeAttributeValue(NODE_VERSION, rootTag);

            logger.info(NODE_MESSAGECOUNT + ": " + messageCount);
            logger.info(NODE_MESSAGEFORMAT + ": " + messageFormat);
            logger.info(NODE_VERSION + ": " + messageVersion);
          }
        }

        if (getLastFileCount() > 0) {
          getLabHandler().setLabType(EXCELLERIS_LAB_TYPE);
          super.processResults(getDocumentHandler().getDocument(), labType);
        }
      }

      //						response = getLabConnection().getResponse();
      //						rootTag = response.getDocumentElement();
      //
      //						if(rootTag.getNodeName().equalsIgnoreCase(NODE_HL7MESSAGES)) {
      //
      //							nodemap = rootTag.getAttributes();
      //
      //							if(nodemap.getLength() > 0) {
      //
      //								messageCount = nodemap.getNamedItem(NODE_MESSAGECOUNT).getNodeValue();
      //								messageFormat = nodemap.getNamedItem(NODE_MESSAGEFORMAT).getNodeValue();
      //								messageVersion = nodemap.getNamedItem(NODE_VERSION).getNodeValue();
      //
      //								logger.info(NODE_MESSAGECOUNT + ": " + messageCount);
      //								logger.info(NODE_MESSAGEFORMAT + ": " + messageFormat);
      //								logger.info(NODE_VERSION + ": " + messageVersion);
      //
      //								if(messageCount != null) {
      //									setLastFileCount(Integer.parseInt(messageCount));
      //									logger.info( messageCount + " Excelleris labs downloaded");
      //								}
      //
      //							}
      //
      //						} else {
      //							logger.error("Error: No, or incorrect, content from server. Root Tag:
      // "+rootTag.toString());
      //						}
      //					}

      // }

      // CAUTION - disable acknowledge for testing. You will loose all your test labs.
      if ((ACKNOWLEDGE_DOWNLOADS.equalsIgnoreCase("true"))
          && (getLabHandler().getResponseCode() == HttpsURLConnection.HTTP_OK)) {
        try {
          getLabConnection().acknowledge(ACKNOWLEDGE);
        } catch (SocketTimeoutException e) {
          handleError(
              "Connection timeout occured while attempting to fetch lab files. Check internet connectivity. ",
              e,
              ERROR);
        } catch (IOException e) {
          handleError("Expedius has failed to fetch lab files. Contact support. ", e, ERROR);
        }

        if (getLabConnection().hasResponse()) {

          ackReturnCode =
              getDocumentHandler()
                  .getNodeAttributeValue(NODE_RETURNCODE, getDocumentHandler().getRoot());

          if (ACK_RETURN_CODE.equalsIgnoreCase(ackReturnCode)) {
            logger.info("All Labs Acknowledged: " + ackReturnCode);
          } else {
            handleError(
                "Expedius has failed to acknowledge the last lab download. "
                    + "This could result in multiple copies of the same lab. Excelleris server acknowledge return code was "
                    + ackReturnCode
                    + "If this error does not resolve in 24 hours, contact support.",
                null,
                DISMISSABLE_ERROR);
          }
        }
      }
      //
      //							rootTag = getLabConnection().getResponse().getDocumentElement();
      //							nodemap = rootTag.getAttributes();
      //
      //							if(nodemap.getLength() > 0) {
      //
      //								code = nodemap.getNamedItem(NODE_RETURNCODE);
      //
      //								if(Integer.parseInt(code.getNodeValue().toString()) == 0) {
      //
      //								} else {
      //									logger.error(rootTag.toString() + " Invalid response code");
      //								}
      //
      //							} else {
      //
      //							}
      //						}
      //
      //					} else {
      //
      //					}
      //
      //				} else {
      //					logger.info("Acknowledge not enabled. This lab file will be downloaded again.");
      //				}

      // catch all server response codes.
      processServerResponse(getLabConnection().getResponseCode());

      //			} catch (SocketTimeoutException e) {
      //				handleError("Connection timeout occured while attempting to fetch lab files. Check
      // internet connectivity. ", e, ERROR);
      //			} catch (IOException e) {
      //				handleError("Expedius has failed to fetch lab files. Contact support. ", e, ERROR);
      //			} catch (ParserConfigurationException e) {
      //				handleError("There was a problem with parsing the server response while fetching lab
      // files.", e, ERROR);
      //			}  finally {
      //				close();
      //			}
    }
  }