Package org.pentaho.platform.api.engine
Interface IPluginManager
public interface IPluginManager
The contract API between the platform and BIServer plugins. The plugin manager provides the ability to load and
register plugins as well as utility methods for getting particular extension implementations from the set of
registered plugins. It's object creation and management features are backed by a
ListableBeanFactory
For more
information on platform plugins, visit the wiki link below.- Author:
- jamesdixon, aphillips
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add aIPluginManagerListener
to be notified of IPluginManager events.If any plugins have registered a bean by id beanId, this method will return a new instance of the object.org.springframework.beans.factory.ListableBeanFactory
getBeanFactory
(String pluginId) Returns a (Spring) bean factory for retrieving plugin-bound objectsgetClassLoader
(String pluginId) Returns the classloader instance that was assigned by the plugin manager to load all classes for the specified plugin.getContentGenerator
(String type, String perspectiveName) Returns aIContentGenerator
that can render the named perspective (e.g.getContentGeneratorForType
(String type, IPentahoSession session) Deprecated.getContentTypeInfo
(String type) Gets metadata about a particular content typeReturns a set of the content types that the registered plugins can process.getExternalResourcesForContext
(String context) Return a List of scripts registered for a given context.List<org.pentaho.ui.xul.XulOverlay>
Returns a list of the XUL overlays that are defined by all the plug-ins.getPluginIdForClassLoader
(ClassLoader classLoader) Each plugin is loaded on its own classloader, we can use this to find the plugin for which the classloader is servinggetPluginIdForType
(String contentType) Returns the plugin (IPlatformPlugin) that handles requests for files of typecontentType
Returns the Plugin perspectives for a plugin of specific idgetPluginRESTPerspectivesForType
(String contentType) Returns the Plugin perspectives for files of typecontentType
getPluginSetting
(String pluginId, String key, String defaultValue) Retrieves a plugin setting for a given plugin and key.Lists the ids of available plugins.getServicePlugin
(String path) Deprecated.This method may not work correctly for plugins in Sugar or later releases, in which a plugin does not provide the URL by which to access the resource.getStaticResource
(String path) Deprecated.This method may not work correctly for plugins in Sugar or later releases, in which a plugin does not provide the URL by which to access the resource.boolean
isBeanRegistered
(String beanId) Returns true if a bean with id beanId has been registered with the plugin manager, i.e.boolean
Returns true if the resource specified bypath
is publicly available, meaning this resource can be accessed by HTTP GET requestsboolean
isStaticResource
(String path) Deprecated.This method may not work correctly for plugins in Sugar or later releases, in which a plugin does not provide the URL by which to access the resource.Class<?>
Returns a loaded class for the bean registered as beanId.boolean
reload()
Causes the plug-in manager object to re-register all of the plug-ins that it knows about.boolean
reload
(IPentahoSession session) Deprecated.Usereload()
insteadvoid
Unloads all the plugins.
-
Method Details
-
getContentTypes
Returns a set of the content types that the registered plugins can process. If the plugin is intended to handle the processing of a document in the solution repository the types need to match with the filename extension.- Returns:
- list of all the content types provided by plugins
-
getContentTypeInfo
Gets metadata about a particular content type- Parameters:
type
- a content type provided by a plugin- Returns:
- info object for a content type
-
getContentGeneratorForType
@Deprecated IContentGenerator getContentGeneratorForType(String type, IPentahoSession session) throws ObjectFactoryException Deprecated.Useinstead
- Throws:
ObjectFactoryException
-
reload
boolean reload()Causes the plug-in manager object to re-register all of the plug-ins that it knows about. AIPluginProvider
may be invoked to discover plugins from various sources.- Returns:
- true if no errors were encountered
-
reload
Deprecated.Usereload()
instead -
getOverlays
List<org.pentaho.ui.xul.XulOverlay> getOverlays()Returns a list of the XUL overlays that are defined by all the plug-ins. The overlays are XML fragments.- Returns:
- List of XML XUL overlays
-
getBean
If any plugins have registered a bean by id beanId, this method will return a new instance of the object. The correct classloader must be used to instantiate the object.- Parameters:
beanId
- a unique identifier for a particular bean (cannot be null)- Returns:
- an instance of the bean registered under beanId may generate an unchecked PluginBeanException if there was a problem retrieving the bean instance
- Throws:
PluginBeanException
-
getContentGenerator
Returns aIContentGenerator
that can render the named perspective (e.g. 'viewer') of a resource of typetype
(e.g. 'prpt'). Essentially the same as(IContentGenerator)getBean (type+"/"+perspectiveName)
- Parameters:
type
- the type of resource to renderperspectiveName
- specifies a distinct view of the resource. Can benull
in which case the default perspective 'generatedContent' is implied.- Returns:
- a list of suitable
IContentGenerator
s may generate an unchecked NoSuchBeanDefinitionException - if there is no bean definition with the specified name may generate an unchecked BeansException - if the bean could not be obtained
-
loadClass
Returns a loaded class for the bean registered as beanId. The class will have been loaded by the proper classloader, so it indirectly provides the caller with it's classloader by class.getClassLoader(). This is often helpful since plugin bean classes are often not available through the caller's classloader.- Parameters:
beanId
- a unique identifier for a particular bean (cannot be null)- Returns:
- a loaded class for the registered bean
- Throws:
PluginBeanException
- if there was a problem loading the class
-
isBeanRegistered
Returns true if a bean with id beanId has been registered with the plugin manager, i.e. you can get a bean instance by callinggetBean(String)
- Parameters:
beanId
- Cannot be null- Returns:
- true if the bean is registered
-
unloadAllPlugins
void unloadAllPlugins()Unloads all the plugins. Called when the context shuts down. -
getPluginIdForType
Returns the plugin (IPlatformPlugin) that handles requests for files of typecontentType
- Parameters:
contentType
- a user-defined file-extension like suffix denoting a type of content- Returns:
- the id of the plugin that handles requests to files of type
contentType
ornull
if none were found
-
getPluginRESTPerspectivesForType
Returns the Plugin perspectives for files of typecontentType
- Parameters:
contentType
- a user-defined file-extension like suffix denoting a type of content. for example xaction, prpt- Returns:
- the list of REST perspectives for files of type
contentType
ornull
if none were found
-
getPluginRESTPerspectivesForId
Returns the Plugin perspectives for a plugin of specific id- Parameters:
id
- the id of the plugin- Returns:
- the list of REST perspectives for a plugin of specific id or
null
if none were found
-
getPluginIdForClassLoader
Each plugin is loaded on its own classloader, we can use this to find the plugin for which the classloader is serving- Parameters:
classLoader
- The classloader for the plugin, also used to load all plugin resources- Returns:
- the plugin id which was loaded on the given classloader
-
getPluginSetting
Retrieves a plugin setting for a given plugin and key.- Parameters:
pluginId
- the ID of the plugin to find settings forkey
- the setting name to lookupdefaultValue
- the default to use if the setting key is not found- Returns:
- the plugin setting
-
getServicePlugin
Deprecated.This method may not work correctly for plugins in Sugar or later releases, in which a plugin does not provide the URL by which to access the resource. UseisPublic(String, String)
if you want to determine if a particular plugin dir is accessable through the plugin resources REST service.Returns the plugin that can handle a request for the resource at "path". A plugin is determined to be able to serve the request if it either a content generator or a static resource of the plugin is configured to handle the path. In other words, if a plugin has a static resource of "/my-plugin/resources", then a request to "/my-plugin/resources/images/file.png" can be handled by the plugin. If ultimately, no plugin can handle the resource path,null
is returned.- Parameters:
path
- the path to the plugin resource- Returns:
- the ID of the plugin which owns the resource or
null
if one cannot be found
-
getClassLoader
Returns the classloader instance that was assigned by the plugin manager to load all classes for the specified plugin. Used in combination withgetServicePlugin(String)
, this method can provide you with a way to load resources from a plugin when all you have is a request URL/path, such as in a servlet environment.- Parameters:
pluginId
- the plugin for which we want to get the assigned classloader- Returns:
- the classloader assigned to this plugin, or
null
if the plugin is not known by the plugin manager, or for some reason a classloader was not assigned to the plugin (an error condition).
-
getBeanFactory
Returns a (Spring) bean factory for retrieving plugin-bound objects- Parameters:
pluginId
-- Returns:
- a bean factory for retrieving instances of plugin-provided objects
-
isStaticResource
Deprecated.This method may not work correctly for plugins in Sugar or later releases, in which a plugin does not provide the URL by which to access the resource. UseisPublic(String, String)
if you want to determine if a particular plugin dir is accessable through the plugin resources REST service.returns true if the path is a reference to a potential static resource. Note that this does not guarantee that the resource exists, just that it maps to a static resource location.- Parameters:
path
- static resource path- Returns:
- true if path begins as a static resource
-
isPublic
Returns true if the resource specified bypath
is publicly available, meaning this resource can be accessed by HTTP GET requests- Parameters:
pluginId
- the id of the plugin to search for the dirpath
- a path relative to the plugin folder to check for public availability- Returns:
true
if publicly available orfalse
if not available for any reason
-
getStaticResource
Deprecated.This method may not work correctly for plugins in Sugar or later releases, in which a plugin does not provide the URL by which to access the resource. UseisPublic(String, String)
if you want to determine if a particular plugin dir is accessable through the plugin resources REST service.Returns and InputStream to the specified resource path.- Parameters:
path
- the path to the plugin resource- Returns:
- the InputStream which may be used to read the plugin resource
-
getRegisteredPlugins
Lists the ids of available plugins. From the id, you can get lots of information about a plugin, such as the bean factory which gives you access to information on all specified beans for that plugin.- Returns:
- list of plugin ids
-
getExternalResourcesForContext
Return a List of scripts registered for a given context.- Parameters:
context
- named area in the platform- Returns:
- list of registered scripts
-
addPluginManagerListener
Add aIPluginManagerListener
to be notified of IPluginManager events.- Parameters:
listener
-
-
instead