Interface UrlFilePlugin
-
- All Superinterfaces:
Plugin
- All Known Implementing Classes:
ClasspathUrlFilePlugin
,FilesystemUrlFilePlugin
,HttpUrlFilePlugin
public interface UrlFilePlugin extends Plugin
Get files from external sources.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
accepts(String url, UrlFilePluginContext context)
Checks if the plugin can be applied to the given URL.default void
deleteFile(String url, UrlFilePluginContext context)
Delete file with given URL.InputStream
getFile(String url, UrlFilePluginContext context)
Get binary data of external file.String
getFileName(String url, UrlFilePluginContext context)
Get filename for external file.default URL
getFileUrl(String url, UrlFilePluginContext context)
Get URL to external file.default List<URL>
getFileUrlsWithDependencies(String url, UrlFilePluginContext context)
Get URLs of transitive dependencies of external file.default File
getLocalFile(String url, UrlFilePluginContext context)
Get local file reference to given URL.default boolean
isLocalFile(String url, UrlFilePluginContext context)
Checks if the given file is a file from the local file system and can be safely referenced via symlink.
-
-
-
Method Detail
-
accepts
boolean accepts(String url, UrlFilePluginContext context)
Checks if the plugin can be applied to the given URL.- Parameters:
url
- URL string (including prefix)context
- Context objects- Returns:
- true when the plugin can be applied to the given URL.
-
getFileName
String getFileName(String url, UrlFilePluginContext context) throws IOException
Get filename for external file.- Parameters:
url
- URL string (including prefix)context
- Context objects- Returns:
- Filename
- Throws:
IOException
- I/O exception
-
getFile
InputStream getFile(String url, UrlFilePluginContext context) throws IOException
Get binary data of external file.- Parameters:
url
- URL string (including prefix)context
- Context objects- Returns:
- Binary data
- Throws:
IOException
- If the access to the file failed
-
getFileUrl
default URL getFileUrl(String url, UrlFilePluginContext context) throws IOException
Get URL to external file.- Parameters:
url
- URL string (including prefix)context
- Context objects- Returns:
- URL to file
- Throws:
IOException
- If the access to the file failed
-
getFileUrlsWithDependencies
default List<URL> getFileUrlsWithDependencies(String url, UrlFilePluginContext context) 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)context
- Context objects- Returns:
- URLs to files
- Throws:
IOException
- If the access to the file failed
-
deleteFile
default void deleteFile(String url, UrlFilePluginContext context) throws IOException
Delete file with given URL. This is only supported by few implementations of this interface - all other throw anUnsupportedOperationException
.- Parameters:
url
- URL string (including prefix)context
- Context objects- Throws:
IOException
- If deleting the file is supported but failes for some reason
-
isLocalFile
default boolean isLocalFile(String url, UrlFilePluginContext context) 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)context
- Context objects- Returns:
- true if file is a local file
- Throws:
IOException
- If the access to the file failed
-
getLocalFile
default File getLocalFile(String url, UrlFilePluginContext context) throws IOException
Get local file reference to given URL.- Parameters:
url
- URL string (including prefix)context
- Context objects- Returns:
- Local file reference.
- Throws:
IOException
- If the access to the file failed
-
-