Class UrlFileManager


  • public final class UrlFileManager
    extends Object
    Manages copy/download of external files referenced in CONGA roles by URL, filesystem, classpath or Maven coordinates.
    • Constructor Detail

      • UrlFileManager

        public UrlFileManager​(PluginManager pluginManager,
                              UrlFilePluginContext context)
        Parameters:
        pluginManager - Plugin manager
        context - URL file plugin context
    • Method Detail

      • getFileName

        public String getFileName​(String url)
                           throws IOException
        Get file name from URL.
        Parameters:
        url - URL string
        Returns:
        File name
        Throws:
        IOException - I/O exception
      • getFileUrl

        public URL getFileUrl​(String url)
                       throws IOException
        Get URL to to binary file.
        Parameters:
        url - URL string
        Returns:
        URL
        Throws:
        IOException - I/O exception
      • getFileUrlsWithDependencies

        public List<URL> getFileUrlsWithDependencies​(String url)
                                              throws IOException
        Get URLs of transitive dependencies of external file. This usually applies only to Maven artifacts. The returned list includes the URL of the artifact itself, and all it's transitive dependencies.
        Parameters:
        url - URL string (including prefix)
        Returns:
        URLs to files
        Throws:
        IOException - If the access to the file failed
      • deleteFile

        public void deleteFile​(String url)
                        throws IOException
        Delete file with given URL. This is only supported for files in the local filesystem.
        Parameters:
        url - URL string
        Throws:
        IOException - I/O exception
      • isLocalFile

        public boolean isLocalFile​(String url)
                            throws IOException
        Checks if the given file is a file from the local file system and can be safely referenced via symlink.
        Parameters:
        url - URL string (including prefix)
        Returns:
        true if file is a local file
        Throws:
        IOException - If the access to the file failed
      • getLocalFile

        public File getLocalFile​(String url)
                          throws IOException
        Get local file reference to given URL.
        Parameters:
        url - URL string (including prefix)
        Returns:
        Local file reference.
        Throws:
        IOException - If the access to the file failed