Sun Adapter for Batch User's Guide

Dynamic Configuration

The BatchFTP, BatchFTPOverSSL, BatchSCP and BatchSFTP OTDs support automatic connection during initialization. Each of these OTDs require a number of properties to be set with valid values when Connection Mode is set to Automatic. This includes, but is not limited to, the following:

Environment Properties:

These parameters must be set to valid values prior to using the BatchFTP OTD to allow the adapter to initialize successfully. After the initialization is successful, the parameters can be reconfigured from within the Collaboration Rule.

Dynamic configuration allows you to change configuration settings (based on the data input or Collaboration Rule logic) on the fly. Changes are made to the Collaboration using the Collaboration Editor. Make any necessary changes to the configuration settings and perform the put or get. The Project disconnects, reconnects with the new configuration settings, and performs the transfer.

Dynamic Configuration Sample

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.

Dynamic Configurable Parameters for Secure FTP OTDs

The secure Batch FTP OTDs contain several dynamic configurable parameters, which include (but are not limited to) the following:

BatchFTPOverSSL:

BatchSCP:

BatchSFTP:

Configuration Parameters that Accept Integer Values

The configuration parameters listed below can be configured from the Collaboration Editor by entering the specified integer values in the method parameters. The classes, com.stc.connect.ssl.FTPSSLConstants and com.stc.connect.ssh.SSHConstants, do not allow “incremental completion,” that is, you must enter the value using the fully qualified name to access the constant.

For example, to set the BatchFTPOverSSL Secure Mode to Explicit SSL, from the Collaboration Editor, do the following:

  1. From the Collaboration Editor toolbar, click Source Code Mode. The Collaboration Editor’s Java Source Editor opens.

  2. From the Business Rules tree (Business Rules pane) select the rule that contains the parameter or method that you want to configure. Selecting the rule highlights the corresponding code in the Java Source Editor. Find the code you wish to modify.

  3. From the Java Source Editor, enter the value for the setting you require. For example, to set the BatchFTPOverSSL SecureType method to Explicit SSL, type com.stc.connector.ssl.FTPSSLConstants.FTP_SECURE_TYPE_SSL_EXPLICIT as the parameter value (see example below):


    public void receive( com.stc.connector.appconn.file.FileTextMessage input,
     com.stc.connector.batchadapter.appconn.ftps.FTPOverSSL BatchFTPOverSSL_1 )
    
            throws Throwable
    
        {
    
            if (!BatchFTPOverSSL_1.getClient().isConnected()) {
    
                logger.error( "Collab Start NOT CONNECTED ============ DO CONNECT" );
    
                BatchFTPOverSSL_1.getClient().connect();
    
                BatchFTPOverSSL_1.getConfiguration().setSecureType(
     com.stc.connector.ssl.FTPSSLConstants.FTP_SECURE_TYPE_SSL_EXPLICIT );
    
            }
    
            BatchFTPOverSSL_1.getClient().get();
    
            if (BatchFTPOverSSL_1.getClient().isConnected()) {
    
                logger.error( "Collab End IS CONNECTED ============ DO DISCONNECT" );
    
                BatchFTPOverSSL_1.getClient().disconnect();
    
            }
    
        }
  4. Once you have made your changes to the Collaboration, click the Commit Changes icon (from the Java Source Editor toolbar).

The OTD parameters listed below accept the following specified values: