public interface IPluginResourceLoader
Modifier and Type | Method and Description |
---|---|
List<URL> |
findResources(Class<?> pluginClass,
String namePattern)
A searching method, yielding a list of plugin-related resources as URLs.
|
List<URL> |
findResources(ClassLoader classLoader,
String namePattern) |
String |
getPluginSetting(Class<?> pluginClass,
String key)
Searches for the plugin setting with the specified key.
|
String |
getPluginSetting(Class<?> pluginClass,
String key,
String defaultValue)
Searches for the plugin setting with the specified key.
|
String |
getPluginSetting(ClassLoader pluginClassLoader,
String key,
String defaultValue)
Searches for the plugin setting with the specified key.
|
byte[] |
getResourceAsBytes(Class<? extends Object> pluginClass,
String resourcePath)
Gets a plugin-related resource in the form of an array of bytes.
|
InputStream |
getResourceAsStream(Class<?> pluginClass,
String resourcePath)
Gets a plugin-related resource in the form of an InputStream.
|
InputStream |
getResourceAsStream(ClassLoader classLoader,
String resourcePath)
Gets a plugin-related resource in the form of an InputStream.
|
String |
getResourceAsString(Class<? extends Object> pluginClass,
String resourcePath)
Gets a plugin-related resource in the form of a String.
|
String |
getResourceAsString(Class<? extends Object> pluginClass,
String resourcePath,
String charsetName)
Gets a plugin-related resource in the form of a String.
|
ResourceBundle |
getResourceBundle(Class<?> pluginClass,
String baseName)
Retrieves a localized resource bundle for the plugin represented by pluginClass.
|
byte[] getResourceAsBytes(Class<? extends Object> pluginClass, String resourcePath)
IPluginResourceLoader
is able to
resolve relative paths as it knows where to look for plugin classes and resources.pluginClass
- a class that is part of the plugin package, used to identify the pluginresourcePath
- the (relative) path to a resourceString getResourceAsString(Class<? extends Object> pluginClass, String resourcePath) throws UnsupportedEncodingException
IPluginResourceLoader
is able to resolve
relative paths as it knows where to look for plugin classes and resources.
This method defaults the character encoding (how this default is chosen is up to the implementor).
pluginClass
- a class that is part of the plugin package, used to identify the pluginresourcePath
- the (relative) path to a resourceString
or null if the resource is not foundUnsupportedEncodingException
- if there is a problem encoding the stringString getResourceAsString(Class<? extends Object> pluginClass, String resourcePath, String charsetName) throws UnsupportedEncodingException
IPluginResourceLoader
is able to resolve
relative paths as it knows where to look for plugin classes and resources.pluginClass
- a class that is part of the plugin package, used to identify the pluginresourcePath
- the (relative) path to a resourcecharsetName
- the character set to encode the stringString
or null if the resource is not foundUnsupportedEncodingException
- if there is a problem encoding the stringInputStream getResourceAsStream(Class<?> pluginClass, String resourcePath)
IPluginResourceLoader
is able to
resolve relative paths as it knows where to look for plugin classes and resources.pluginClass
- a class that is part of the plugin package, used to identify the pluginresourcePath
- the (relative) path to a resourceInputStream
or null if the resource is not foundInputStream getResourceAsStream(ClassLoader classLoader, String resourcePath)
IPluginResourceLoader
is able to resolve relative paths as it knows where to
look for plugin classes and resources.classLoader
- the ClassLoader which was used to load a pluginresourcePath
- the (relative) path to a resourceInputStream
or null if the resource is not foundList<URL> findResources(Class<?> pluginClass, String namePattern)
pluginClass
- namePattern
- a resource name pattern supporting wildcardsList<URL> findResources(ClassLoader classLoader, String namePattern)
findResources(Class, String)
ResourceBundle getResourceBundle(Class<?> pluginClass, String baseName)
getResourceBundle(Class, String)
should behave similar to
ResourceBundle.getBundle(String)
pluginClass
- a class that is part of the plugin package, used to identify the pluginbaseName
- points to a particular resource bundleResourceBundle
MissingResourceException
- if resource bundle not foundResourceBundle
String getPluginSetting(Class<?> pluginClass, String key)
null
if the setting is
not found.pluginClass
- a class that is part of the plugin package, used to identify the pluginkey
- the setting keyString getPluginSetting(Class<?> pluginClass, String key, String defaultValue)
pluginClass
- a class that is part of the plugin package, used to identify the pluginkey
- the setting keydefaultValue
- the value to return if no value is found for the setting keyString getPluginSetting(ClassLoader pluginClassLoader, String key, String defaultValue)
pluginClassLoader
- the classloader that was used to load the plugin, must be a PluginClassLoaderkey
- the setting keydefaultValue
- the value to return if no value is found for the setting key