Topic: How to install plugins in DataCleaner
How to install plugins in DataCleaner
An area that have greatly improved in DataCleaner 2.0 is the plugin architecture that the application builds upon. I have previously posted a lot about how you can develop plugin classes for various steps, such as filters, transformers and analyzers. This information is now available on the develop page.
Something that have been missing though is this: Once I've developed my plugins, how do I install them into DataCleaner so that I can start using them in production? It is very easy, actually.
Let's begin with the build. My "bare minimum" pom.xml file looks like this (I use Maven for the build, but any other build tool can be used as well):
This is my "bare minimum" plugin source code, a very simple hello world transformer:
Here's how that will look in DataCleaner's user interface:
When I run a build ...
I then have a HelloWorldPlugin.jar file in my plugin project's target directory.
I copy this file to the directory of DataCleaner.
Open up the file conf.xml in the DataCleaner directory. We need to add a line so that it will scan for plugins in our jar file. Find the element <classpath-scanner> in the bottom of the file and add a line like this:
To start up DataCleaner, I then run:
And voila! My hello world transformer is ready for use :-) Here's the resulting transformed data:
Something that have been missing though is this: Once I've developed my plugins, how do I install them into DataCleaner so that I can start using them in production? It is very easy, actually.
Let's begin with the build. My "bare minimum" pom.xml file looks like this (I use Maven for the build, but any other build tool can be used as well):
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>hello.plugin</groupId>
<artifactId>HelloWorldPlugin</artifactId>
<version>0.1-SNAPSHOT</version>
<name>HelloWorldPlugin</name>
<build>
<finalName>HelloWorldPlugin</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eobjects.analyzerbeans</groupId>
<artifactId>AnalyzerBeans</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
</project>
This is my "bare minimum" plugin source code, a very simple hello world transformer:
package hello.plugin;
import org.eobjects.analyzer.beans.api.Configured;
import org.eobjects.analyzer.beans.api.OutputColumns;
import org.eobjects.analyzer.beans.api.Transformer;
import org.eobjects.analyzer.beans.api.TransformerBean;
import org.eobjects.analyzer.data.InputColumn;
import org.eobjects.analyzer.data.InputRow;
@TransformerBean("Hello world!")
public class HelloTransformer implements Transformer<String> {
@Configured
String greeting = "Hello";
@Configured
InputColumn<String> nameColumn;
@Override
public OutputColumns getOutputColumns() {
return new OutputColumns(1);
}
@Override
public String[] transform(InputRow row) {
return new String[] { greeting + " " + row.getValue(nameColumn) };
}
}
Here's how that will look in DataCleaner's user interface:
When I run a build ...
mvn package
I then have a HelloWorldPlugin.jar file in my plugin project's target directory.
I copy this file to the directory of DataCleaner.
Open up the file conf.xml in the DataCleaner directory. We need to add a line so that it will scan for plugins in our jar file. Find the element <classpath-scanner> in the bottom of the file and add a line like this:
<package>hello.plugin</package>(note that this package was my transformers package - you might need to adjust).
To start up DataCleaner, I then run:
java -cp HelloWorldPlugin.jar;DataCleaner.jar org.eobjects.datacleaner.Main(note that on non-windows environments you should use colon in stead of the semi-colon).
And voila! My hello world transformer is ready for use :-) Here's the resulting transformed data:
Log in by clicking the login link at the top of the screen
Go back to forum.


