Sun Adapter for Batch Tutorial

jcdBatchFTPOverSSL Java Source File


package prBatch_Secure;


public class jcdBatchFTPOverSSL
{

    public com.stc.codegen.logger.Logger logger;

    public com.stc.codegen.alerter.Alerter alerter;

    public com.stc.codegen.util.CollaborationContext collabContext;

    public com.stc.codegen.util.TypeConverter typeConverter;

    public void receive( com.stc.connector.appconn.file.FileTextMessage 
input, com.stc.connector.batchadapter.appconn.ftps.FTPOverSSL 
BatchFTPOverSSL_1,com.stc.connector.appconn.file.FileApplication FileClient_1 )
        throws Throwable
    {
        // get and put
        BatchFTPOverSSL_1.getConfiguration().setLocalFile( 
"FTPOverSSL_from_remote.txt" );
        BatchFTPOverSSL_1.getClient().get();
        BatchFTPOverSSL_1.getConfiguration().setRemoteFile( 
"FTPOverSSL_to_remote.txt" );
        BatchFTPOverSSL_1.getClient().put();
        // download and upload
        BatchFTPOverSSL_1.getConfiguration().setLocalDirectory( 
"c:/BatchSecurity/FTPOverSSL" );
        BatchFTPOverSSL_1.getConfiguration().setLocalFile( 
"FTPOverSSL_from_remote.txt" );
        BatchFTPOverSSL_1.getClient().download();
        BatchFTPOverSSL_1.getConfiguration().setRemoteDirectory( 
"BatchSecurity/FTPOverSSL" );
        BatchFTPOverSSL_1.getConfiguration().setRemoteFile( 
"FTPOverSSL_to_remote.txt" );
        BatchFTPOverSSL_1.getClient().upload();
        // Create and list directories
        String entryInfo;
        int entryCnt;
        for (int i = 1; i < 6; i++) {
            BatchFTPOverSSL_1.getClient().mkdir( "mydir_" + i );
        }
        BatchFTPOverSSL_1.getClient().listDirLong();
        entryCnt = BatchFTPOverSSL_1.getClient().getEntryCount();
        entryInfo = "Directory Listing:\n";
        for (int i = 0; i < entryCnt; i++) {
            entryInfo = "[" + BatchFTPOverSSL_1.getClient().getEntry( 
i ).getDirectory() + "]" + "[" + BatchFTPOverSSL_1.getClient().getEntry( 
i ).getFile() + "]" + "[" + BatchFTPOverSSL_1.getClient().getEntry( i ).
getFileSize() + "]" + "[" + BatchFTPOverSSL_1.getClient().getEntry( 
i ).isDir() + "]" + "\n";
        }
        FileClient_1.setText( entryInfo );
        FileClient_1.write();
        // Delete and list directories
        for (int i = 1; i < 5; i++) {
            BatchFTPOverSSL_1.getClient().deleteDir( "mydir_" + i );
        }
        BatchFTPOverSSL_1.getClient().listDir();
        entryCnt = BatchFTPOverSSL_1.getClient().getEntryCount();
        entryInfo = "Directory Listing:\n";
        for (int i = 0; i < entryCnt; i++) {
            entryInfo = "[" + BatchFTPOverSSL_1.getClient().getEntry( 
i ).getDirectory() + "]" + "\n";
        }
        FileClient_1.setText( entryInfo );
        FileClient_1.write();
    }

}