public class PluginResourceLoader extends Object implements org.pentaho.platform.api.engine.IPluginResourceLoader
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 and Description |
---|
PluginResourceLoader() |
Modifier and Type | Method and Description |
---|---|
List<URL> |
findResources(Class<?> clazz,
String namePattern) |
List<URL> |
findResources(ClassLoader classLoader,
String namePattern) |
protected ClassLoader |
getClassLoader(Class<?> clazz) |
protected PluginClassLoader |
getOverrideClassloader() |
protected File |
getPluginDir(ClassLoader classLoader) |
String |
getPluginSetting(Class<?> pluginClass,
String key) |
String |
getPluginSetting(Class<?> pluginClass,
String key,
String defaultVal) |
String |
getPluginSetting(ClassLoader classLoader,
String key,
String defaultVal) |
byte[] |
getResourceAsBytes(Class<? extends Object> clazz,
String resourcePath) |
InputStream |
getResourceAsStream(Class<?> clazz,
String resourcePath) |
InputStream |
getResourceAsStream(ClassLoader classLoader,
String resourcePath) |
String |
getResourceAsString(Class<? extends Object> clazz,
String resourcePath) |
String |
getResourceAsString(Class<? extends Object> clazz,
String resourcePath,
String charsetName) |
ResourceBundle |
getResourceBundle(Class<?> clazz,
String resourcePath) |
String |
getSystemRelativePluginPath(ClassLoader classLoader) |
void |
setOverrideClassloader(PluginClassLoader pluginClassloader)
Deprecated.
|
void |
setRootDir(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(String settingsPath) |
public void setSettingsPath(String settingsPath)
@Deprecated public void setOverrideClassloader(PluginClassLoader pluginClassloader)
protected PluginClassLoader getOverrideClassloader()
public void setRootDir(File rootDir)
getClassLoader(Class)
.PluginClassLoader
for the root directory.rootDir
- the root directory in which to search for resourcespublic byte[] getResourceAsBytes(Class<? extends Object> clazz, String resourcePath)
getResourceAsBytes
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public String getResourceAsString(Class<? extends Object> clazz, String resourcePath) throws UnsupportedEncodingException
getResourceAsString
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
UnsupportedEncodingException
public String getResourceAsString(Class<? extends Object> clazz, String resourcePath, String charsetName) throws UnsupportedEncodingException
getResourceAsString
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
UnsupportedEncodingException
public String getSystemRelativePluginPath(ClassLoader classLoader)
protected File getPluginDir(ClassLoader classLoader)
protected ClassLoader getClassLoader(Class<?> clazz)
public InputStream getResourceAsStream(Class<?> clazz, String resourcePath)
getResourceAsStream
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public InputStream getResourceAsStream(ClassLoader classLoader, String resourcePath)
getResourceAsStream
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public List<URL> findResources(Class<?> clazz, String namePattern)
findResources
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public List<URL> findResources(ClassLoader classLoader, String namePattern)
findResources
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public ResourceBundle getResourceBundle(Class<?> clazz, String resourcePath)
getResourceBundle
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public String getPluginSetting(Class<?> pluginClass, String key)
getPluginSetting
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public String getPluginSetting(Class<?> pluginClass, String key, String defaultVal)
getPluginSetting
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
public String getPluginSetting(ClassLoader classLoader, String key, String defaultVal)
getPluginSetting
in interface org.pentaho.platform.api.engine.IPluginResourceLoader
Copyright © 2021 Hitachi Vantara. All rights reserved.