Skip to content

Commit

Permalink
[BACKLOG-19621] updates step archetype plugin structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcsantos committed Nov 7, 2017
1 parent 885de9d commit 2a11f24
Show file tree
Hide file tree
Showing 37 changed files with 1,042 additions and 636 deletions.
17 changes: 10 additions & 7 deletions pentaho-pdi-job-plugin-archetype/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ To use this to create a new PDI job plugin project you could then do something l
mvn archetype:generate \
-DarchetypeGroupId=org.pentaho \
-DarchetypeArtifactId=pdi-job-plugin-archetype \
-DgroupId=com.my.company \
-DartifactId=my-job-plugin \
-Dversion=2.1-SNAPSHOT \
-DarchetypeVersion=2.21-SNAPSHOT \
-DgroupId=org.pentaho.di.plugins \
-DartifactId=myjob \
-Dversion=1.0-SNAPSHOT \
-Dplugin_class_name=MyJob \
-Dplugin_name="My Job" \
-Dplugin_name="My Job Plugin" \
-Dplugin_category=General \
-Dplugin_description="This is what my job does."
```

$ cd my-job-plugin
```
$ cd myjob
$ mvn clean install
```

To deploy copy the generated "my-job-plugin-2.0-SNAPSHOT.kar" into "data-integration\system\karaf\deploy"
To deploy copy the generated "assembly/target/myjob-plugin-1.0-SNAPSHOT.kar" into "data-integration\system\karaf\deploy"
Original file line number Diff line number Diff line change
@@ -1,51 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="pdi-job-plugin"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<archetype-descriptor
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="pdi-job-plugin"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requiredProperties>
<requiredProperty key="plugin_class_name"></requiredProperty>
<requiredProperty key="plugin_name"></requiredProperty>
<requiredProperty key="plugin_category"></requiredProperty>
<requiredProperty key="plugin_description"></requiredProperty>
<requiredProperty key="plugin_class_name"/>
<requiredProperty key="plugin_name"/>
<requiredProperty key="plugin_category"/>
<requiredProperty key="plugin_description"/>
<requiredProperty key="kettleVersion">
<defaultValue>7.0.0.3-62</defaultValue>
</requiredProperty>
<defaultValue>8.1-SNAPSHOT</defaultValue>
</requiredProperty>

<requiredProperty key="package">
<defaultValue>org.pentaho.di</defaultValue>
</requiredProperty>
</requiredProperties>

<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/test/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.svg</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/messages_*.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory></directory>
<directory/>
<includes>
<include>.gitignore</include>
<include>README.md</include>
<include>LICENSE.txt</include>
</includes>
<excludes>
<exclude>*.iml</exclude>
</excludes>
</fileSet>
</fileSets>

<modules>
<module id="${rootArtifactId}-impl" dir="impl" name="${plugin_name} Impl">
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
</fileSet>
</fileSets>
</module>
<module id="${rootArtifactId}-ui" dir="ui" name="${plugin_name} UI">
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/*.svg</include>
</includes>
</fileSet>
</fileSets>
</module>
<module id="${rootArtifactId}-plugin" dir="assembly" name="${plugin_name} Assembly">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/feature</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
</fileSets>
</module>
</modules>
</archetype-descriptor>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}</artifactId>
<version>${version}</version>
</parent>

<artifactId>${artifactId}</artifactId>
<packaging>kar</packaging>

<name>${plugin_name} Assembly</name>

<dependencies>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}-ui</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
<?xml version="1.0" encoding="UTF-8"?>
<features name="pentaho-${symbol_dollar}{project.artifactId}-${symbol_dollar}{project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">

<feature name='pentaho-${symbol_dollar}{project.artifactId}' description='${symbol_dollar}{project.description}'>
<details>${plugin_description}</details>
</feature>

</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>${groupId}</groupId>
<artifactId>${rootArtifactId}</artifactId>
<version>${version}</version>
</parent>

<artifactId>${artifactId}</artifactId>
<packaging>bundle</packaging>

<name>${plugin_name} Impl</name>

<properties>
<pentaho-metaverse.version>${kettleVersion}</pentaho-metaverse.version>
<metastore.version>${kettleVersion}</metastore.version>
<xml-apis.version>2.0.2</xml-apis.version>
</properties>

<dependencies>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-core</artifactId>
<version>${kettle.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-engine</artifactId>
<version>${kettle.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>pentaho</groupId>
<artifactId>pentaho-metaverse-api</artifactId>
<version>${pentaho-metaverse.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>pentaho</groupId>
<artifactId>metastore</artifactId>
<version>${metastore.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>${xml-apis.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.blueprint</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>pentaho</groupId>
<artifactId>pdi-osgi-bridge-core</artifactId>
<version>${kettle.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<DynamicImport-Package>${package}.ui.job.entries.${rootArtifactId},${rootArtifactId}.ui.images</DynamicImport-Package>
<Import-Package>
org.pentaho.di.osgi,
org.pentaho.di.core.plugins,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package ${package};
package ${package}.job.entries.${rootArtifactId};

import java.io.File;
import java.io.FileFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
* specific language governing permissions and limitations
* under the License.
*/
package ${package};
package ${package}.job.entries.${rootArtifactId};

import java.util.List;
import org.pentaho.di.core.annotations.JobEntry;
import org.pentaho.di.cluster.SlaveServer;
import org.pentaho.di.core.Result;
import org.pentaho.di.core.database.DatabaseMeta;
Expand All @@ -36,10 +37,10 @@
import org.pentaho.metastore.api.IMetaStore;
import org.w3c.dom.Node;

@org.pentaho.di.core.annotations.JobEntry( id = "${plugin_class_name}",
i18nPackageName = "${package}", image = "${plugin_class_name}.svg",
name = "${plugin_name}", description = "${plugin_description}",
categoryDescription = "${plugin_category}" )
@JobEntry( id = "${plugin_class_name}", image = "${rootArtifactId}/ui/images/${plugin_class_name}.svg",
i18nPackageName = "${package}.job.entries.${rootArtifactId}",
name = "${plugin_class_name}.Name", description = "${plugin_class_name}.Description",
categoryDescription = "i18n:org.pentaho.di.job:JobCategory.Category.${plugin_category}" )
public class ${plugin_class_name}Entry extends JobEntryBase implements Cloneable, JobEntryInterface {

private static final String WILDCARD = "wildcard";
Expand Down Expand Up @@ -183,4 +184,9 @@ public Result execute( Result prev_result, int nr ) {
public boolean evaluates() {
return true;
}

@Override
public String getDialogClassName() {
return "${package}.ui.job.entries.${rootArtifactId}.${plugin_class_name}EntryDialog";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package ${package};
package ${package}.job.entries.${rootArtifactId};

import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleMissingPluginsException;
Expand All @@ -34,17 +34,13 @@
import org.pentaho.metaverse.api.MetaverseComponentDescriptor;
import org.pentaho.metaverse.api.analyzer.kettle.KettleAnalyzerUtil;
import org.pentaho.metaverse.api.analyzer.kettle.jobentry.JobEntryAnalyzer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.HashSet;
import java.util.Set;

public class ${plugin_class_name}EntryAnalyzer extends JobEntryAnalyzer<${plugin_class_name}Entry> {

private Logger log = LoggerFactory.getLogger( ${plugin_class_name}EntryAnalyzer.class );

@Override
public Set<Class<? extends JobEntryInterface>> getSupportedEntries() {
Set<Class<? extends JobEntryInterface>> supportedEntries = new HashSet<Class<? extends JobEntryInterface>>();
Expand Down
Loading

0 comments on commit 2a11f24

Please sign in to comment.