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 Details

    • 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:
      list of all the content types provided by plugins
    • getContentTypeInfo

      IContentInfo getContentTypeInfo(String type)
      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.
      Throws:
      ObjectFactoryException
    • reload

      boolean reload()
      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.
      Returns:
      true if no errors were encountered
    • reload

      @Deprecated boolean reload(IPentahoSession session)
      Deprecated.
      Use reload() 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

      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 may generate an unchecked PluginBeanException if there was a problem retrieving the bean instance
      Throws:
      PluginBeanException
    • getContentGenerator

      IContentGenerator getContentGenerator(String type, String perspectiveName)
      Returns a IContentGenerator that can render the named perspective (e.g. 'viewer') of a resource of type type (e.g. 'prpt'). Essentially the same as (IContentGenerator)getBean (type+"/"+perspectiveName)
      Parameters:
      type - the type of resource to render
      perspectiveName - specifies a distinct view of the resource. Can be null in which case the default perspective 'generatedContent' is implied.
      Returns:
      a list of suitable IContentGenerators 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

      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.
    • getPluginIdForType

      String getPluginIdForType(String contentType)
      Returns the plugin (IPlatformPlugin) that handles requests for files of type contentType
      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 or null if none were found
    • getPluginRESTPerspectivesForType

      List<String> getPluginRESTPerspectivesForType(String contentType)
      Returns the Plugin perspectives for files of type contentType
      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 or null if none were found
    • getPluginRESTPerspectivesForId

      List<String> getPluginRESTPerspectivesForId(String id)
      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

      String getPluginIdForClassLoader(ClassLoader classLoader)
      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

      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
    • getServicePlugin

      @Deprecated String 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. Use isPublic(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

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

      org.springframework.beans.factory.ListableBeanFactory getBeanFactory(String pluginId)
      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 boolean 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. Use isPublic(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

      boolean isPublic(String pluginId, String path)
      Returns true if the resource specified by path is publicly available, meaning this resource can be accessed by HTTP GET requests
      Parameters:
      pluginId - the id of the plugin to search for the dir
      path - a path relative to the plugin folder to check for public availability
      Returns:
      true if publicly available or false if not available for any reason
    • getStaticResource

      @Deprecated InputStream 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. Use isPublic(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

      List<String> 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

      List<String> getExternalResourcesForContext(String context)
      Return a List of scripts registered for a given context.
      Parameters:
      context - named area in the platform
      Returns:
      list of registered scripts
    • addPluginManagerListener

      void addPluginManagerListener(IPluginManagerListener listener)
      Add a IPluginManagerListener to be notified of IPluginManager events.
      Parameters:
      listener -