Configuring Java CAPS Project Components for Communication Adapters

ProcedureTo Perform a Simple File Transfer

The following sample code demonstrates how to dynamically configure the Adapter and perform a simple file transfer.

  1. From BatchLocalFile, set the TargetDirectoryName.


    //@map:Copy "InDir" to TargetDirectoryName
    
    BatchLocalFile_1.getConfiguration().setTargetDirectoryName( "InDir" );
  2. From BatchFTP, Disconnect the Adapter.


    //@map:Client.disconnect
    
    BatchFTP_1.getClient().disconnect();
  3. Set the TargetDirectoryName.


    //@map:Copy "OutDir" to TargetDirectoryName
    
    BatchFTP_1.getConfiguration().setTargetDirectoryName( "OutDir" );
  4. Set the HostName


    //@map:Copy "myftphostname" to HostName
    
    BatchFTP_1.getConfiguration().setHostName( "myftphostname" );
  5. Connect the Adapter.


    //@map:Client.connect
    
    BatchFTP_1.getClient().connect();
  6. Perform a simple file transfer:

    Get a local file


    //@map:
    
    BatchLocalFile_1.getClient().get();
  7. Assign the Payload.


    //@map:Copy Payload to Payload
    
    BatchFTP_1.getClient().setPayload(BatchLocalFile_1.getClient().getPay
    load() );
  8. Put a file on the FTP server.


    //@map:Client.put
    
    BatchFTP_1.getClient().put();

    To view the Collaboration Editor’s Java Source Editor, click the Advance mode or Source Code mode icon, available on the Collaboration Editor toolbar.

    Where to Go Next

    Dynamic Configurable Parameters for Secure FTP OTDs.

    Related Topics