org.pentaho.platform.api.engine
Interface IPluginManager

All Known Implementing Classes:
AbstractPluginManager, DefaultPluginManager

public interface IPluginManager

The contract API between the platform and platform 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. For more information on platform plugins, visit the wiki link below.

Author:
jamesdixon
See Also:
BI Platform Plugins

Method Summary
 Object getBean(String beanId)
          If any plugins have registered a bean by id beanId, this method will return a new instance of the object.
 ClassLoader getClassLoader(IPlatformPlugin plugin)
          Deprecated. use getClassLoader(String)
 ClassLoader getClassLoader(String pluginId)
          Returns the classloader instance that was assigned by the plugin manager to load all classes for the specified plugin.
 IContentGenerator getContentGenerator(String id, IPentahoSession session)
           
 IContentGenerator getContentGeneratorForType(String type, IPentahoSession session)
           
 String getContentGeneratorIdForType(String type, IPentahoSession session)
           
 IContentGeneratorInfo getContentGeneratorInfo(String id, IPentahoSession session)
           
 List<IContentGeneratorInfo> getContentGeneratorInfoForType(String type, IPentahoSession session)
          Returns a list of info objects that can be used to create content generators for a given type.
 String getContentGeneratorTitleForType(String type, IPentahoSession session)
           
 String getContentGeneratorUrlForType(String type, IPentahoSession session)
           
 IContentInfo getContentInfoFromExtension(String extension, IPentahoSession session)
           
 Set<String> getContentTypes()
          Returns a set of the content types that the registered plugins can process.
 IContentGeneratorInfo getDefaultContentGeneratorInfoForType(String type, IPentahoSession session)
           
 IFileInfo getFileInfo(String extension, IPentahoSession session, ISolutionFile file, InputStream in)
          Retrieves meta information for the given solution file.
 List<org.pentaho.ui.xul.IMenuCustomization> getMenuCustomizations()
          Returns a list of menu customization objects.
 List<org.pentaho.ui.xul.XulOverlay> getOverlays()
          Returns a list of the XUL overlays that are defined by all the plug-ins.
 Object getPluginSetting(IPlatformPlugin plugin, String key, String defaultValue)
          Deprecated. use getPluginSetting(String, String, String)
 Object getPluginSetting(String pluginId, String key, String defaultValue)
          Retrieves a plugin setting for a given plugin and key.
 String getServicePlugin(String path)
          Returns the plugin that can handle a request for the resource at "path".
 InputStream getStaticResource(String path)
          Returns and InputStream to the specified resource path.
 boolean isBeanRegistered(String beanId)
          Returns true if a bean with id beanId has been registered with the plugin manager, i.e.
 IPlatformPlugin isResourceLoadable(String path)
          Deprecated. This is a poorly named method, use getServicePlugin(String) instead.
 boolean isStaticResource(String path)
          returns true if the path is a reference to a potential static resource.
 Class<?> loadClass(String beanId)
          Returns a loaded class for the bean registered as beanId.
 boolean reload(IPentahoSession session)
          Causes the plug-in manager object to re-register all of the plug-ins that it knows about.
 void unloadAllPlugins()
          Unloads all the plugins.
 

Method Detail

getContentTypes

Set<String> 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:

getContentInfoFromExtension

IContentInfo getContentInfoFromExtension(String extension,
                                         IPentahoSession session)

getContentGeneratorInfoForType

List<IContentGeneratorInfo> getContentGeneratorInfoForType(String type,
                                                           IPentahoSession session)
Returns a list of info objects that can be used to create content generators for a given type. In most cases there will only be one content generator for any one type.

Parameters:
type -
session - A session used for storing objects from session-scoped factories
Returns:
List of IObjectCreator objects

getContentGenerator

IContentGenerator getContentGenerator(String id,
                                      IPentahoSession session)
                                      throws ObjectFactoryException
Throws:
ObjectFactoryException

getContentGeneratorInfo

IContentGeneratorInfo getContentGeneratorInfo(String id,
                                              IPentahoSession session)

getDefaultContentGeneratorInfoForType

IContentGeneratorInfo getDefaultContentGeneratorInfoForType(String type,
                                                            IPentahoSession session)

getContentGeneratorIdForType

String getContentGeneratorIdForType(String type,
                                    IPentahoSession session)

getContentGeneratorTitleForType

String getContentGeneratorTitleForType(String type,
                                       IPentahoSession session)

getContentGeneratorUrlForType

String getContentGeneratorUrlForType(String type,
                                     IPentahoSession session)

getContentGeneratorForType

IContentGenerator getContentGeneratorForType(String type,
                                             IPentahoSession session)
                                             throws ObjectFactoryException
Throws:
ObjectFactoryException

getMenuCustomizations

List<org.pentaho.ui.xul.IMenuCustomization> getMenuCustomizations()
Returns a list of menu customization objects.

Returns:
List of IMenuCustomization objects

reload

boolean reload(IPentahoSession session)
Causes the plug-in manager object to re-register all of the plug-ins that it knows about. A IPluginProvider may be invoked to discover plugins from various sources.

Parameters:
session - the current session
Returns:
true if no errors were encountered

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

Object getBean(String beanId)
               throws PluginBeanException
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
Throws:
PluginBeanException - if there was a problem retrieving the bean instance

loadClass

Class<?> loadClass(String beanId)
                   throws PluginBeanException
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

boolean isBeanRegistered(String beanId)
Returns true if a bean with id beanId has been registered with the plugin manager, i.e. you can get a bean instance by calling getBean(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.


getFileInfo

IFileInfo getFileInfo(String extension,
                      IPentahoSession session,
                      ISolutionFile file,
                      InputStream in)
Retrieves meta information for the given solution file.

Parameters:
extension - used to identify the appropriate plugin that handles this type of content
session - the current session
file - the solution file we want to know something about
in - the content of the solution file as an InputStream
Returns:
meta information about the solution file

getPluginSetting

Object getPluginSetting(IPlatformPlugin plugin,
                        String key,
                        String defaultValue)
Deprecated. use getPluginSetting(String, String, String)


getPluginSetting

Object getPluginSetting(String pluginId,
                        String key,
                        String defaultValue)
Retrieves a plugin setting for a given plugin and key.

Parameters:
pluginId - the ID of the plugin to find settings for
key - the setting name to lookup
defaultValue - the default to use if the setting key is not found
Returns:
the plugin setting

isResourceLoadable

IPlatformPlugin isResourceLoadable(String path)
Deprecated. This is a poorly named method, use getServicePlugin(String) instead.


getServicePlugin

String getServicePlugin(String path)
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

ClassLoader getClassLoader(IPlatformPlugin plugin)
Deprecated. use getClassLoader(String)


getClassLoader

ClassLoader getClassLoader(String pluginId)
Returns the classloader instance that was assigned by the plugin manager to load all classes for the specified plugin. Used in combination with getServicePlugin(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:
plugin - 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).

isStaticResource

boolean isStaticResource(String path)
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

getStaticResource

InputStream getStaticResource(String path)
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