This topic describes how to create the Batch_FTPIn_LFOut_Sample Project.
First, you create a new Project in the NetBeans IDE
Start the NetBeans IDE
Click the New Project icon, or select File⇒New Project to initiate the New Project wizard.
In Step 1 of the Wizard, select CAPS⇒ESB from the Categories column, CAPS Repository-Based Project from the Projects column, and click Next.
In Step 2 of the Wizard, specify your Project Name (for this Project, use prjBatch_Inbound_FTPIn_LocalFileOut), and click Finish.
Next, you create the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration Definition. A Java Collaboration Definition contains Business Rules that define the processing and transport of data between the Sun Enterprise Service Bus components. The Java Collaboration Definition Wizard is used to create the Java Collaboration Definitions. Once a Collaboration is created, the Collaboration Editor is used to create the Business Rules of the Collaboration.
The jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration defines how data is transferred between the BatchInbound application, the BatchFTP application, and Outbound BatchLocalFile.
From the Project Explorer, right-click prjBatch_Inbound_FTPIn_LocalFileOut and Select New⇒Collaboration Definition (Java) from the context menu.
The Collaboration Definition Wizard (Java) appears.
Enter a Collaboration Definition name (for this Project, use jcdBatch_Inbound_FTPIn_LocalFileOut) .
Under Web Service Type, select Existing: Implement an existing Web Service operation.
Click Next.
For Step 2 of the Wizard, select the Web Service operation to implement. From the select Web Service operation selection window, double-click CAPS Components Library⇒Adapters⇒BatcheWay⇒BatchLocalFile⇒receive.
Click Next.
For Step 3 of the Wizard, from the Select OTDs selection window, double-click CAPS Components Library⇒Adapters⇒BatcheWay⇒BatchFTP.
The BatchFTP OTD is added to the Selected OTDs field.
From the Select OTDs selection window, double-click CAPS Components Library⇒Adapters⇒BatcheWay⇒BatchLocalFile.
The BatchLocalFile OTD is added to the Selected OTDs field.
Click Finish.
The new jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration appears in the Project Explorer tree.
The prjBatch_Inbound_FTPIn_LocalFileOut Project uses the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration you created in the previous topic. To complete the Collaboration, use the Java Collaboration Editor to create the Business Rules.
Be careful to open all nodes specified in the directions to connect the correct items.
From the Project Explorer tree, double-click jcdBatch_Inbound_FTPIn_LocalFileOut.
The Java Collaboration Editor opens to the jcdBatch_Inbound_FTPIn_LocalFileOut Collaboration.
To create comments for the Business Rules, from the Business Rules toolbar, click the Comment icon.
The Enter a Comment dialog box appears. The comment is placed on the Business Rules tree under the last selected item.
Enter the comment and click OK.
Once the comment is created, you can move it by clicking the comment and dragging it up or down the Business Rules tree to a new location.
Create the BatchFTP_1.Client.get rule:
The BatchFTP_1.Client.get rule gets the file from the FTP Client.
Create the Copy BatchFTP_1.Client.Payload to BatchLocalFile_1.Client.Payload rule:
The Copy BatchFTP_1.Client.Payload to BatchLocalFile_1.Client.Payload rule writes the contents of the retrieved file to the payload of the BatchLocalFile.
Click rule on the Business Rules toolbar to add a new rule in the Business Rules pane.
Right-click Client under BatchLocalFile_1 in the left pane of the Business Rules Designer and choose Select Method to Call from the popup menu, and select setPayload(byte[] arg0)from the select method box.
The setPaylod method box appears.
Map Payload under BatchFTP_1 ⇒ Client in the left pane of the Business Rules Designer, to the arg0 (byte[]) input node of the setPayload method box. To do this, click Payload under BatchFTP_1 ⇒ Client in the left pane of the Business Rules Designer, and drag your cursor to the arg0 (byte[]) input node of the setPayload method box.
Create the Copy input.GUIDFileName to BatchFTP_1.Configuration.TargetFileName rule:
The Copy input.GUIDFileName to BatchLocalFile_1.Configuration.TargetFileName rule gives a GUID to the target file, BatchLocalFile Adapter.
Click rule on the Business Rules toolbar to add a new rule in the Business Rules pane.
Right-click Configuration under BatchLocalFile_1 in the left pane of the Business Rules Designer and choose Select Method to Call from the popup menu.
Double-click setTargetFileName(String arg0)from the select method box.
The setTargetFileName method box appears.
Map GUIDFileName under input in the left pane of the Business Rules Designer, to the String arg0 input node of the setTargetFileName method box.
Create the BatchLocalFile_1.Client.put rule:
The BatchLocalFile_1.Client.put rule publishes the file to a local directory.
Click rule on the Business Rules toolbar to add a new rule in the Business Rules pane.
Under the BatchLocalFile_1 node in the left pane of the Business Rules Designer, right-click Client, and choose Select method to call from the context menu.
The method selection window appears.
Select put() from the method selection window.
The put method box appears in the Business Rules Designer canvas.
From the editor’s toolbar, click Validate to check the Collaboration for errors.
Save the Project.
A Connectivity Map provides a canvas for assembling and configuring a Project’s components.
In the Project Explorer, right-click prjBatch_Inbound_FTPIn_LocalFileOut and select New ⇒ Connectivity Mapfrom the context menu.
The new Connectivity Map appears and adds a node on the Project Explorer tree labeled CMap1.
Rename the CMap1 Connectivity Map to cmBatch_Inbound_FTPIn_LocalFileOut.
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.
Drag and drop the jcdBatch_Inbound_FTPIn_LocalFileOut Java Collaboration Definition from the Project window to the Connectivity Map canvas.
The cmBatch_Inbound_FTPIn_LocalFileOut_jcdBatch_Inbound_FTPIn_LocalFileOut1 service is added to the canvas.
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.
Save your current work.
Environments include the External Systems, Logical Hosts, Application Servers, and Message Servers used by the Project and contain the configuration information for these components.
In the Project Explorer, click the Services tab.
In the Services tree, right-click CAPS Environments and select New Environment.
A new Environment is added to the Services tree.
Rename the new Environment to envBatch_Inbound_FTPIn_LocalFileOut.
Right-click envBatch_Inbound_FTPIn_LocalFileOut and select New⇒BatchInbound External System.
Name the External System esBatchInbound and click OK.
The esBatchInbound box is added to the Environment Editor.
Right-click envBatch_Inbound_FTPIn_LocalFileOut and select New⇒BatchFTP External System.
Name the External System esBatchFTP and click OK.
The esBatchFTP box is added to the Environment Editor.
Right-click envBatch_Inbound_FTPIn_LocalFileOut and select New⇒BatchLocalFile External System.
Name the External System esBatchLocalFile and click OK .
The esBatchLocalFile box is added to the Environment Editor.
Right-click envBatch_Inbound_FTPIn_LocalFileOut and select New⇒Logical Host.
The LogicalHost1 icon is added to the Environment and LogicalHost1 is added to the tree.
Right-click LogicalHost1 and select New⇒Sun Java System Application Server.
A new Application Service is added to the tree under LogicalHost1 .
Save the Project.
The prjBatch_Inbound_FTPIn_LocalFileOut Project contains three Adapters, each represented in the Connectivity Map as a node between an External Application and a Collaboration. The Adapters facilitate communication and movement of data between the external applications and the Sun Enterprise Service Bus system.
From the Connectivity Map, double-click the BatchInbound Adapter.
The Adapter Properties Editor appears.
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 (full address) |
File Name |
BatchInbound.txt |
The BatchInbound Adapter Environment properties can keep the default settings for this Project.
From the Connectivity Map, double-click the BatchFTP Adapter.
The Adapter Properties Editor appears.
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 |
Batch51 |
Target File Name |
BatchFTPIn.txt |
From the Services tree, right-click the BatchFTP External System (In this Project, esBatchFTP ), and select Properties.
The Properties Editor opens to the BatchFTP Adapter Environment properties.
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 |
The name of the external system to which the Adapter connects |
Password |
Password required to log into the external system |
Server Port |
Port number to use to connect to the FTP server |
User Name |
User ID used to login to the external system |
Double-click the BatchLocalFile Adapter.
The Adapter Properties Editor appears.
Modify the properties for your system, including the settings in the following table, and click OK.
BatchLocalFile Adapter Properties |
|
---|---|
Target Location - Set as directed, otherwise use the default settings |
|
Target File Name |
dummy (this name is overwritten with the GUID file name in the Java Collaboration) |
Target Directory Name |
X:/Batch51 (where X is your target drive) |
A Deployment Profile is used to assign Collaborations and message destinations to the Sun Java System Application Server and message server. Deployment Profiles are created using the Deployment Editor.
From the Enterprise Explorer’s Project Explorer, right-click the Project (prjBatch_Inbound_FTPIn_LocalFileOut) and select New⇒Deployment Profile.
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.
Click OK.
The Project’s components are automatically mapped to their respective system windows.
If any of your Project components do 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.
Save the Project.
A domain is an instance of a Logical Host. After the domain is created, the Project is built and then deployed.
Navigate to your JavaCAPS6\logicalhost directory, where JavaCAPS6 is the location of your Java CAPS installation.
Double-click the domainmgr.bat file.
The Domain Manager appears.
Do one of the following:
If you have already created a domain, select your domain in the Domain Manager and click Start an Existing Domain.
If there are no existing domains, click Yes.
The Create Domain dialog box appears.
Make any necessary changes to the Create Domain dialog box and click Create.
Select the domain and click the Start an Existing Domain button.
The new domain is added to the Domain Manager.
Once your domain is started, a green check mark indicates that the domain is running.
The Build process compiles and validates the Project’s Java files and creates the Project EAR file.
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.
Make any necessary corrections and click Build again.
From the Deployment Editor toolbar, click the Deploy icon.
The Deploy prompt appears.
Click Yes.
A message appears when the project is successfully deployed.
To run your deployed sample Project do the following