Class AbstractDownloadTask<T>

    • Constructor Detail

    • Method Detail

      • isCanceled

        public boolean isCanceled()
        Determines if the download task has been canceled.
        Returns:
        true if the download task has been canceled
      • setCanceled

        public void setCanceled​(boolean canceled)
        Marks this download task as canceled.
        Parameters:
        canceled - true to mark this download task as canceled
      • isFailed

        public boolean isFailed()
        Determines if the download task has failed.
        Returns:
        true if the download task has failed
      • setFailed

        public void setFailed​(boolean failed)
        Marks this download task as failed.
        Parameters:
        failed - true to mark this download task as failed
      • patterns

        protected static <T extends java.lang.Enum<T> & UrlPattern> java.lang.String[] patterns​(java.lang.Class<T> urlPatternEnum)
      • rememberException

        protected final void rememberException​(java.lang.Exception exception)
      • getDownloadedData

        public final T getDownloadedData()
        Replies the downloaded data.
        Returns:
        The downloaded data.
      • setZoomAfterDownload

        public final void setZoomAfterDownload​(boolean zoomAfterDownload)
        Description copied from interface: DownloadTask
        Sets whether the map view will zoom to download area after download
        Specified by:
        setZoomAfterDownload in interface DownloadTask
        Parameters:
        zoomAfterDownload - if true, the map view will zoom to download area after download
      • getErrorObjects

        public java.util.List<java.lang.Object> getErrorObjects()
        Description copied from interface: DownloadTask
        Replies the error objects of the task. Empty list, if no error messages are available.

        Error objects are either Strings with error messages or Exceptions.

        Specified by:
        getErrorObjects in interface DownloadTask
        Returns:
        the list of error objects
      • acceptsUrl

        public boolean acceptsUrl​(java.lang.String url)
        Determines if the given URL is accepted by getPatterns(). Can be overridden for more complex checking logic.
        Parameters:
        url - URL to download
        Returns:
        true if this URL is accepted
      • isSafeForRemotecontrolRequests

        public boolean isSafeForRemotecontrolRequests()
        Check / decide if the task is safe for remotecontrol.

        Keep in mind that a potential attacker has full control over the content of the file that will be downloaded. If it is possible to run arbitrary code or write to the local file system, then the task is (obviously) not save for remote execution.

        The default value is false = unsafe. Override in a subclass to allow running the task via remotecontol.

        Returns:
        true if it is safe to download and open any file of the corresponding format, false otherwise
      • acceptsUrl

        public boolean acceptsUrl​(java.lang.String url,
                                  boolean isRemotecontrol)
        Description copied from interface: DownloadTask
        Returns true if the task is able to open the given URL, false otherwise.
        Specified by:
        acceptsUrl in interface DownloadTask
        Parameters:
        url - the url to download from
        isRemotecontrol - True if download request comes from remotecontrol.
        Returns:
        True if the task is able to open the given URL, false otherwise. Return false, if the request comes from remotecontrol, but the task is not safe for remotecontrol. A task is not safe for remotecontrol if it is possible to prepare a file for download which does something unintended, e.g. gain access to the local file system.
      • getTitle

        public java.lang.String getTitle()
        Description copied from interface: DownloadTask
        Returns human-readable description of the task
        Specified by:
        getTitle in interface DownloadTask
        Returns:
        The task description
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getPatterns

        public java.lang.String[] getPatterns()
        Description copied from interface: DownloadTask
        Returns regular expressions that match the URLs
        Specified by:
        getPatterns in interface DownloadTask
        Returns:
        The array of accepted URL patterns