public void DownloadUsingSWIFT() throws Exception {

    while (true) {
      Collection<StoredObject> list =
          swiftapi.ReadBucket(SWIFT_ACCESS_KEY_ID, SWIFT_SECRET_KEY, SWIFT_ENDPOINT, SWIFT_BUCKET);

      int scount = list.size();
      int localCount = new File(LOCAL_DIR).listFiles().length;
      if (scount != localCount) {

        for (StoredObject obj : list) {

          if (!(new File(LOCAL_DIR, obj.getName()).exists())) {
            System.out.println("Downloading - " + obj.getName());
            vLogger.LogInfo("emcWorldDownloader: Downloading - " + obj.getName());
            InputStream in =
                swiftapi.ReadObject(
                    SWIFT_ACCESS_KEY_ID,
                    SWIFT_SECRET_KEY,
                    SWIFT_ENDPOINT,
                    SWIFT_BUCKET,
                    obj.getName());

            File file = new File(LOCAL_DIR + obj.getName());

            int count = 0;
            byte[] buf = new byte[1024];
            OutputStream out = new FileOutputStream(file);
            while ((count = in.read(buf)) != -1) {
              if (Thread.interrupted()) {
                throw new InterruptedException();
              }
              out.write(buf, 0, count);
            }
            out.close();
            in.close();
          } else {
            System.out.println("Skipping - " + obj.getName());
            vLogger.LogInfo("emcWorldDownloader: Skipping - " + obj.getName());
          }
        }
      } else System.out.println("No New Files Yet");

      vLogger.LogInfo("emcWorldDownloader: Skipping - Sleep 60 seconds");
      System.out.println("Sleep for 1 minute");
      Thread.sleep(60000);
    }
  }
  public void DownloadUsingS3() throws Exception {

    while (true) {
      ObjectListing list =
          s3api.ReadBucket(S3_ACCESS_KEY_ID, S3_SECRET_KEY, S3_ENDPOINT, null, S3_BUCKET);

      System.out.println("bucket files count " + list.getObjectSummaries().size());
      vLogger.LogInfo("emcWorldDownloader: bucket files count " + list.getObjectSummaries().size());

      int s3Count = list.getObjectSummaries().size();
      int localCount = new File(LOCAL_DIR).listFiles().length;
      if (s3Count != localCount) {

        for (S3ObjectSummary obj : list.getObjectSummaries()) {

          if (!(new File(LOCAL_DIR, obj.getKey()).exists())) {
            System.out.println("Downloading - " + obj.getKey());
            vLogger.LogInfo("emcWorldDownloader: Downloading - " + obj.getKey());
            S3ObjectInputStream in =
                s3api.ReadObject(
                    S3_ACCESS_KEY_ID, S3_SECRET_KEY, S3_ENDPOINT, null, S3_BUCKET, obj.getKey());

            File file = new File(LOCAL_DIR + obj.getKey());

            int count = 0;
            byte[] buf = new byte[1024];
            OutputStream out = new FileOutputStream(file);
            while ((count = in.read(buf)) != -1) {
              if (Thread.interrupted()) {
                throw new InterruptedException();
              }
              out.write(buf, 0, count);
            }
            out.close();
            in.close();
          } else {
            System.out.println("Skipping - " + obj.getKey());
            vLogger.LogInfo("emcWorldDownloader: Skipping - " + obj.getKey());
          }
        }
      } else System.out.println("No New Files Yet");

      vLogger.LogInfo("emcWorldDownloader: Skipping - Sleep 60 seconds");
      System.out.println("Sleep for 1 minute");
      Thread.sleep(60000);
    }
  }