Skip to content

Commit

Permalink
[BACKLOG-17663] decouple autodoc step as a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcsantos committed Aug 7, 2017
1 parent b5ebc43 commit b3b1ce9
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 86 deletions.
7 changes: 7 additions & 0 deletions assemblies/pdi-ce/pom.xml
Expand Up @@ -81,6 +81,7 @@

<!-- plugins -->
<pdi-abort-plugin.version>${project.version}</pdi-abort-plugin.version>
<pdi-autodoc-plugin.version>${project.version}</pdi-autodoc-plugin.version>
<kettle-version-checker.version>${project.version}</kettle-version-checker.version>
<kettle-dummy-plugin.version>${project.version}</kettle-dummy-plugin.version>
<kettle-s3csvinput-plugin.version>${project.version}</kettle-s3csvinput-plugin.version>
Expand Down Expand Up @@ -778,6 +779,12 @@
<version>${pdi-abort-plugin.version}</version>
<type>zip</type>
</artifactItem>
<artifactItem>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>pdi-autodoc-plugin</artifactId>
<version>${pdi-autodoc-plugin.version}</version>
<type>zip</type>
</artifactItem>
<artifactItem>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>kettle-version-checker</artifactId>
Expand Down
1 change: 0 additions & 1 deletion engine/src/main/resources/kettle-steps.xml
Expand Up @@ -150,7 +150,6 @@
<step id="Rest"> <description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.Rest</description> <classname>org.pentaho.di.trans.steps.rest.RestMeta</classname> <category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Lookup</category> <tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.Rest</tooltip> <iconfile>ui/images/REST.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Rest+Client</documentation_url> <cases_url/> <forum_url/> </step>
<step id="GetRepositoryNames"> <description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.GetRepositoryNames</description> <classname>org.pentaho.di.trans.steps.getrepositorynames.GetRepositoryNamesMeta</classname> <category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Input</category> <tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.GetRepositoryNames</tooltip> <iconfile>ui/images/GRN.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Get+repository+names</documentation_url> <cases_url/> <forum_url/> </step>
<step id="PentahoReportingOutput"> <description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.PentahoReportingOutput</description> <classname>org.pentaho.di.trans.steps.pentahoreporting.PentahoReportingOutputMeta</classname> <category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Output</category> <tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.PentahoReportingOutput</tooltip> <iconfile>ui/images/JFR.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Pentaho+Reporting+Output</documentation_url> <cases_url/> <forum_url/> </step>
<step id="AutoDoc"> <description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.AutoDoc</description> <classname>org.pentaho.di.trans.steps.autodoc.AutoDocMeta</classname> <category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Output</category> <tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.AutoDoc</tooltip> <iconfile>ui/images/autodoc.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Automatic+Documentation+Output</documentation_url> <cases_url/> <forum_url/> </step>
<step id="SingleThreader"> <description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.SingleThreader</description> <classname>org.pentaho.di.trans.steps.singlethreader.SingleThreaderMeta</classname> <category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Flow</category> <tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.SingleThreader</tooltip> <iconfile>ui/images/MAP.svg</iconfile> <documentation_url>0L0/0Y0/0K0/Single_Threader</documentation_url> <cases_url/> <forum_url/> </step>
<step id="MultiwayMergeJoin"> <description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.MultiwayMergeJoin</description> <classname>org.pentaho.di.trans.steps.multimerge.MultiMergeJoinMeta</classname> <category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Joins</category> <tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.MultiwayMergeJoin</tooltip> <iconfile>ui/images/MJOINS.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Multiway+Merge+Join</documentation_url> <cases_url/> <forum_url/> </step>
<step id="SymmetricCryptoTrans"> <description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.SymmetricCryptography</description> <classname>org.pentaho.di.trans.steps.symmetriccrypto.symmetriccryptotrans.SymmetricCryptoTransMeta</classname> <category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Cryptography</category> <tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.SymmetricCryptography</tooltip> <iconfile>ui/images/SCE.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Symmetric+Cryptography</documentation_url><cases_url/> <forum_url/> </step>
Expand Down
Expand Up @@ -447,9 +447,6 @@ BaseStep.Category.Palo=Palo
BaseStep.TypeTooltipDesc.PentahoReportingOutput=Executes an existing report (PRPT)
BaseStep.TypeLongDesc.PentahoReportingOutput=Pentaho Reporting Output

BaseStep.TypeTooltipDesc.AutoDoc=This step automatically generates documentation based on input in the form of a list of transformations and jobs
BaseStep.TypeLongDesc.AutoDoc=Automatic Documentation Output

BaseStep.TypeLongDesc.MongoDbInput=MongoDB Input
BaseStep.TypeTooltipDesc.MongoDbInput=Reads all entries from a MongoDB collection in the specified database.

Expand Down
Expand Up @@ -75,7 +75,6 @@ BaseStep.TypeTooltipDesc.BlockUntilStepsFinish=Cette \u00E9tape d\u00E9marrera l
BaseStep.TypeLongDesc.GroupBy=Agr\u00E9gation valeurs
BaseStep.TypeLongDesc.RowNormaliser=Normalisation Ligne
BaseStep.TypeLongDesc.DimensionUpdate=Dimension \u00E0 variation lente
BaseStep.TypeTooltipDesc.AutoDoc=G\u00E9n\u00E9ration automatique de documentation\ndepuis des fichiers transformation ou t\u00E2che
BaseStep.Property.MaxPercentErrors.Name=Le pourcentage maximal d''erreurs
BaseStep.TypeTooltipDesc.Addconstants=Ajouter une ou plusieurs constantes aux flux d''entr\u00E9e
BaseStep.TypeLongDesc.MappingInput=Sp\u00E9cification entr\u00E9e sous-transformation
Expand Down Expand Up @@ -293,7 +292,6 @@ BaseStep.Log.UnableToFindInputRowset=Impossible de trouver le jeux d''enregistre
BaseStep.TypeLongDesc.SyslogMessage=Envoi d''information via Syslog
BaseStep.TypeTooltipDesc.IfNull=Remplacer la valeur du champ\npar une valeur par d\u00E9faut si elle est nulle.
BaseStep.TypeTooltipDesc.TeraFast=Chargement en bloc de donn\u00E9es vers une base Teradata.
BaseStep.TypeLongDesc.AutoDoc=G\u00E9n\u00E9ration automatique de documentation
BaseStep.TypeLongDesc.SortedMerge=Comparaison tri\u00E9e lignes
BaseStep.TypeTooltipDesc.Injector=Cette \u00E9tape permet d''injecter des lignes dans la transformation \u00E0 travers l''API Java
BaseStepDialog.AddNew=Ajouter &nouveaux
Expand Down
Expand Up @@ -467,8 +467,6 @@ BaseStep.TypeTooltipDesc.GetRepositoryNames = Lists detailed information about t
BaseStep.Category.Palo=Palo
BaseStep.TypeTooltipDesc.PentahoReportingOutput=Executes an existing report (PRPT)\n\u65e2\u5b58\u306e\u30ec\u30dd\u30fc\u30c8(PRPT)\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002
BaseStep.TypeLongDesc.PentahoReportingOutput=Pentaho\u30ec\u30dd\u30fc\u30c8\u51fa\u529b
BaseStep.TypeTooltipDesc.AutoDoc=This step automatically generates documentation based on input in the form of a list of transformations and jobs\n\u3053\u306e\u30b9\u30c6\u30c3\u30d7\u306ftransformations\u3084jobs\u30d5\u30a1\u30a4\u30eb\u306e\u30ea\u30b9\u30c8\u3092\u81ea\u52d5\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u5316\u3057\u307e\u3059\u3002
BaseStep.TypeLongDesc.AutoDoc=\u81ea\u52d5\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u51fa\u529b
BaseStep.TypeLongDesc.MongoDbInput=MongoDB\u5165\u529b
BaseStep.TypeTooltipDesc.MongoDbInput=Reads all entries from a MongoDB collection in the specified database.\n\u6307\u5b9a\u3057\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5185\u306eMongoDB\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304b\u3089\u3059\u3079\u3066\u306e\u30a8\u30f3\u30c8\u30ea\u3092\u8aad\u307f\u53d6\u308a\u307e\u3059\u3002
BaseStep.TypeLongDesc.SingleThreader=\u30b7\u30f3\u30b0\u30eb\u30b9\u30ec\u30c3\u30c0\u30fc
Expand Down
Expand Up @@ -200,7 +200,6 @@ BaseStep.TypeLongDesc.AccessOutput=Access \u8f93\u51fa
BaseStep.TypeLongDesc.AddXML=\u589e\u52a0XML\u5217
BaseStep.TypeLongDesc.AnalyticQuery=\u5206\u6790\u67e5\u8be2
BaseStep.TypeLongDesc.Append=\u8ffd\u52a0\u6d41
BaseStep.TypeLongDesc.AutoDoc=\u81ea\u52a8\u6587\u6863\u8f93\u51fa
BaseStep.TypeLongDesc.BeanShell=BeanShell \u8f93\u5165
BaseStep.TypeLongDesc.BlockUntilStepsFinish=\u963b\u585e\u6570\u636e\u76f4\u5230\u6b65\u9aa4\u90fd\u5b8c\u6210
BaseStep.TypeLongDesc.BlockingStep=\u963b\u585e\u6570\u636e
Expand Down
1 change: 1 addition & 0 deletions plugins/autodoc/assemblies/plugin/pom.xml
Expand Up @@ -10,6 +10,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>pdi-autodoc-plugin</artifactId>
<name>PDI AutoDoc Step Plugin Distribution</name>
<packaging>pom</packaging>

<dependencies>
Expand Down
1 change: 1 addition & 0 deletions plugins/autodoc/assemblies/pom.xml
Expand Up @@ -10,6 +10,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>pdi-autodoc-assemblies</artifactId>
<name>PDI AutoDoc Step Plugin Assemblies</name>
<packaging>pom</packaging>
<modules>
<module>plugin</module>
Expand Down
20 changes: 16 additions & 4 deletions plugins/autodoc/impl/pom.xml
Expand Up @@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>pdi-autodoc-plugin-impl</artifactId>
<name>PDI Autodoc Step Plugin Impl</name>
<name>PDI AutoDoc Step Plugin Impl</name>

<properties>
<kettle.version>8.0-SNAPSHOT</kettle.version>
Expand All @@ -30,12 +30,24 @@
<version>${kettle.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-ui-swt</artifactId>
<version>${kettle.version}</version>
<scope>provided</scope>
</dependency>

<!-- SWT it required to compile any version of any architecture will work -->
<dependency>
<groupId>org.pentaho.reporting.engine</groupId>
<artifactId>classic-core</artifactId>
<version>${pentaho-reporting.version}</version>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Expand Up @@ -2,7 +2,7 @@
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2016 by Pentaho : http://www.pentaho.com
* Copyright (C) 2002-2017 by Pentaho : http://www.pentaho.com
*
*******************************************************************************
*
Expand All @@ -26,6 +26,7 @@

import org.pentaho.di.core.CheckResult;
import org.pentaho.di.core.CheckResultInterface;
import org.pentaho.di.core.annotations.Step;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
Expand Down Expand Up @@ -56,6 +57,10 @@
* @author matt
* @version 4
*/
@Step( id = "AutoDoc", image = "autodoc.svg", i18nPackageName = "org.pentaho.di.trans.steps.autodoc",
name = "AutoDoc.Name", description = "AutoDoc.Description",
documentationUrl = "http://wiki.pentaho.com/display/EAI/Automatic+Documentation+Output",
categoryDescription = "i18n:org.pentaho.di.trans.step:BaseStep.Category.Output" )
public class AutoDocMeta extends BaseStepMeta implements StepMetaInterface, AutoDocOptionsInterface {
private static Class<?> PKG = AutoDocMeta.class; // for i18n purposes, needed by Translator2!!

Expand Down
Expand Up @@ -2,7 +2,7 @@
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2013 by Pentaho : http://www.pentaho.com
* Copyright (C) 2002-2017 by Pentaho : http://www.pentaho.com
*
*******************************************************************************
*
Expand Down Expand Up @@ -226,10 +226,11 @@ public void createReport() throws Exception {
// Optionally include an image of the transformation...
//
if ( options.isIncludingImage() ) {
String packName = KettleReportBuilder.class.getPackage().getName();
// for this to work the reporting engine must be able to see our classes, we do this by changing the thread
// classloader to be the plugin's classloader. see #render()
String bshCode =
"Object getValue() { "
+ Const.CR + " return new " + packName + ".TransJobDrawable(dataRow, "
+ Const.CR + " return new " + TransJobDrawable.class.getName() + "(dataRow, "
+ ( options.getOutputType() == OutputType.PDF ? "true" : "false" ) + ");" + Const.CR + "}";
BSHExpression bshExpression = new BSHExpression();
bshExpression.setExpression( bshCode );
Expand Down Expand Up @@ -291,24 +292,33 @@ public void render() throws Exception {

createReport();

switch ( options.getOutputType() ) {
case PDF:
PdfReportUtil.createPDF( report, targetFilename );
break;
case DOC:
RTFReportUtil.createRTF( report, targetFilename );
break;
case XLS:
ExcelReportUtil.createXLS( report, targetFilename );
break;
case HTML:
HtmlReportUtil.createDirectoryHTML( report, targetFilename );
break;
case CSV:
CSVReportUtil.createCSV( report, targetFilename );
break;
default:
break;
ClassLoader originalClassloader = Thread.currentThread().getContextClassLoader();

try {
// we need to change the current classloader for the reporting to find our plugin classes
Thread.currentThread().setContextClassLoader( KettleReportBuilder.class.getClassLoader() );

switch ( options.getOutputType() ) {
case PDF:
PdfReportUtil.createPDF( report, targetFilename );
break;
case DOC:
RTFReportUtil.createRTF( report, targetFilename );
break;
case XLS:
ExcelReportUtil.createXLS( report, targetFilename );
break;
case HTML:
HtmlReportUtil.createDirectoryHTML( report, targetFilename );
break;
case CSV:
CSVReportUtil.createCSV( report, targetFilename );
break;
default:
break;
}
} finally {
Thread.currentThread().setContextClassLoader( originalClassloader );
}
}

Expand Down

0 comments on commit b3b1ce9

Please sign in to comment.