public void widgetSelected( SelectionEvent e ) { jobEntry.setChanged(); setDateTimeFormat(); setAddDateBeforeExtension(); } } );
private void closeFTPSConnection() { // Close FTPS connection if necessary if ( connection != null ) { try { connection.disconnect(); } catch ( Exception e ) { // Ignore errors } } }
private void updateErrors() { NrErrors++; if ( checkIfSuccessConditionBroken() ) { // Success condition was broken successConditionBroken = true; } }
/** * PDI-6868, attempt to set binary mode is after the connection.connect() succeeded. * @throws Exception */ @Test public void testBinaryModeSetAfterConnectionSuccess() throws Exception { JobEntryFTPSGet job = new JobEntryFTPSGetCustom(); FTPSConnection connection = Mockito.mock( FTPSConnection.class ); InOrder inOrder = Mockito.inOrder( connection ); job.buildFTPSConnection( connection ); inOrder.verify( connection ).connect(); inOrder.verify( connection ).setBinaryMode( Mockito.anyBoolean() ); }
/** * PDI-6868, attempt to set binary mode is after the connection.connect() succeeded. * @throws Exception */ @Test public void testBinaryModeSetAfterConnectionSuccess() throws Exception { JobEntryFTPSPUT job = new JobEntryFTPSPUTCustom(); FTPSConnection connection = Mockito.mock( FTPSConnection.class ); InOrder inOrder = Mockito.inOrder( connection ); job.buildFTPSConnection( connection ); inOrder.verify( connection ).connect(); inOrder.verify( connection ).setBinaryMode( Mockito.anyBoolean() ); }
public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException { try { rep.saveJobEntryAttribute( id_job, getObjectId(), "port", port ); rep.saveJobEntryAttribute( id_job, getObjectId(), "servername", serverName ); rep.saveJobEntryAttribute( id_job, getObjectId(), "username", userName ); rep.saveJobEntryAttribute( id_job, getObjectId(), "password", Encr .encryptPasswordIfNotUsingVariables( password ) ); rep.saveJobEntryAttribute( id_job, getObjectId(), "FTPSdirectory", FTPSDirectory ); rep.saveJobEntryAttribute( id_job, getObjectId(), "targetdirectory", targetDirectory ); rep.saveJobEntryAttribute( id_job, getObjectId(), "wildcard", wildcard ); rep.saveJobEntryAttribute( id_job, getObjectId(), "binary", binaryMode ); rep.saveJobEntryAttribute( id_job, getObjectId(), "timeout", timeout ); rep.saveJobEntryAttribute( id_job, getObjectId(), "remove", remove ); rep.saveJobEntryAttribute( id_job, getObjectId(), "only_new", onlyGettingNewFiles ); rep.saveJobEntryAttribute( id_job, getObjectId(), "active", activeConnection ); rep.saveJobEntryAttribute( id_job, getObjectId(), "movefiles", movefiles ); rep.saveJobEntryAttribute( id_job, getObjectId(), "movetodirectory", movetodirectory ); rep.saveJobEntryAttribute( id_job, getObjectId(), "addtime", addtime ); rep.saveJobEntryAttribute( id_job, getObjectId(), "adddate", adddate ); rep.saveJobEntryAttribute( id_job, getObjectId(), "SpecifyFormat", SpecifyFormat ); rep.saveJobEntryAttribute( id_job, getObjectId(), "date_time_format", date_time_format ); rep.saveJobEntryAttribute( id_job, getObjectId(), "AddDateBeforeExtension", AddDateBeforeExtension ); rep.saveJobEntryAttribute( id_job, getObjectId(), "isaddresult", isaddresult ); rep.saveJobEntryAttribute( id_job, getObjectId(), "createmovefolder", createmovefolder ); rep.saveJobEntryAttribute( id_job, getObjectId(), "proxy_host", proxyHost ); rep.saveJobEntryAttribute( id_job, getObjectId(), "proxy_port", proxyPort );
private boolean getSuccessStatus() { boolean retval = false; if ( ( NrErrors == 0 && getSuccessCondition().equals( SUCCESS_IF_NO_ERRORS ) ) || ( NrfilesRetrieved >= limitFiles && getSuccessCondition().equals( SUCCESS_IF_AT_LEAST_X_FILES_DOWNLOADED ) ) || ( NrErrors <= limitFiles && getSuccessCondition().equals( SUCCESS_IF_ERRORS_LESS ) ) ) { retval = true; } return retval; }
private void displayResults() { if ( isDetailed() ) { logDetailed( "=======================================" ); logDetailed( BaseMessages.getString( PKG, "JobEntryFTPS.Log.Info.FilesInError", "" + NrErrors ) ); logDetailed( BaseMessages.getString( PKG, "JobEntryFTPS.Log.Info.FilesRetrieved", "" + NrfilesRetrieved ) ); logDetailed( "=======================================" ); } }
public JobEntryFTPSGetDialog( Shell parent, JobEntryInterface jobEntryInt, Repository rep, JobMeta jobMeta ) { super( parent, jobEntryInt, rep, jobMeta ); jobEntry = (JobEntryFTPSGet) jobEntryInt; if ( this.jobEntry.getName() == null ) { this.jobEntry.setName( BaseMessages.getString( PKG, "JobFTPS.Name.Default" ) ); } }
/** * * this method is used to delete a file in remote host * * @param filename * Name of file on remote host to delete * @throws KettleException */ public void deleteFile( String filename ) throws KettleException { try { this.connection.deleteFile( new FTPFile( getWorkingDirectory(), filename ) ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "JobFTPS.Error.DeletingFile", filename ), e ); } }
private Properties getProperties( String hostname, int port, String username, String password, int connectionType, int timeout, boolean passiveMode ) { Properties pt = new Properties(); pt.setProperty( "connection.host", hostname ); pt.setProperty( "connection.port", String.valueOf( port ) ); pt.setProperty( "user.login", username ); pt.setProperty( "user.password", password ); pt.setProperty( "connection.type", getConnectionType( connectionType ) ); pt.setProperty( "connection.timeout", String.valueOf( timeout ) ); pt.setProperty( "connection.passive", String.valueOf( passiveMode ) ); // Set proxy if ( this.proxyHost != null ) { pt.setProperty( "proxy.host", this.proxyHost ); } if ( this.proxyPort != 0 ) { pt.setProperty( "proxy.port", String.valueOf( this.proxyPort ) ); } if ( this.proxyUser != null ) { pt.setProperty( "proxy.user", this.proxyUser ); } if ( this.proxyPassword != null ) { pt.setProperty( "proxy.pass", this.proxyPassword ); } return pt; }
/** * this method is used to download a file from a remote host * * @param file remote file to download * @param localFilename target filename * @throws KettleException */ public void downloadFile( FTPFile file, String localFilename ) throws KettleException { try { FileObject localFile = KettleVFS.getFileObject( localFilename, nameSpace ); writeToFile( connection.downloadStream( file ), localFile.getContent().getOutputStream(), localFilename ); } catch ( Exception e ) { throw new KettleException( e ); } }
private void closeFTPSConnection() { // Close FTP connection if necessary if ( connection != null ) { try { connection.disconnect(); } catch ( Exception e ) { // Ignore errors } } }
private boolean checkIfSuccessConditionBroken() { boolean retval = false; if ( ( NrErrors > 0 && getSuccessCondition().equals( SUCCESS_IF_NO_ERRORS ) ) || ( NrErrors >= limitFiles && getSuccessCondition().equals( SUCCESS_IF_ERRORS_LESS ) ) ) { retval = true; } return retval; }
public void widgetSelected( SelectionEvent e ) { activeIfExists(); jobEntry.setChanged(); } } );
public void widgetSelected( SelectionEvent e ) { jobEntry.setChanged(); } } );
public void modifyText( ModifyEvent e ) { // pwdFolder=null; connection = null; jobEntry.setChanged(); } };
public void widgetSelected( SelectionEvent e ) { jobEntry.setChanged(); } } );
public void widgetSelected( SelectionEvent e ) { jobEntry.setChanged(); } } );
private void cancel() { jobEntry.setChanged( changed ); jobEntry = null; dispose(); }