Sample Partitioner Plugin
The sample Partitioner plugin project is designed to show a minimal functional implementation of a partitioner plugin that you can use as a basis to develop your own custom plugins.
The sample Partitioner plugin distributes rows to partitions based on the value of a string field, or more precisely the string length. The sample shows a partitioner executing on five partitions, assigning longer strings to higher partition numbers.
Follow these steps in order to build and deploy the sample plugin.
- Obtain the Sample Plugin Source
The plugin source is available in the download package. Download the package and unzip it. The partitioner plugin resides in the kettle-sdk-partitioner-plugin folder.
- Configure the Build
Open kettle-sdk-partitioner-plugin/build/build.properties and set the
kettle-dir
property to the base directory of your PDI installation. - Build and Deploy
You may choose to build and deploy the plugin from the command line, or work with the Eclipse IDE instead. Both options are described below.
-
Build and Deploy From the Command Line
The plugin is built using Apache Ant. Build and deploy the plugin from the command line by invoking the install target from the build directory.
kettle-sdk-partitioner-plugin $ cd build build $ ant install
The install target compiles the source, creates a jar file, creates a plugin folder, and copies the plugin folder into the plugins/steps directory of your PDI installation.
-
Build and Deploy From Eclipse
Import the plugin sources into Eclipse:
- From the menu, select File > Import > Existing Projects Into Worksapace.
- Browse to the kettle-sdk-partitioner-plugin folder and choose the project to be imported.
To build and install the plugin, follow these steps:- Open the Ant view in Eclipse by selecting Window > Show View from the main menu and select Ant.
You may have to select Other > Ant if you have not used the Ant view before.
- Drag the file build/build.xml from your project into the Ant view, and execute the install target by double-clicking it.
- After the plugin has been deployed, restart Spoon.
-
- You can test the new plugin using the transformation from the demo_transform folder.
