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_Streaming Sample Project

This topic describes how the components of the prjBatch_Streaming sample Project are created. To create the Project manually, do the following:

To Create a Project

  1. Start the NetBeans IDE.
  2. Click the New Project icon, or select File⇒New Project to initiate the New Project wizard.
  3. In Step 1 of the Wizard, select CAPS⇒ESB from the Categories column and CAPS Repository-Based Project from the Projects column, and click Next.
  4. In Step 2 of the Wizard, specify your Project Name (for this Project , use prjBatch_Streaming), and click Finish.

Creating a Java Collaboration Definition

In this task, you create a Java Collaboration using the Collaboration Definition Wizard (Java). Once a Collaboration Definition has been created, the Business Rules of the Collaboration are written using the Collaboration Editor.

To Create the jcdBatch_Streaming Collaboration

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

    The Collaboration Definition Wizard (Java) appears.

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

    The File 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, and select the following three OTDs:
    • BatchFTP

    • BatchLocalFile

    • BatchRecord

  6. From the Select OTDs selection window, double-click CAPS Components Library⇒Adapters⇒File, and select the FileClient OTD.

    The Selected OTDs field now displays the four OTDs.

  7. Click Finish.

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

Using the Java Collaboration Editor

The prjBatch_Streaming Project uses the jcdBatch_Streaming Collaboration created in the Creating a Java Collaboration Definition. To complete the Collaboration, use the Collaboration Editor to create the Business Rules.

To Create the jcdBatch_Streaming Collaboration Business Rules

  1. From the Projects window, double-click jcdBatch_Streaming.

    The Java Collaboration Editor opens to the jcdBatch_Streaming Collaboration.

  2. To create comments for the Business Rules, from the Business Rules toolbar, click the comment icon.

    The Enter a Comment dialog box appears.

  3. Enter the comment and click OK.

    The comment is placed on the Business Rules tree under the last selected item. Click the comment to drag it up or down the Business Rules tree to a new location.

  4. Create the CopyBatchLocalFile_1.Client.OutputStreamAdapter to BatchFTP_1.Client.OutputStreamAdapter rule:

    The CopyBatchLocalFile_1.Client.OutputStreamAdapter to BatchFTP_1.Client.OutputStreamAdapter rule configures the BatchFTP and BatchLocalFile stream adapters so that the BatchFTP Adapter does a stream get, and the BatchLocalFile Adapter receives the stream.

    1. Click rule on the Business Rules toolbar to add a new rule.
    2. Map OutputStreamAdapter under BatchLocalFile_1 ⇒ Client in the left pane of the Business Rules Designer, under to OutputStreamAdapter under BatchFTP_1 ⇒ Client in the right pane of the Business Rules Designer. To do this, Click on OutputStreamAdapter under BatchLocalFile_1 ⇒ Client in the left pane of the Business Rules Designer, and drag your cursor to OutputStreamAdapter under BatchFTP_1 ⇒ Client in the right pane of the Business Rules Designer. A link now connects the two nodes.
  5. Create the BatchFTP_1.Client.get rule:

    The BatchFTP_1.Client.get rule gets the file.

    1. Click rule on the Business Rules toolbar to add a new rule.
    2. Under BatchFTP_1 in the left pane of the Business Rules Designer, right-click Client, and click Select Method to Call from the context menu.

      The method selection window appears.

    3. Select get() from the method selection window.

      The get method box appears in the Business Rules Designer canvas.

  6. Create the Copy BatchLocalFile_1.Configuration.PostDirectoryName to BatchLocalFile_1.Configuration.TargetDirectoryName rule:

    The Copy BatchLocalFile_1.Configuration.PostDirectoryName to BatchLocalFile_1.Configuration.TargetDirectoryName rule dynamically configures the name of the target directory to the post directory name.

    1. Click rule on the Business Rules toolbar to add a new rule.
    2. Map PostDirectoryName under BatchLocalFile_1 ⇒ Configuration in the left pane of the Business Rules Designer, to TargetDirectoryName under BatchLocalFile_1 ⇒ Configuration in the right pane.
  7. Create the Copy BatchLocalFile_1.Configuration.PostFileName to BatchLocalFile_1.Configuration.TargetFileName rule:

    The Copy BatchLocalFile_1.Configuration.PostFileName to BatchLocalFile_1.Configuration.TargetFileName rule dynamically configures the name of the target file to the post file name.

    1. Click rule on the Business Rules toolbar to add a new rule.
    2. Under BatchLocalFile_1⇒Configuration in the left pane of the Business Rules Designer, map PostFileName to TargetFileName under BatchLocalFile_1 ⇒ Configuration in the right pane of the Business Rules Designer.
  8. Create the Copy "None" to BatchLocalFile_1.Configuration.PostTransferCommand rule:

    The Copy "None" to BatchLocalFile_1.Configuration.PostTransferCommand rule dynamically configures the post transfer command to None so that no post transfer will take place.

    1. From the Business Rules Designer’s String menu, select Literal String.

      The String literal box appears.

    2. Double-click the value field of the String literal box and enter None as the value.
    3. Map the None output node of the String literal box to PostTransferCommand under BatchLocalFile_1⇒Configuration in the right pane of the Business Rules Designer
  9. Create the Copy BatchLocalFile_1.Client.InputStreamAdapter to BatchRecord_1.InputStreamAdapter rule:

    The Copy BatchLocalFile_1.Client.InputStreamAdapter to BatchRecord_1.InputStreamAdapter rule configures the BatchLocalFile and BatchRecord stream adapters so that the BatchLocalFile Adapter does a stream get, and the BatchRecord Adapter receives the stream.

    1. Click rule on the Business Rules toolbar to add a new rule.
    2. Under BatchLocalFile_1 > Client in the left pane of the Business Rules Designer, map InputStreamAdapter to InputStreamAdapter under BatchRecord_1 in the right pane of the Business Rules Designer.
  10. Create the While statement:

    The While statement’s rules get the record, publish it to the outbound File Adapter, and the File Adapter writes the file to a local directory.

    1. Click While on the Business Rules toolbar to add a new while statement in the Business Rules pane.
    2. From the Business Rules tree, expand the While statement and select the condition.
    3. From the Business Rules Designer, right-click BatchRecord_1 in the left pane of the Business Rules Designer, and click Select method to call from the context menu.

      The method selection window appears.

    4. Select get() from the method selection window.

      The get method box appears in the Business Rules Designer canvas.

    5. Map the output node of the get method box to result (boolean) condition in the right pane of the Business Rules Designer.
      image:Image shows the While statement in the Business Rules Designer
  11. Create the Copy BatchRecord_1.Record to FileClient_1.ByteArray rule under the while statement:
    1. From the Business Rules tree, select rules under the While statement.
    2. Map Record, under BatchRecord_1 in the left pane of the Business Rules Designer, to ByteArray under FileClient_1 in the right pane of the Business Rules Designer.
  12. To create the FileClient_1.write rule under the while statement do the following:
    1. Click rule on the Business Rules toolbar to add a new rule under the While statement.
    2. Right-click FileClient_1 in the left pane of the Business Rules Designer, and click Select method to call from the context menu.

      The method selection window appears.

    3. Select write() from the method selection window.

      The write method box appears in the Business Rules Designer canvas.

  13. Create the BatchRecord_1.finish rule:
    1. Select the while statement on the Business Rules tree and click rule on the Business Rules toolbar.

      A new rule is added to the Business Rules tree.

    2. Right-click BatchRecord_1 in the left pane of the Business Rules Designer, and click Select method to call from the context menu.

      The method selection window appears.

    3. Select finish() from the method selection window.

      The finish method box appears.

  14. From the editor’s toolbar, click Validate to check the Collaboration for errors.
    image:Image shows the completed business rules for the prjBatch_Streaming Collaboration Definition
  15. Save the Project.

To Create a Connectivity Map

The Connectivity Map provides a canvas for configuring a Project’s components.

  1. In Projects window, right-click the new Project (prjBatch_Streaming) and select New ⇒ Connectivity Map from the context menu.

    The new Connectivity Map appears and a node for the new Connectivity Map is added under the Project on the Project tree labeled CMAP1.

  2. Rename the Connectivity Map to cmBatch_Streaming.

To Generate the Connectivity Map

Once your Java Collaboration Definition is completed you can use it to generate your Connectivity Map. Generating the Connectivity Map will automatically populate the canvas with the correct components and bind the components according to the information provided by the Java Collaboration Definition.

  1. Drag and drop the jcdBatch_Streaming Java Collaboration Definition from the Project window to the Connectivity Map canvas.

    The cmBatch_Streaming_jcdBatch_Streaming1 service is added to the canvas.

  2. Click the Connectivity Map Generator icon. The Connectivity Map Generator dialog box appears listing the necessary components and bindings to generate the Connectivity Map. Click OK.

    The External applications are added to the Connectivity Map and the Bindings are created. The red squares in the bindings represent the Batch Adapters. The red color indicates that the adapter properties have not been configured.

  3. Save your current work.

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 CAPS Environment and select New Environment.
  3. Rename the new Environment envBatch_Streaming.
  4. Right-click the envBatch_Streaming Environment and select New⇒BatchInbound External System.
  5. Name this External System esBatchInbound.

    The esBatchInbound window is added to the Environment Editor.

  6. Right-click envBatch_Streaming and select New⇒BatchFTP External System.
  7. Name this External System esBatchFTP.
  8. Right-click envBatch_Streaming and select New⇒BatchLocalFile External System.
  9. Name the External System esBatchLocalFile.
  10. Right-click envBatch_Streaming and select New⇒BatchRecord External System.
  11. Name the External System esBatchRecord.
  12. Right-click envBatch_Streaming and select New⇒File External System.
  13. Name this External System esFile.
  14. Right-click envBatch_Streaming and select New Logical Host.

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

  15. 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 LogicalHost1.

  16. Save the Project.

Configuring the Adapter Properties

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

To Configure the BatchInbound Adapter Properties

  1. From the Connectivity Map, double-click the BatchInbound Adapter.

    The Adapter Properties Editor appears.

  2. Modify the properties for your system, including the settings for the BatchInbound Adapter in the following table, and click OK.
    BatchInbound Adapter Connectivity Map Properties
    Settings - Set as directed, otherwise use the default settings
    Directory Name
    Your input directory
    File Name
    BatchInbound.txt

    Note - The BatchInbound Adapter Environment properties can keep the default settings for this sample.


Configuring the BatchFTP Adapter Properties

To Modify the BatchFTP Adapter Connectivity Map Properties

  1. From the Connectivity Map, double-click the BatchFTP Adapter.

    The Adapter Properties Editor appears.

  2. Modify the BatchFTP Adapter Connectivity Map properties for your system, including the settings in the following table, and click OK.
    BatchFTP Adapter Connectivity Map Properties
    Target Location - Set as directed, otherwise use the default settings
    Target Directory Name
    The directory (absolute path) from which files are retrieved
    Target File Name
    BatchFTPIn.txt

To Modify the BatchFTP Adapter Properties

  1. From the Services tree, right-click the BatchFTP External System (esBatchFTP in this sample), and select Properties.

    The Properties Editor opens to the BatchFTP Adapter Environment properties.

  2. Modify the BatchFTP Adapter Environment properties for your system, including the settings in the following table, and click OK.
    BatchFTP Adapter Environment Properties
    FTP - Set as directed, otherwise use the default settings.
    Host Name
    localhost
    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

To Configure the BatchLocalFile Adapter Properties

The BatchLocalFile Adapter’s specific properties are set from the Connectivity Map. Environment properties can use the default settings.

  1. Double-click the BatchLocalFile Adapter.

    The Adapter Properties Editor appears.

  2. Modify the properties for your system, including the settings in the following table, and click OK.
    BatchLocalFile Adapter Properties
    Post Transfer - Set as directed, otherwise use the default settings
    Post Directory Name
    X:/Batch51/ready
    Post File Name
    BatchLocalFileReady.txt
    Target Location - Set as directed, otherwise use the default settings
    Target File Name
    The name of the file to be sent.
    Target Directory Name
    The directory on the system where files are sent.

To Configure the BatchRecord Adapter Properties

The BatchRecord Adapter’s specific properties are set from the Connectivity Map. Environment properties can use the default settings.

  1. From the Connectivity Map, double-click the BatchRecord Adapter.

    The Properties Sheet opens to the Adapter Connectivity Map properties.

  2. Modify the configuration for your system, including the settings in the following table.
    BatchRecord Adapter Connectivity Map Properties
    General Settings - Set as directed, otherwise use the default settings
    Parse or Create Mode
    Parse
    Record - Set as directed, otherwise use the default settings
    Delimiter on Last Record
    Yes
    Record Delimiter
    \n
    Record Type
    Delimited

Configuring the File Adapter Properties

To Modify the outbound File Adapter Connectivity Map properties

  1. From the Connectivity Map, double-click the outbound File1 Adapter.

    The Properties Editor opens to the outbound File Adapter properties.

  2. Modify the configuration for your system, including the settings in the following table.
    Outbound File Adapter Connectivity Map Properties
    Parameter Settings - Set as directed, otherwise use the default settings
    Output File Name
    FileOutput%d.txt

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
    Parameter Settings - Set as directed, otherwise use the default settings.
    Directory
    The directory on the system where files are sent.

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_Inbound_FTPIn_LocalFileOut) and select New ⇒ Deployment Profile.
  2. Enter a name for the Deployment Profile (for this Project, use dpBatch_Inbound_FTPIn_LocalFileOut).

    Make sure that the selected Environment is envBatch_Inbound_FTPIn_LocalFileOut.

  3. 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

  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.