BI Component APIs

Unknown macro: {scrollbar}

There are four ways of creating a BI Component: create a BI Component from scratch, convert an existing class into a BI Component, create a subclass of ComponentBase (org.pentaho.plugin.ComponentBase), or create a subclass of SimpleComponent (org.pentaho.plugin.core.SimpleComponent).

To become a BI Component, a Java object must implement the org.pentaho.core.component.IComponent interface. The IComponent interface extends two other interfaces: org.pentaho.core.audit.IAuditable and org.pentaho.util.logging.ILogger. Pentaho provides classes that implement these interfaces.

The hierarchy of the Pentaho classes looks like this:
org.pentaho.core.system.PentahoBase (implements ILogger and Serializable)
    --> org.pentaho.core.system.PentahoMessenger
        --> org.pentaho.plugin.ComponentBase (implements IComponent and IAuditable)
            --> org.pentaho.plugin.core.SimpleComponent
                --> other Pentaho-provided BI Components

You can create your BI Components in whatever package you like whether they are subclasses of Pentaho classes or not. There are no required methods that will be inaccessible if you use a non-Pentaho package.

Extend SimpleComponent

This is the easiest way to create a new component and the recommended place to start.

  1. Create a new Java class that is a subclass of (extends) org.pentaho.plugin.core.SimpleComponent.
  2. Implement an executeAction method and a getLogger method. See #Component Methods below for a description of these methods.

Extend ComponentBase

If your component needs to validate its inputs and/or system settings or needs to perform any initialization and/or cleanup, you should extend org.pentaho.plugin.ComponentBase.

  1. Create a new Java class that is a subclass of (extends) org.pentaho.plugin.ComponentBase.
  2. Add code to the init, validateSystemSettings, validateAction, executeAction, done, and getLogger methods as appropriate.

Convert a Java Object into a BI Component

If you have an existing object that you wish to convert into a BI Component there are two options.
Create a new object that subclasses your existing object and implements the required interfaces
Change your object to implement the required interfaces

Which of these options is the best for your particular object will depend on your specific circumstances; but, we recommend creating a subclass if only to keep your source file size manageable.

If you do need to use this approach most of the code you need to create your new class can be found in these classes: org.pentaho.core.system.PentahoBase, org.pentaho.core.system.PentahoMessenger, and org.pentaho.plugin.ComponentBase. To make this process easier we have created a class, org.pentaho.plugin.ComponentSubclassExample, that contains the code you need.

To convert a Java class to a BI Component:

  1. Copy the imports, member variables, and methods from org.pentaho.plugin.ComponentSubclassExample into your Java class.
  2. Add code to the init, validateSystemSettings, validateAction, executeAction, done, and getLogger methods as appropriate.

Components from Scratch

In order to create a component from scratch a new class that implements the interface org.pentaho.core.component.IComponent must be created. To implement all three interfaces requires about 30 methods to be implemented. It is not recommended to use this option and there should be no need to do this given the options above.

Component Methods

If using one of the three recommended methods for creating new components, the methods below are the BI Component methods that need to be customized to provide your needed functionality. The methods are listed in the order that they are typically called during normal processing. Depending on the option used to create your component, not all of these methods are required. See above sections for more details.