JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Java CAPS Adapter for Batch Tutorial     Java CAPS Documentation
search filter icon
search icon

Document Information

Oracle Java CAPS Adapter for Batch Tutorial

Importing Non-JBI Based Sample Projects

To Import a Non-JBI Based Sample Project

About the Oracle Java CAPS Business Process Manager Sample Project

Associating BPM Operators

Considerations for BPM Projects

Creating the bpBatch_Inbound_LocalFileIn_FTPOut Project

To Create a Project

Creating the bpBatch_Inbound_LocalFileIn_FTPOut Business Process

To Create the Business Process

Adding Business Rules to the Design Elements

To Create a Connectivity Map

To Generate the Connectivity Map

Creating an Environment

To Create an Environment

Configuring the Adapters' Properties

To Configure the BatchInbound Adapter Properties

To Configure the BatchLocalFile Adapter Properties

Configuring the BatchFTP Adapter Properties

Creating the Deployment Profile

To Create the Deployment Profile

Building and Deploying the Project

To Build the Project

To Deploy the Project

To Run the Sample

About the JCD Sample Projects

prjBatch_Inbound_FTPIn_LocalFileOut

prjBatch_Streaming

prjBatch_Record

prjBatch_Secure

JCD Components

Considerations for JCD Projects

The Adapter for Batch JCD Sample Projects

The prjBatch_Inbound_FTPIn_LocalFileOut Sample Project

To Create a Project

Creating the Java Collaboration Definitions

Creating the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration

To Create the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration

Using the Java Collaboration Editor

To Create the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration Business Rules

Creating a Connectivity Map

To Create a Connectivity Map

To Generate the Connectivity Map

Creating an Environment

To Create an Environment

Configuring the Adapters Properties

To Configure the BatchInbound Adapter Properties

Configuring the BatchFTP Adapter Properties

Building and Deploying the Project

To Build the Project

To Deploy the Project

To Run the Sample

The prjBatch_Streaming Sample Project

To Create a Project

Creating a Java Collaboration Definition

To Create the jcdBatch_Streaming Collaboration

Using the Java Collaboration Editor

To Create the jcdBatch_Streaming Collaboration Business Rules

To Create a Connectivity Map

To Generate the Connectivity Map

To Create an Environment

Configuring the Adapter Properties

To Configure the BatchInbound Adapter Properties

Configuring the BatchFTP Adapter Properties

Configuring the File Adapter Properties

Building and Deploying the Project

To Build the Project

To Deploy the Project

To Run the Sample

The prjBatch_Record Sample Project

To Create a Project

Creating a Java Collaboration Definition

To Create the jcdBatch_Record Collaboration

Using the Java Collaboration Editor

To Create the jcdBatch_Record Collaboration Business Rules

To Create a Connectivity Map

To Generate the Connectivity Map

To Create an Environment

Configuring the Adapter Properties

To Configure File Adapter Connectivity Map Properties

To Modify the File Adapter Environment properties

To Configure the BatchRecord Adapter Properties

To Modify the BatchRecordParse Adapter Connectivity Map properties

To Modify the BatchRecord Adapter Environment properties

To Create the Deployment Profile

Building and Deploying the Project

To Build the Project

To Deploy the Project

To Run the Sample

The prjBatch_Secure Project

The prjBatch_Secure Project Components

The prjBatch_Secure Project Collaboration Definitions

To Create the jcdBatchFTPOverSSL Java Collaboration

To Create the jcdBatchSCP Java Collaboration

To Create the jcdBatchSFTP Java Collaboration

Collaboration Business Rules

jcdBatchFTPOverSSL Business Rules

jcdBatchFTPOverSSL Java Source File

jcdBatchSCP Business Rules

jcdBatchSCP Java Source File

jcdBatchSFTP Business Rules

jcdBatchSFTP Java Source File

Completing the prjBatch_Secure Project

To Create an Environment

Configuring the Adapter Properties

To Configure the File Adapter Connectivity Map properties

To Modify the File Adapter Environment properties

To Modify the Batch/FTP Adapter Connectivity Map Properties

To Modify the BatchFTPoverSSL Adapter Environment Properties

To Create the Sample Directories

To Create the Deployment Profile

Building and Deploying the Project

To Build the Project

To Deploy the Project

To Run the Sample

The prjBatch_Secure Project

This topic provides an overview of the prjBatch_Secure Project, and describes how to run the imported sample.

The prjBatch_Secure Project contains three scenarios that employ three Batch OTDS to enable SSL or SSH secure file transfers.

The prjBatch_Secure Project Components

TheprjBatch_Secure Project uses four External Applications, seven component Adapters, and three Java Collaborations.

The Adapter for Batch performs the following functions

The prjBatch_Secure Project Collaboration Definitions

The prjBatch_Secure Project includes three Java Collaborations, one for each of the three scenarios provided in the cmBatch_Secure Connectivity Map. The jcdBatchFTPOverSSL, jcdBatchSCP, and jcdBatchSFTP Java Collaboration Definitions are each created using the Collaboration Definition Wizard (Java).

To Create the jcdBatchFTPOverSSL Java Collaboration

  1. From the Projects window, right-click the prjBatch_Secure Project and select New⇒Collaboration Definition (Java) from the context menu.

    The Java Collaboration Definition Wizard appears.

  2. Enter a Collaboration Definition name (for this Project, use jcdBatchFTPOverSSL) and click Next.
  3. For Step 2 of the Wizard, from the Web Services Interfaces selection window, double-click CAPS Components Library⇒Adapters⇒File⇒FileClient⇒receive.

    The Name field now displays receive.

  4. Click Next.
  5. For Step 3 of the Wizard, from the Select OTDs selection window, double-click CAPS Components Library⇒Adapters⇒BatchAdapter⇒BatchFTPOverSSL.

    The jcdBatchFTPOverSSL OTD is added to the Selected OTDs field.

  6. Click the Up One Level button.
  7. Double-click CAPS Components Library ⇒ Adapters ⇒ File ⇒ FileClient.

    The FileClient OTD is added to the Selected OTDs field.

  8. Click Finish.

    The Java Collaboration Editor opens to the new Collaboration in the right pane of the NetBeans IDE.

To Create the jcdBatchSCP Java Collaboration

To Create the jcdBatchSFTP Java Collaboration

Collaboration Business Rules

The Java Collaboration Business Rules for the Project are separated into three Java Collaborations as seen from the Java Collaboration Editor: jcdBatchFTPOverSSL, jcdBatchSCP, and jcdBatchSFTP. The following images display the business rules for each of the Java Collaboration Definitions along with the Java source code.

jcdBatchFTPOverSSL Business Rules
image:Image shows the business rules for the jcdBatchFTPOverSSL Java Collaboration Definition
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();
    }

}
jcdBatchSCP Business Rules
image:Image shows the business rules for the jcdBatchSCP Java Collaboration Definition
jcdBatchSCP Java Source File
package prBatch_Secure;


public class jcdBatchSCP
{

    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.scp.SCP BatchSCP_1 )
        throws Throwable
    {
        // recursive get and put
        BatchSCP_1.getConfiguration().setLocalDirectory( "C:/BatchSecurity/SCP" );
        BatchSCP_1.getConfiguration().setLocalFile( "recursive" );
        BatchSCP_1.getClient().getRecursive();
        BatchSCP_1.getConfiguration().setRemoteDirectory( "BatchSecurity/SCP" );
        BatchSCP_1.getConfiguration().setRemoteFile( "recursive" );
        BatchSCP_1.getClient().putRecursive();
    }

}
jcdBatchSFTP Business Rules
image:Image shows the business rules for the jcdBatchSFTP Java Collaboration Definition
jcdBatchSFTP Java Source File
package prBatch_Secure;


public class jcdBatchSFTP
{

    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.sftp.SFTP BatchSFTP_1 )
        throws Throwable
    {
        // get, make directory, change directory, put, rename, delete
        BatchSFTP_1.getConfiguration().setLocalDirectory( "C:/BatchSecurity/SFTP" );
        BatchSFTP_1.getConfiguration().setLocalFile( "SFTP_from_remote.txt" );
        BatchSFTP_1.getClient().get();
        BatchSFTP_1.getClient().mkdir( "BatchSecurity/new_SFTP" );
        BatchSFTP_1.getClient().cd( "BatchSecurity/new_SFTP" );
        BatchSFTP_1.getConfiguration().setRemoteDirectory( "" );
        BatchSFTP_1.getConfiguration().setRemoteFile( "SFTP_to_remote.txt" );
        BatchSFTP_1.getClient().put();
        BatchSFTP_1.getClient().rename( "BatchSecurity/new_SFTP/SFTP_to_remote.txt", 
"BatchSecurity/new_SFTP/renamed_SFTP_to_remote.txt" );
        BatchSFTP_1.getClient().delete( "BatchSecurity/useless_SFTP.txt" );
    }

}

Completing the prjBatch_Secure Project

Import the prjBatch_Secure Project described in To Import a Non-JBI Based Sample Project. After the sample Project has been imported and appears in your Project tree, create the Project’s Environment.

To Create an Environment

Environments include the External Systems, Logical Hosts, Application Servers and Message Servers used by a Project and contain the configuration information for these components.

  1. From the NetBeans IDE click the Services tab.
  2. Right-click the CAPS Environments and select New Environment.

    A new Environment is added to the Services tree.

  3. Rename the new Environment to envBatch_Secure.
  4. Right-click envBatch_Secure and select New⇒BatchFTPOverSSL External System.
  5. Name this External System esBatchFTPOverSSL.

    The esBatchFTPOverSSL window is added to the Environment Editor.

  6. Right-click envBatch_Secure and select New⇒BatchSCP External System.
  7. Name this External System esBatchSCP.

    The esBatchSCP window is added to the Environment Editor.

  8. Right-click envBatch_Secure and select New⇒BatchSFTP External System.
  9. Name this External System esBatchSFTP.

    The esBatchSFTP window is added to the Environment Editor.

  10. Right-click envBatch_Secure and select New⇒File External System.
  11. Name the External System esFile and click OK.

    The esFile window is added to the Environment Editor.

  12. Right-click envBatch_Secure and select New⇒Logical Host.

    The LogicalHost1 box is added to the Environment and LogicalHost1 is added to the Environment Editor tree.

  13. From the Services tree, right-click LogicalHost1 and select New⇒Sun Java System Application Server.

    A new Application Server is added to the Services tree under Localhost1.

  14. Save the Project.

Configuring the Adapter Properties

The prjBatch_Secure Project uses seven component Adapters, each represented in the Connectivity Map as a node between an External Application and the Service.

To Configure the File Adapter Connectivity Map properties

  1. From the Connectivity Map, double-click the inbound FileIn_BatchFTPOverSSL Adapter between the FileIn_BatchFTPOverSSL External Application and the jcolBatchFTPOverSSL1 service.

    The Properties Editor opens to the inbound File Adapter properties.

  2. Modify the configuration for your system, including the settings in the following table.
    Inbound File Adapter Connectivity Map Properties
    Parameter Settings - Set as directed, otherwise use the default settings
    Input File Name
    FileIn_BatchFTPOverSSL.txt
  3. From the Connectivity Map, modify the inbound FileIn_BatchSFTP Adapter between the FileIn_BatchSFTP External Application and the jcolBatchSFTP1 service.

    See the following table.


    Inbound File Adapter Connectivity Map Properties
    Parameter Settings - Set as directed, otherwise use the default settings
    Input File Name
    FileIn_BatchSFTP.txt
  4. From the Connectivity Map, modify the inbound FileIn_BatchSCP Adapter between the FileIn_BatchSCP External Application and the jcolBatchSCP1 service.

    See the following table.


    Inbound File Adapter Connectivity Map Properties
    Parameter Settings - Set as directed, otherwise use the default settings
    Input File Name
    FileIn_BatchSCP.txt
  5. From the Connectivity Map, modify the Outbound FileOut_BatchFTPOverSSL Adapter between the FileOut_BatchFTPOverSSL External Application and the jcolBatchFTPOverSSL1 service.

    See the following table.


    Outbound File Adapter Connectivity Map Properties
    Parameter Settings - Set as directed, otherwise use the default settings
    Output File Name
    FileOut_BatchFTPOverSSL.dat

To Modify the File Adapter Environment properties

  1. From the Services tree, right-click the esFile External System, and select Properties.

    The Properties Editor opens to the File Adapter Environment properties.

  2. Modify the File Adapter Environment properties for your system, including the settings in the following table, and click OK.
    File Adapter Environment Properties
    Inbound File Adapter ⇒ Parameter Settings - Set as directed, otherwise use the default settings.
    Directory
    An input directory on your system that the inbound File Adapters poll and pick up any specified input files.
    Outbound File Adapter ⇒ Parameter Settings - Set as directed, otherwise use the default settings.
    Directory
    An output directory to which the outbound File Adapter publishes (writes) the output messages.

To Modify the Batch/FTP Adapter Connectivity Map Properties

  1. From the Connectivity Map, double-click the BatchFTPoverSSL1 Adapter, located between the BatchFTPOverSSL1 External Application and the jcolBatchFTPOverSSL1 service.

    The Adapter Properties Editor appears.

  2. Modify the BatchFTPoverSSL Adapter Connectivity Map properties for your system, including the settings in the following table, and click OK.
    BatchFTPoverSSL Adapter Connectivity Map Properties
    FTP and SSL Settings - Set as directed, otherwise use the default settings
    Local Directory
    The local directory name and path for files that are sent to or received from a remote system. The default is X:/Batch51
    Target File Name
    The name of the remote file.

To Modify the BatchFTPoverSSL Adapter Environment Properties

  1. From the Services tree, right-click the BatchFTPoverSSL External System (in this Project, esBatchFTPoverSSL ), and select Properties.

    The Properties Editor opens to the BatchFTPoverSSL Adapter Environment properties.

  2. Modify the BatchFTPoverSSL Adapter Environment properties for your system, including the settings in the following table, and click OK.
    BatchFTPoverSSL Adapter Environment Properties
    FTP and SSL Settings - Set as directed, otherwise use the default settings.
    Host Name
    Host name or IP of the FTP server
    Server Port
    Port number to use to connect to the FTP server
    User Name
    User ID used to log into the system
    Password
    Password required to log into the system

    Configure the Adapter properties for your system.

To Create the Sample Directories

The prjBatch_Secure sample Project uses a number of directories.

To Create the Deployment Profile

A Deployment Profile is used to assign Collaborations and message destinations to the Application Server and message server. Deployment profiles are created using the Deployment Editor.

  1. From the Projects window, right-click the Project (prjBatch_Secure) and select New⇒Deployment Profile.
  2. Enter a name for the Deployment Profile (for this sample dpBatch_Secure).
  3. Make sure that the selected Environment is envBatch_Secure and click OK.
  4. Click Automap.

    The Project’s components are automatically mapped to their respective system windows.


    Note - If any of your Project components did not successfully map to an external system, open each of your Adapter’s configuration properties (Connectivity Map and Environment) and click OK to close and save the current configuration, then click Automap again.


  5. Save the Project.

Building and Deploying the Project

The Build process compiles and validates the Project’s Java files and creates the Project EAR file.

To Build the Project

  1. From the Deployment Editor toolbar, click the Build icon.

    If there are any validation errors, a Validation Errors pane will appear at the bottom of the Deployment Editor and displays information regarding the errors.

  2. Make any necessary corrections and click Build again.

To Deploy the Project

Before You Begin

Make sure the GlassFish server is started.

  1. From the Deployment Editor toolbar, click the Deploy icon.

    The Deploy prompt appears.

  2. Click Yes.

    A message appears when the project is successfully deployed.

To Run the Sample

To run your deployed sample Project do the following

  1. From your configured input directory, paste (or rename) the sample input file to trigger the Adapter.
  2. From your output directory, verify the output data.