ui/src/main/java/thredds/ui/monitor/TdsDownloader.java
public void getRemoteFiles(final CancelTask _cancel) {
    this.cancel = _cancel;

    String urls = config.getServerPrefix() + "/thredds/admin/log/"+type+"/";
    ta.append(String.format("Download URL = %s%n", urls));

    String contents = null;
    try (HTTPMethod method = HTTPFactory.Get(session, urls)) {
        int statusCode = method.execute();
        if (statusCode == 200)
          contents = method.getResponseAsString();

      if ((contents == null) || (contents.length() == 0)) {
        ta.append(String.format("Failed to get logs at URL = %s%n%n", urls));
        return;
      } else {
        ta.append(String.format("Logs at URL = %s%n%s%n", urls, contents));
      }
    } catch (Throwable t) {
      ta.append(String.format("Failed to get logs at URL = %s error = %s%n%n", urls, t.getMessage()));
      t.printStackTrace();
      return;
    }

    // update text area in background  http://technobuz.com/2009/05/update-jtextarea-dynamically/
    final String list = contents;
    SwingWorker worker = new SwingWorker<String, Void>() {

      @Override
      protected String doInBackground() throws Exception {
        try {
          ta.append(String.format("Local log files stored in = %s%n%n", localDir));
          String[] lines = list.split("\n");
          for (String line : lines) {
            new RemoteLog(line.trim());
            if (cancel.isCancel()) {
              break;
            }
          }
        } catch (Throwable t) {
          t.printStackTrace();
        }

        return null;
      }

      public void done() {
        if (cancel.isCancel())
          ta.append(String.format("Download was cancelled for %s%n", type));
        else
          ta.append(String.format("Download complete for %s%n", type));
      }
    };

    // do in background
    worker.execute();
  }
public void getRemoteFiles(final CancelTask _cancel) {
    this.cancel = _cancel;

    String urls = config.getServerPrefix() + "/thredds/admin/log/"+type+"/";
    ta.append(String.format("Download URL = %s%n", urls));

    String contents = null;
    try (HTTPMethod method = HTTPFactory.Get(session, urls)) {
        int statusCode = method.execute();
        if (statusCode == 200)
          contents = method.getResponseAsString();

      if ((contents == null) || (contents.length() == 0)) {
        ta.append(String.format("Failed to get logs at URL = %s%n%n", urls));
        return;
      } else {
        ta.append(String.format("Logs at URL = %s%n%s%n", urls, contents));
      }
    } catch (Throwable t) {
      ta.append(String.format("Failed to get logs at URL = %s error = %s%n%n", urls, t.getMessage()));
      t.printStackTrace();
      return;
    }

    // update text area in background  http://technobuz.com/2009/05/update-jtextarea-dynamically/
    final String list = contents;
    SwingWorker worker = new SwingWorker<String, Void>() {

      @Override
      protected String doInBackground() throws Exception {
        try {
          ta.append(String.format("Local log files stored in = %s%n%n", localDir));
          String[] lines = list.split("\n");
          for (String line : lines) {
            new RemoteLog(line.trim());
            if (cancel.isCancel()) {
              break;
            }
          }
        } catch (Throwable t) {
          t.printStackTrace();
        }

        return null;
      }

      public void done() {
        if (cancel.isCancel())
          ta.append(String.format("Download was cancelled for %s%n", type));
        else
          ta.append(String.format("Download complete for %s%n", type));
      }
    };

    // do in background
    worker.execute();
  }
public void getRemoteFiles ( final CancelTask _cancel ) { this . cancel = _cancel ; String urls = config . getServerPrefix ( ) + "/thredds/admin/log/" + type + "/" ; ta . append ( String . format ( "Download URL = %s%n" , urls ) ) ; String contents = null ; try ( HTTPMethod method = HTTPFactory . Get ( session , urls ) ) { int statusCode = method . execute ( ) ; if ( statusCode == 200 ) contents = method . getResponseAsString ( ) ; if ( ( contents == null ) || ( contents . length ( ) == 0 ) ) { ta . append ( String . format ( "Failed to get logs at URL = %s%n%n" , urls ) ) ; return ; } else { ta . append ( String . format ( "Logs at URL = %s%n%s%n" , urls , contents ) ) ; } } catch ( Throwable t ) { ta . append ( String . format ( "Failed to get logs at URL = %s error = %s%n%n" , urls , t . getMessage ( ) ) ) ; t . printStackTrace ( ) ; return ; } // update text area in background  http://technobuz.com/2009/05/update-jtextarea-dynamically/
 final String list = contents ; SwingWorker worker = new SwingWorker < String , Void > ( ) { @ Override protected String doInBackground ( ) throws Exception { try { ta . append ( String . format ( "Local log files stored in = %s%n%n" , localDir ) ) ; String [ ] lines = list . split ( "\n" ) ; for ( String line : lines ) { new RemoteLog ( line . trim ( ) ) ; if ( cancel . isCancel ( ) ) { break ; } } } catch ( Throwable t ) { t . printStackTrace ( ) ; } return null ; } public void done ( ) { if ( cancel . isCancel ( ) ) ta . append ( String . format ( "Download was cancelled for %s%n" , type ) ) ; else ta . append ( String . format ( "Download complete for %s%n" , type ) ) ; } } ; // do in background
 worker . execute ( ) ; }
copy remote files to localDir
copy remote files to localDir