void printHttpNfcLeaseInfo(HttpNfcLeaseInfo info, String hostName) {
   System.out.println("########################################################");
   System.out.println("HttpNfcLeaseInfo");
   System.out.println("Lease Timeout: " + info.getLeaseTimeout());
   System.out.println("Total Disk capacity: " + info.getTotalDiskCapacityInKB());
   List<HttpNfcLeaseDeviceUrl> deviceUrlArr = info.getDeviceUrl();
   int deviceUrlCount = 1;
   for (HttpNfcLeaseDeviceUrl durl : deviceUrlArr) {
     System.out.println("HttpNfcLeaseDeviceUrl : " + deviceUrlCount++);
     System.out.println("   Device URL Import Key: " + durl.getImportKey());
     System.out.println("   Device URL Key: " + durl.getKey());
     System.out.println("   Device URL : " + durl.getUrl());
     System.out.println("   Updated device URL: " + durl.getUrl().replace("*", hostName));
     System.out.println("   SSL Thumbprint : " + durl.getSslThumbprint());
   }
   System.out.println("########################################################");
 }
  void exportVM() throws RuntimeFaultFaultMsg, InvalidPropertyFaultMsg {
    File file = new File(localPath);
    if (!file.exists()) {
      System.out.println("Wrong or invalid path " + localPath);
      return;
    }
    ManagedObjectReference srcMOR =
        getMOREFs.inFolderByType(serviceContent.getRootFolder(), "HostSystem").get(host);
    if (srcMOR == null) {
      throw new RuntimeException(" Source Host " + host + " Not Found.");
    }
    ManagedObjectReference vmMoRef = getMOREFs.inFolderByType(srcMOR, "VirtualMachine").get(vmname);

    if (vmMoRef == null) {
      throw new RuntimeException("Virtual Machine " + vmname + " Not Found.");
    }
    System.out.println("Getting the HTTP NFCLEASE for the VM: " + vmname);
    try {
      ManagedObjectReference httpNfcLease = vimPort.exportVm(vmMoRef);

      Object[] result =
          waitForValues.wait(
              httpNfcLease,
              new String[] {"state"},
              new String[] {"state"},
              new Object[][] {new Object[] {HttpNfcLeaseState.READY, HttpNfcLeaseState.ERROR}});
      if (result[0].equals(HttpNfcLeaseState.READY)) {
        System.out.println("HttpNfcLeaseState: " + result[0]);
        HttpNfcLeaseInfo httpNfcLeaseInfo =
            (HttpNfcLeaseInfo)
                getMOREFs.entityProps(httpNfcLease, new String[] {"info"}).get("info");
        httpNfcLeaseInfo.setLeaseTimeout(300000000);
        printHttpNfcLeaseInfo(httpNfcLeaseInfo, host);
        long diskCapacity = (httpNfcLeaseInfo.getTotalDiskCapacityInKB()) * 1024;
        TOTAL_BYTES = diskCapacity;
        leaseExtender = new OVFManagerExportVMDK().new HttpNfcLeaseExtender(httpNfcLease, vimPort);
        Thread t = new Thread(leaseExtender);
        t.start();
        List<HttpNfcLeaseDeviceUrl> deviceUrlArr = httpNfcLeaseInfo.getDeviceUrl();
        for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrlArr) {
          System.out.println("Downloading Files:");
          String deviceUrlStr = deviceUrl.getUrl();
          String absoluteFile = deviceUrlStr.substring(deviceUrlStr.lastIndexOf("/") + 1);
          System.out.println("Absolute File Name: " + absoluteFile);
          System.out.println("VMDK URL: " + deviceUrlStr.replace("*", host));
          writeVMDKFile(absoluteFile, deviceUrlStr.replace("*", host), diskCapacity, vmname);
        }
        System.out.println("Completed Downloading the files");
        vmdkFlag = true;
        t.interrupt();
        vimPort.httpNfcLeaseProgress(httpNfcLease, 100);
        vimPort.httpNfcLeaseComplete(httpNfcLease);
      } else {
        System.out.println("HttpNfcLeaseState not ready");
        for (Object o : result) {
          System.out.println("HttpNfcLeaseState: " + o);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }