Class SEDownloader

java.lang.Object
org.gvsig.compat.se.net.downloader.se.SEDownloader
All Implemented Interfaces:
org.gvsig.compat.net.Downloader, Downloader

public class SEDownloader extends Object implements Downloader
Clase con métodos de utilidad en el protocolo WMS
  • Constructor Details

    • SEDownloader

      public SEDownloader()
  • Method Details

    • getExecutorUI

      public Executor getExecutorUI()
    • getPreviousDownloadedURL

      protected File getPreviousDownloadedURL(URL url, String data)
      Return the content of a file that has been created from a URL using the HTTP POST protocol
      Parameters:
      url - The URL
      data - The data to send on the query
      Returns:
      File containing this URL's content or null if no file was found.
    • addDownloadedURL

      public void addDownloadedURL(URL url, String filePath)
      Adds an URL to the table of downloaded files for further uses. If the URL already exists in the table its filePath value is updated to the new one and the old file itself is removed from the file system.
      Specified by:
      addDownloadedURL in interface Downloader
      Parameters:
      url -
      filePath -
    • downloadFile

      public File downloadFile(URL url, String name, org.gvsig.compat.net.ICancellable cancel) throws IOException, ConnectException, UnknownHostException
      Downloads an URL into a temporary file that is removed the next time the tempFileManager class is called, which means the next time gvSIG is launched.
      Specified by:
      downloadFile in interface org.gvsig.compat.net.Downloader
      Parameters:
      url -
      name -
      Returns:
      Throws:
      IOException
      ConnectException
      UnknownHostException
    • downloadFile

      public File downloadFile(URL url, String data, String name, org.gvsig.compat.net.ICancellable cancel) throws IOException, ConnectException, UnknownHostException
      Downloads a URL using the HTTP Post protocol
      Specified by:
      downloadFile in interface org.gvsig.compat.net.Downloader
      Parameters:
      url - The server URL
      data - The data to send in the request
      name - A common name for all the retrieved files
      cancel - Used to cancel the downloads
      Returns:
      The retrieved file
      Throws:
      IOException
      ConnectException
      UnknownHostException
    • downloadFile

      public File downloadFile(URL url, String data, String name, org.gvsig.compat.net.ICancellable cancel, int maxbytes) throws IOException, ConnectException, UnknownHostException
      Specified by:
      downloadFile in interface org.gvsig.compat.net.Downloader
      Throws:
      IOException
      ConnectException
      UnknownHostException
    • downloadFile

      public File downloadFile(URL url, String method, org.apache.http.entity.ContentType contenttype, String data, String name, org.gvsig.compat.net.ICancellable cancel) throws IOException, ConnectException, UnknownHostException
      Specified by:
      downloadFile in interface org.gvsig.compat.net.Downloader
      Throws:
      IOException
      ConnectException
      UnknownHostException
    • downloadFile

      public File downloadFile(URL url, String method, org.apache.http.entity.ContentType contenttype, String data, String name, org.gvsig.compat.net.ICancellable cancel, int maxbytes) throws IOException, ConnectException, UnknownHostException
      Specified by:
      downloadFile in interface org.gvsig.compat.net.Downloader
      Throws:
      IOException
      ConnectException
      UnknownHostException
    • downloadFile

      public File downloadFile(URL url, String method, org.apache.http.entity.ContentType contenttype, String data, String name, org.gvsig.compat.net.ICancellable cancel, int maxbytes, boolean useCache) throws IOException, ConnectException, UnknownHostException
      Specified by:
      downloadFile in interface org.gvsig.compat.net.Downloader
      Throws:
      IOException
      ConnectException
      UnknownHostException
    • getCanceled

      public boolean getCanceled(Object groupId)
      Try if a group of downloads has been canceled
      Specified by:
      getCanceled in interface Downloader
      Parameters:
      groupId - Group id
      Returns:
      If the group has been canceled
    • setCanceled

      public void setCanceled(Object groupId, boolean isCanceled)
      Cancel a group of downloads
      Specified by:
      setCanceled in interface Downloader
      Parameters:
      groupId - Group id
      isCanceled - if the group has to be canceled
    • removeURL

      public void removeURL(URL url)
      Remove an URL from the system cache. The file will remain in the file system for further eventual uses.
      Specified by:
      removeURL in interface org.gvsig.compat.net.Downloader
      Parameters:
      url -
    • removeURL

      public void removeURL(Object url)
      Remove an URL from the system cache. The file will remain in the file system for further eventual uses.
      Specified by:
      removeURL in interface org.gvsig.compat.net.Downloader
      Parameters:
      url -
    • setDownloadException

      public void setDownloadException(Exception exception)
      Specified by:
      setDownloadException in interface Downloader
    • getLatency

      public long getLatency()
      Specified by:
      getLatency in interface Downloader
    • createDownloaderTask

      protected Runnable createDownloaderTask(SEDownloader downloader, Executor executor, URL url, String data, File target, Object groupID, int maxbytes)
    • createDownloaderTask

      protected Runnable createDownloaderTask(SEDownloader downloader, Executor executor, URL url, String method, org.apache.http.entity.ContentType contenttype, String data, File target, Object groupID, int maxbytes)
    • cleanUpTempFiles

      public void cleanUpTempFiles()
      Cleans every temporal file previously downloaded.
      Specified by:
      cleanUpTempFiles in interface org.gvsig.compat.net.Downloader
    • getUniqueTemporaryFile

      protected File getUniqueTemporaryFile(String name)