|
||||||||||
| 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 resources
public byte[] getResourceAsBytes(java.lang.Class<? extends java.lang.Object> clazz,
java.lang.String resourcePath)
IPluginResourceLoaderIPluginResourceLoader is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsBytes in interface IPluginResourceLoaderclazz - 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
IPluginResourceLoaderIPluginResourceLoader 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 IPluginResourceLoaderclazz - 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 string
public java.lang.String getResourceAsString(java.lang.Class<? extends java.lang.Object> clazz,
java.lang.String resourcePath,
java.lang.String charsetName)
throws java.io.UnsupportedEncodingException
IPluginResourceLoaderIPluginResourceLoader is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsString in interface IPluginResourceLoaderclazz - 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)
IPluginResourceLoaderIPluginResourceLoader is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsStream in interface IPluginResourceLoaderclazz - 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 found
public java.io.InputStream getResourceAsStream(java.lang.ClassLoader classLoader,
java.lang.String resourcePath)
IPluginResourceLoaderIPluginResourceLoader is able to resolve
relative paths as it knows where to look for plugin classes and resources.
getResourceAsStream in interface IPluginResourceLoaderclassLoader - the ClassLoader which was used to load a pluginresourcePath - the (relative) path to a resource
InputStream or null if the resource is not found
public java.util.List<java.net.URL> findResources(java.lang.Class<?> clazz,
java.lang.String namePattern)
IPluginResourceLoader
findResources in interface IPluginResourceLoadernamePattern - 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 IPluginResourceLoaderIPluginResourceLoader.findResources(Class, String)
public java.util.ResourceBundle getResourceBundle(java.lang.Class<?> clazz,
java.lang.String resourcePath)
IPluginResourceLoaderIPluginResourceLoader.getResourceBundle(Class, String) should behave similar to ResourceBundle.getBundle(String)
getResourceBundle in interface IPluginResourceLoaderclazz - a class that is part of the plugin package, used to identify the pluginresourcePath - points to a particular resource bundle
ResourceBundleResourceBundle
public java.lang.String getPluginSetting(java.lang.Class<?> pluginClass,
java.lang.String key)
IPluginResourceLoadernull if the setting is not found.
getPluginSetting in interface IPluginResourceLoaderpluginClass - 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 IPluginResourceLoaderpluginClass - 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 IPluginResourceLoaderclassLoader - 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 | |||||||||