|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pentaho.platform.plugin.services.pluginmgr.PluginResourceLoader
public class PluginResourceLoader
The default implementation of the IPluginResourceLoader
. Obtains resources
by searching the root directory of a PluginClassLoader
.
PluginResourceLoader
will search the following places for plugin classes:
PluginResourceLoader
will search for non-class resources in several locations:
PentahoSystem.getSystemSetting(String, String)
and ISystemSettings
. System
settings are expected in a file named settings.xml in the root of the plugin directory.
Constructor Summary | |
---|---|
PluginResourceLoader()
|
Method Summary | |
---|---|
java.util.List<java.net.URL> |
findResources(java.lang.Class<?> clazz,
java.lang.String namePattern)
A searching method, yielding a list of plugin-related resources as URLs. |
java.util.List<java.net.URL> |
findResources(java.lang.ClassLoader classLoader,
java.lang.String namePattern)
|
java.lang.String |
getPluginSetting(java.lang.Class<?> pluginClass,
java.lang.String key)
Searches for the plugin setting with the specified key. |
java.lang.String |
getPluginSetting(java.lang.Class<?> pluginClass,
java.lang.String key,
java.lang.String defaultVal)
Searches for the plugin setting with the specified key. |
java.lang.String |
getPluginSetting(java.lang.ClassLoader classLoader,
java.lang.String key,
java.lang.String defaultVal)
Searches for the plugin setting with the specified key. |
byte[] |
getResourceAsBytes(java.lang.Class<? extends java.lang.Object> clazz,
java.lang.String resourcePath)
Gets a plugin-related resource in the form of an array of bytes. |
java.io.InputStream |
getResourceAsStream(java.lang.Class<?> clazz,
java.lang.String resourcePath)
Gets a plugin-related resource in the form of an InputStream. |
java.io.InputStream |
getResourceAsStream(java.lang.ClassLoader classLoader,
java.lang.String resourcePath)
Gets a plugin-related resource in the form of an InputStream. |
java.lang.String |
getResourceAsString(java.lang.Class<? extends java.lang.Object> clazz,
java.lang.String resourcePath)
Gets a plugin-related resource in the form of a String. |
java.lang.String |
getResourceAsString(java.lang.Class<? extends java.lang.Object> clazz,
java.lang.String resourcePath,
java.lang.String charsetName)
Gets a plugin-related resource in the form of a String. |
java.util.ResourceBundle |
getResourceBundle(java.lang.Class<?> clazz,
java.lang.String resourcePath)
Retrieves a localized resource bundle for the plugin represented by pluginClass. |
java.lang.String |
getSystemRelativePluginPath(java.lang.ClassLoader classLoader)
|
void |
setOverrideClassloader(PluginClassLoader pluginClassloader)
Deprecated. |
void |
setRootDir(java.io.File rootDir)
Deprecated. instead of setting the root dir, have your application use a subclass of PluginResourceLoader that returns an appropriately pathed PluginClassLoader from an overridden getClassLoader(Class) . |
void |
setSettingsPath(java.lang.String settingsPath)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PluginResourceLoader()
Method Detail |
---|
public void setSettingsPath(java.lang.String settingsPath)
@Deprecated public void setOverrideClassloader(PluginClassLoader pluginClassloader)
public void setRootDir(java.io.File rootDir)
getClassLoader(Class)
.
PluginClassLoader
for the root directory.
rootDir
- the root directory in which to search for resourcespublic byte[] getResourceAsBytes(java.lang.Class<? extends java.lang.Object> clazz, java.lang.String resourcePath)
IPluginResourceLoader
IPluginResourceLoader
is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsBytes
in interface IPluginResourceLoader
clazz
- a class that is part of the plugin package, used to identify the pluginresourcePath
- the (relative) path to a resource
public java.lang.String getResourceAsString(java.lang.Class<? extends java.lang.Object> clazz, java.lang.String resourcePath) throws java.io.UnsupportedEncodingException
IPluginResourceLoader
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).
getResourceAsString
in interface IPluginResourceLoader
clazz
- a class that is part of the plugin package, used to identify the pluginresourcePath
- the (relative) path to a resource
String
or null if the resource is not found
java.io.UnsupportedEncodingException
- if there is a problem encoding the stringpublic java.lang.String getResourceAsString(java.lang.Class<? extends java.lang.Object> clazz, java.lang.String resourcePath, java.lang.String charsetName) throws java.io.UnsupportedEncodingException
IPluginResourceLoader
IPluginResourceLoader
is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsString
in interface IPluginResourceLoader
clazz
- 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 string
String
or null if the resource is not found
java.io.UnsupportedEncodingException
- if there is a problem encoding the stringpublic java.lang.String getSystemRelativePluginPath(java.lang.ClassLoader classLoader)
public java.io.InputStream getResourceAsStream(java.lang.Class<?> clazz, java.lang.String resourcePath)
IPluginResourceLoader
IPluginResourceLoader
is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsStream
in interface IPluginResourceLoader
clazz
- a class that is part of the plugin package, used to identify the pluginresourcePath
- the (relative) path to a resource
InputStream
or null if the resource is not foundpublic java.io.InputStream getResourceAsStream(java.lang.ClassLoader classLoader, java.lang.String resourcePath)
IPluginResourceLoader
IPluginResourceLoader
is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsStream
in interface IPluginResourceLoader
classLoader
- the ClassLoader which was used to load a pluginresourcePath
- the (relative) path to a resource
InputStream
or null if the resource is not foundpublic java.util.List<java.net.URL> findResources(java.lang.Class<?> clazz, java.lang.String namePattern)
IPluginResourceLoader
findResources
in interface IPluginResourceLoader
namePattern
- a resource name pattern supporting wildcards
public java.util.List<java.net.URL> findResources(java.lang.ClassLoader classLoader, java.lang.String namePattern)
findResources
in interface IPluginResourceLoader
IPluginResourceLoader.findResources(Class, String)
public java.util.ResourceBundle getResourceBundle(java.lang.Class<?> clazz, java.lang.String resourcePath)
IPluginResourceLoader
IPluginResourceLoader.getResourceBundle(Class, String)
should behave similar to ResourceBundle.getBundle(String)
getResourceBundle
in interface IPluginResourceLoader
clazz
- a class that is part of the plugin package, used to identify the pluginresourcePath
- points to a particular resource bundle
ResourceBundle
ResourceBundle
public java.lang.String getPluginSetting(java.lang.Class<?> pluginClass, java.lang.String key)
IPluginResourceLoader
null
if the setting is not found.
getPluginSetting
in interface IPluginResourceLoader
pluginClass
- a class that is part of the plugin package, used to identify the pluginkey
- the setting key
public java.lang.String getPluginSetting(java.lang.Class<?> pluginClass, java.lang.String key, java.lang.String defaultVal)
IPluginResourceLoader
getPluginSetting
in interface IPluginResourceLoader
pluginClass
- a class that is part of the plugin package, used to identify the pluginkey
- the setting keydefaultVal
- the value to return if no value is found for the setting key
public java.lang.String getPluginSetting(java.lang.ClassLoader classLoader, java.lang.String key, java.lang.String defaultVal)
IPluginResourceLoader
getPluginSetting
in interface IPluginResourceLoader
classLoader
- the classloader that was used to load the plugin, must be a PluginClassLoaderkey
- the setting keydefaultVal
- the value to return if no value is found for the setting key
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |