Skip to content

Commit

Permalink
[BACKLOG-38618] Get File SFTP Core To Plugin Movement
Browse files Browse the repository at this point in the history
  • Loading branch information
Mandakini1990 committed Sep 22, 2023
1 parent aec8d4f commit b758301
Show file tree
Hide file tree
Showing 26 changed files with 451 additions and 96 deletions.
13 changes: 13 additions & 0 deletions assemblies/plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<yaml-input-plugin.version>${project.version}</yaml-input-plugin.version>
<pentaho-reporting-plugin.version>10.1.0.0-SNAPSHOT</pentaho-reporting-plugin.version>
<ms-access-plugin.version>${project.version}</ms-access-plugin.version>
<get-file-sftp-plugin.version>${project.version}</get-file-sftp-plugin.version>
<oracle-bulk-loader-plugin.version>${project.version}</oracle-bulk-loader-plugin.version>
<terafast-bulk-loader-plugin.version>${project.version}</terafast-bulk-loader-plugin.version>
<postgresql-db-bulk-loader-plugin.version>${project.version}</postgresql-db-bulk-loader-plugin.version>
Expand Down Expand Up @@ -115,6 +116,18 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>get-file-sftp-plugin</artifactId>
<version>${get-file-sftp-plugin.version}</version>
<type>zip</type>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>kettle-shapefilereader-plugin</artifactId>
Expand Down
1 change: 0 additions & 1 deletion engine/src/main/resources/kettle-job-entries.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<job-entry id="FTP"> <description>i18n:org.pentaho.di.job.entry:JobEntry.FTP.TypeDesc</description> <classname>org.pentaho.di.job.entries.ftp.JobEntryFTP</classname> <category>i18n:org.pentaho.di.job:JobCategory.Category.FileTransfer</category> <tooltip>i18n:org.pentaho.di.job.entry:JobEntry.FTP.Tooltip</tooltip> <iconfile>ui/images/GFTP.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Get+a+file+with+FTP</documentation_url> <cases_url/> <forum_url/> </job-entry>
<job-entry id="FTPS_GET"> <description>i18n:org.pentaho.di.job.entry:JobEntry.FTPSGet.TypeDesc</description> <classname>org.pentaho.di.job.entries.ftpsget.JobEntryFTPSGet</classname> <category>i18n:org.pentaho.di.job:JobCategory.Category.FileTransfer</category> <tooltip>i18n:org.pentaho.di.job.entry:JobEntry.FTPSGet.Tooltip</tooltip> <iconfile>ui/images/GFTPS.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Get+a+file+with+FTPS</documentation_url> <cases_url/> <forum_url/> </job-entry>
<job-entry id="FTPS_PUT"> <description>i18n:org.pentaho.di.job.entry:JobEntry.FTPSPut.TypeDesc</description> <classname>org.pentaho.di.job.entries.ftpsput.JobEntryFTPSPUT</classname> <category>i18n:org.pentaho.di.job:JobCategory.Category.FileTransfer</category> <tooltip>i18n:org.pentaho.di.job.entry:JobEntry.FTPSPut.Tooltip</tooltip> <iconfile>ui/images/PFTPS.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Upload+files+to+FTPS</documentation_url> <cases_url/> <forum_url/> </job-entry>
<job-entry id="SFTP"> <description>i18n:org.pentaho.di.job.entry:JobEntry.SFTP.TypeDesc</description> <classname>org.pentaho.di.job.entries.sftp.JobEntrySFTP</classname> <category>i18n:org.pentaho.di.job:JobCategory.Category.FileTransfer</category> <tooltip>i18n:org.pentaho.di.job.entry:JobEntry.SFTP.Tooltip</tooltip> <iconfile>ui/images/GSFTP.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Get+a+file+with+SFTP</documentation_url> <cases_url/> <forum_url/> </job-entry>
<job-entry id="TABLE_EXISTS"> <description>i18n:org.pentaho.di.job.entry:JobEntry.TableExists.TypeDesc</description> <classname>org.pentaho.di.job.entries.tableexists.JobEntryTableExists</classname> <category>i18n:org.pentaho.di.job:JobCategory.Category.Conditions</category> <tooltip>i18n:org.pentaho.di.job.entry:JobEntry.TableExists.Tooltip</tooltip> <iconfile>ui/images/TEX.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Table+Exists+%28Job+Entry%29</documentation_url> <cases_url/> <forum_url/> </job-entry>
<job-entry id="FILE_EXISTS"> <description>i18n:org.pentaho.di.job.entry:JobEntry.FileExists.TypeDesc</description> <classname>org.pentaho.di.job.entries.fileexists.JobEntryFileExists</classname> <category>i18n:org.pentaho.di.job:JobCategory.Category.Conditions</category> <tooltip>i18n:org.pentaho.di.job.entry:JobEntry.FileExists.Tooltip</tooltip> <iconfile>ui/images/FEX.svg</iconfile> <documentation_url>Products/File_Exists_(Job_Entry)</documentation_url> <cases_url/> <forum_url/> </job-entry>
<job-entry id="EVAL"> <description>i18n:org.pentaho.di.job.entry:JobEntry.Evaluation.TypeDesc</description> <classname>org.pentaho.di.job.entries.eval.JobEntryEval</classname> <category>i18n:org.pentaho.di.job:JobCategory.Category.Scripting</category> <tooltip>i18n:org.pentaho.di.job.entry:JobEntry.Evaluation.Tooltip</tooltip> <iconfile>ui/images/SCR_mod.svg</iconfile> <documentation_url>http://wiki.pentaho.com/display/EAI/Evaluating+conditions+in+The+JavaScript+job+entry</documentation_url> <cases_url/> <forum_url/> </job-entry>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


#Wed Oct 03 20:21:06 CEST 2007
JobEntry.SFTP.TypeDesc=Get a file with SFTP
JobEntry.Special.Tooltip=Special entries\: start and dummy
JobEntry.CreateFile.TypeDesc=Create file
JobEntry.MsgBoxInfo.TypeDesc=Display msgbox info
Expand Down Expand Up @@ -40,7 +39,6 @@ JobEntry.Shell.Tooltip=Executes a shell script
JobEntry.DeleteFile.Tooltip=Delete a file
JobEntry.Success.TypeDesc=Success
JobEntry.CopyFiles.TypeDesc=Copy files
JobEntry.SFTP.Tooltip=Get files using Secure FTP (Secure File Transfer Protocol)
JobEntry.Job.TypeDesc=Job
JobEntry.UnZip.TypeDesc=Unzip file
JobEntry.ZipFile.Tooltip=Zip files from a directory and process files
Expand Down
1 change: 1 addition & 0 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ __List of the current core plugins:__
* mail-job
* dummy
* gpload
* get-file-sftp
* sftpput
* hl7
* json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.job.Job;
import org.pentaho.di.job.JobMeta;
import org.pentaho.di.job.entries.sftp.JobEntrySFTP;
import org.pentaho.di.job.entry.JobEntryBase;
import org.pentaho.di.job.entry.JobEntryInterface;
import org.pentaho.di.job.entry.validator.ValidatorContext;
Expand Down Expand Up @@ -823,10 +822,4 @@ public void check( List<CheckResultInterface> remarks, JobMeta jobMeta, Variable
JobEntryValidatorUtils.andValidator().validate( this, "password", remarks,
AndValidator.putValidators( JobEntryValidatorUtils.notNullValidator() ) );
}

public static void main( String[] args ) {
List<CheckResultInterface> remarks = new ArrayList<CheckResultInterface>();
new JobEntrySFTP().check( remarks, null, new Variables(), null, null );
System.out.printf( "Remarks: %s\n", remarks );
}
}
55 changes: 55 additions & 0 deletions plugins/get-file-sftp/assemblies/plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>get-file-sftp-assemblies</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
</parent>

<artifactId>get-file-sftp-plugin</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>PDI Get File SFTP Plugin Distribution</name>
<description></description>

<dependencies>
<dependency>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>get-file-sftp-plugin-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>get-file-sftp-plugin-ui</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>add-libs</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/assembly/lib</outputDirectory>
<includeScope>compile</includeScope>
<excludeArtifactIds>get-file-sftp-plugins-impl,get-file-sftp-plugins-ui</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
37 changes: 37 additions & 0 deletions plugins/get-file-sftp/assemblies/plugin/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>get-file-sftp-plugin</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory>get-file-sftp-plugin</baseDirectory>

<files>
<file>
<source>${project.basedir}/src/main/resources/version.xml</source>
<outputDirectory>.</outputDirectory>
<filtered>true</filtered>
</file>
</files>

<fileSets>
<!-- the staging dir -->
<fileSet>
<directory>${project.build.directory}/assembly</directory>
<outputDirectory>.</outputDirectory>
</fileSet>
</fileSets>

<dependencySets>
<dependencySet>
<outputDirectory>.</outputDirectory>
<includes>
<include>org.pentaho.di.plugins:get-file-sftp-plugin-impl:jar</include>
<include>org.pentaho.di.plugins:get-file-sftp-plugin-ui:jar</include>
</includes>
<useProjectArtifact>false</useProjectArtifact>
</dependencySet>
</dependencySets>
</assembly>


Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<version>${project.version}</version>
22 changes: 22 additions & 0 deletions plugins/get-file-sftp/assemblies/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>get-file-sftp</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
</parent>

<artifactId>get-file-sftp-assemblies</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>PDI Get File SFTP Plugins Assemblies</name>

<modules>
<module>plugin</module>
</modules>
</project>
52 changes: 52 additions & 0 deletions plugins/get-file-sftp/impl/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.pentaho.di.plugins</groupId>
<artifactId>get-file-sftp</artifactId>
<version>10.1.0.0-SNAPSHOT</version>
</parent>

<artifactId>get-file-sftp-plugin-impl</artifactId>
<name>PDI Get File SFTP Impl</name>

<dependencies>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-engine</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.healthmarketscience.jackcess</groupId>
<artifactId>jackcess</artifactId>
<scope>compile</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-core</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pentaho-kettle</groupId>
<artifactId>kettle-engine</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com
* Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com
*
*******************************************************************************
*
Expand All @@ -22,17 +22,6 @@

package org.pentaho.di.job.entries.sftp;

import org.pentaho.di.job.entry.validator.AbstractFileValidator;
import org.pentaho.di.job.entry.validator.AndValidator;
import org.pentaho.di.job.entry.validator.JobEntryValidatorUtils;

import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.vfs2.FileObject;
import org.pentaho.di.cluster.SlaveServer;
import org.pentaho.di.core.CheckResultInterface;
Expand All @@ -41,6 +30,7 @@
import org.pentaho.di.core.Result;
import org.pentaho.di.core.ResultFile;
import org.pentaho.di.core.RowMetaAndData;
import org.pentaho.di.core.annotations.JobEntry;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.encryption.Encr;
import org.pentaho.di.core.exception.KettleDatabaseException;
Expand All @@ -54,6 +44,9 @@
import org.pentaho.di.job.JobMeta;
import org.pentaho.di.job.entry.JobEntryBase;
import org.pentaho.di.job.entry.JobEntryInterface;
import org.pentaho.di.job.entry.validator.AbstractFileValidator;
import org.pentaho.di.job.entry.validator.AndValidator;
import org.pentaho.di.job.entry.validator.JobEntryValidatorUtils;
import org.pentaho.di.job.entry.validator.ValidatorContext;
import org.pentaho.di.repository.ObjectId;
import org.pentaho.di.repository.Repository;
Expand All @@ -63,13 +56,26 @@
import org.pentaho.metastore.api.IMetaStore;
import org.w3c.dom.Node;

import java.net.InetAddress;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* This defines a SFTP job entry.
*
* @author Matt
* @since 05-11-2003
*
*/
@JobEntry( id = "SFTP", name = "JobEntry.SFTP.TypeDesc",
i18nPackageName = "org.pentaho.di.job.entries.sftp",
description = "JobEntry.SFTP.Tooltip",
categoryDescription = "i18n:org.pentaho.di.job:JobCategory.Category.FileTransfer",
image = "GSFTP.svg",
documentationUrl = "http://wiki.pentaho.com/display/EAI/Get+a+file+with+SFTP" )
public class JobEntrySFTP extends JobEntryBase implements Cloneable, JobEntryInterface {
private static Class<?> PKG = JobEntrySFTP.class; // for i18n purposes, needed by Translator2!!

Expand All @@ -96,7 +102,7 @@ public class JobEntrySFTP extends JobEntryBase implements Cloneable, JobEntryInt
private String proxyUsername;
private String proxyPassword;

public JobEntrySFTP( String n ) {
public JobEntrySFTP(String n ) {
super( n, "" );
serverName = null;
serverPort = "22";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#Sun May 04 16:49:29 CEST 2008
JobSFTP.RemoveFiles.Tooltip=Removes files on remote server after transfer.\nBe CAREFUL using this option, probably deletion cannot be undone.
JobSFTP.Log.DeletedFile=Deleted file [{0}]
JobEntry.SFTP.TypeDesc=Get a file with SFTP
JobEntry.SFTP.Tooltip=Get files using Secure FTP (Secure File Transfer Protocol)
JobSFTP.RemoteDir.Label=Remote directory\:
JobSFTP.Log.GettingFiles=Getting file [{0}] to directory [{1}]
JobSFTP.Name.Label=Job entry name\:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com
* Copyright (C) 2002-2023 by Hitachi Vantara : http://www.pentaho.com
*
*******************************************************************************
*
Expand All @@ -22,13 +22,13 @@

package org.pentaho.di.job.entries.sftp;

import java.util.Arrays;
import java.util.List;

import org.junit.ClassRule;
import org.pentaho.di.job.entry.loadSave.JobEntryLoadSaveTestSupport;
import org.pentaho.di.junit.rules.RestorePDIEngineEnvironment;

import java.util.Arrays;
import java.util.List;

public class JobEntrySFTPLoadSaveTest extends JobEntryLoadSaveTestSupport<JobEntrySFTP> {
@ClassRule public static RestorePDIEngineEnvironment env = new RestorePDIEngineEnvironment();

Expand Down
Loading

0 comments on commit b758301

Please sign in to comment.