Package io.wcm.devops.conga.generator
Class UrlFileManager
- java.lang.Object
-
- io.wcm.devops.conga.generator.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 Summary
Constructors Constructor Description UrlFileManager(PluginManager pluginManager, UrlFilePluginContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteFile(String url)
Delete file with given URL.InputStream
getFile(String url)
Get file binary data from URL.String
getFileName(String url)
Get file name from URL.URL
getFileUrl(String url)
Get URL to to binary file.List<URL>
getFileUrlsWithDependencies(String url)
Get URLs of transitive dependencies of external file.File
getLocalFile(String url)
Get local file reference to given URL.boolean
isLocalFile(String url)
Checks if the given file is a file from the local file system and can be safely referenced via symlink.
-
-
-
Constructor Detail
-
UrlFileManager
public UrlFileManager(PluginManager pluginManager, UrlFilePluginContext context)
- Parameters:
pluginManager
- Plugin managercontext
- 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
-
getFile
public InputStream getFile(String url) throws IOException
Get file binary data from URL.- Parameters:
url
- URL string- Returns:
- Input stream
- 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
-
-