Interface ConfigFileLoaderPlugin
- All Known Implementing Classes:
AbstractFileConfigFileLoader
,ClasspathConfigFileLoader
,ConfigFileLoaderManager
,FileConfigFileLoader
,ServletConfigFileLoader
public interface ConfigFileLoaderPlugin
Strategy for loading configuration files and files that are used in printing that are relative
(or related) to the configuration file. For example, if a file is loaded from the file system as
requested by a client, (IE the file path was obtained by the client) then there must be
restrictions placed on which files the client may load (you can't allow him to load the full
database or a passwords file for example). The simple way is to ensure the file is within the
same or sub-directory of the config file directory.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the URI scheme that this loader supports.boolean
isAccessible
(URI fileURI) Check if the configuration File exists.boolean
isAccessible
(URI configFileUri, String pathToSubResource) check if the file exists and can be accessed by the user/template/config/etc...lastModified
(URI fileURI) return the last modified time of the file URI.byte[]
Load the config data.byte[]
Load the file related to the configuration file.Return the file object the uri refers to if it refers to a file.Return the file object the uri refers to if it refers to a file.
-
Method Details
-
toFile
Return the file object the uri refers to if it refers to a file. Otherwise Optional.absent().- Parameters:
fileUri
- the uri to use to resolve to a file (or not).
-
toFile
Return the file object the uri refers to if it refers to a file. Otherwise Optional.absent().- Parameters:
configFileUri
- the uri of the configuration filepathToSubResource
- a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).- Throws:
IOException
-
getUriScheme
String getUriScheme()Returns the URI scheme that this loader supports. -
lastModified
return the last modified time of the file URI.- Parameters:
fileURI
- the uri of the config file to load.- Returns:
- return the last modified date of the file
-
isAccessible
Check if the configuration File exists.- Parameters:
fileURI
- the uri of the file to load.
-
loadFile
Load the config data.- Parameters:
fileURI
- the uri of the config file to load.- Returns:
- the file that make up the file.
- Throws:
IOException
-
isAccessible
check if the file exists and can be accessed by the user/template/config/etc...- Parameters:
configFileUri
- the uri of the configuration filepathToSubResource
- a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).- Throws:
IOException
-
loadFile
Load the file related to the configuration file.- Parameters:
configFileUri
- the uri of the configuration filepathToSubResource
- a string representing a file that is accessible for use in printing templates within the configuration file. In the case of a file based URI the path could be a relative path (relative to the configuration file) or an absolute path, but it must be an allowed file (you can't allow access to any file on the file system).- Throws:
IOException
-